@gearbox-protocol/ui-kit 4.0.0-next.51 → 4.0.0-next.53
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/borrow-rate-block/borrow-rate-block.cjs +1 -1
- package/dist/cjs/components/base/detailed-page-title/copy-button.cjs +1 -0
- package/dist/cjs/components/base/detailed-page-title/detailed-page-title.cjs +1 -1
- package/dist/cjs/components/base/index.cjs +1 -1
- package/dist/cjs/components/base/info-list/info-list.cjs +1 -1
- package/dist/cjs/components/base/leverage-input/leverage-input.cjs +1 -1
- package/dist/cjs/components/base/manage-pane/manage-pane.cjs +1 -1
- package/dist/cjs/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/components/base/position-assets/position-assets.cjs +1 -1
- package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/components/base/tabber/tabber.cjs +1 -1
- package/dist/cjs/components/base/token-amount/token-amount.cjs +1 -1
- package/dist/cjs/components/base/values/index.cjs +1 -1
- package/dist/cjs/components/base-table/base-table-line.cjs +1 -1
- package/dist/cjs/components/base-table/base-table.cjs +1 -1
- package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
- package/dist/cjs/components/composites/pool-assets-table/pool-assets-table-row.cjs +1 -1
- package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
- package/dist/cjs/components/detailed-page-title/index.cjs +1 -1
- package/dist/cjs/components/graph/formatters.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/loading/loading.cjs +1 -1
- package/dist/cjs/components/sdk-status-pill/sdk-status-pill.cjs +1 -1
- package/dist/cjs/components/table/index.cjs +1 -1
- package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/esm/components/base/borrow-rate-block/borrow-rate-block.js +2 -3
- package/dist/esm/components/{detailed-page-title/detailed-page-title-copy-button.js → base/detailed-page-title/copy-button.js} +8 -8
- package/dist/esm/components/base/detailed-page-title/detailed-page-title.js +6 -6
- package/dist/esm/components/base/index.js +144 -153
- package/dist/esm/components/base/info-list/info-list.js +47 -24
- package/dist/esm/components/base/leverage-input/leverage-input.js +65 -47
- package/dist/esm/components/base/manage-pane/manage-pane.js +83 -73
- package/dist/esm/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.js +1 -1
- package/dist/esm/components/base/position-assets/position-assets.js +2 -3
- package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +1 -1
- package/dist/esm/components/base/tabber/tabber.js +51 -39
- package/dist/esm/components/base/token-amount/token-amount.js +1 -1
- package/dist/esm/components/base/values/index.js +17 -19
- package/dist/esm/components/base-table/base-table-line.js +1 -1
- package/dist/esm/components/base-table/base-table.js +60 -55
- package/dist/esm/components/checkbox/checkbox-labeled.js +17 -20
- package/dist/esm/components/composites/pool-assets-table/pool-assets-table-row.js +2 -3
- package/dist/esm/components/compound-apy/compound-apy.js +2 -3
- package/dist/esm/components/detailed-page-title/index.js +2 -4
- package/dist/esm/components/graph/formatters.js +39 -39
- package/dist/esm/components/index.js +581 -603
- package/dist/esm/components/loading/loading.js +22 -15
- package/dist/esm/components/sdk-status-pill/sdk-status-pill.js +19 -14
- package/dist/esm/components/table/index.js +16 -20
- package/dist/esm/components/with-copy/with-copy.js +19 -22
- package/dist/esm/index.js +712 -734
- package/dist/globals.css +1 -1
- package/dist/types/components/base/index.d.ts +0 -2
- package/dist/types/components/base/leverage-input/leverage-input.d.ts +2 -2
- package/dist/types/components/base/values/index.d.ts +0 -1
- package/dist/types/components/detailed-page-title/index.d.ts +0 -1
- package/dist/types/components/index.d.ts +0 -3
- package/dist/types/components/spinner-loader/spinner-loader.d.ts +1 -1
- package/dist/types/components/table/index.d.ts +0 -2
- package/dist/types/index.d.ts +0 -3
- package/dist/types/types/index.d.ts +0 -1
- package/dist/types/utils/ranges.spec.d.ts +0 -1
- package/package.json +1 -1
- package/dist/cjs/components/base/info-portal/index.cjs +0 -1
- package/dist/cjs/components/base/info-portal/info-portal.cjs +0 -1
- package/dist/cjs/components/base/sticky-bar/constants.cjs +0 -1
- package/dist/cjs/components/base/sticky-bar/index.cjs +0 -1
- package/dist/cjs/components/base/sticky-bar/sticky-bar.cjs +0 -1
- package/dist/cjs/components/base/values/points-value.cjs +0 -1
- package/dist/cjs/components/detailed-page-title/detailed-page-title-copy-button.cjs +0 -1
- package/dist/cjs/components/loading-bar/index.cjs +0 -1
- package/dist/cjs/components/loading-bar/loading-bar.cjs +0 -1
- package/dist/cjs/components/status-dot/index.cjs +0 -1
- package/dist/cjs/components/status-dot/status-dot.cjs +0 -1
- package/dist/cjs/components/table/table-loader-guard.cjs +0 -1
- package/dist/cjs/components/table/table-loader.cjs +0 -1
- package/dist/cjs/components/with-title/index.cjs +0 -1
- package/dist/cjs/components/with-title/with-title.cjs +0 -1
- package/dist/cjs/types/filter.cjs +0 -1
- package/dist/esm/components/base/info-portal/index.js +0 -5
- package/dist/esm/components/base/info-portal/info-portal.js +0 -20
- package/dist/esm/components/base/sticky-bar/constants.js +0 -6
- package/dist/esm/components/base/sticky-bar/index.js +0 -6
- package/dist/esm/components/base/sticky-bar/sticky-bar.js +0 -28
- package/dist/esm/components/base/values/points-value.js +0 -30
- package/dist/esm/components/loading-bar/index.js +0 -4
- package/dist/esm/components/loading-bar/loading-bar.js +0 -27
- package/dist/esm/components/status-dot/index.js +0 -5
- package/dist/esm/components/status-dot/status-dot.js +0 -49
- package/dist/esm/components/table/table-loader-guard.js +0 -31
- package/dist/esm/components/table/table-loader.js +0 -25
- package/dist/esm/components/with-title/index.js +0 -4
- package/dist/esm/components/with-title/with-title.js +0 -43
- package/dist/esm/types/filter.js +0 -1
- package/dist/types/components/base/info-portal/index.d.ts +0 -1
- package/dist/types/components/base/info-portal/info-portal.d.ts +0 -8
- package/dist/types/components/base/sticky-bar/constants.d.ts +0 -3
- package/dist/types/components/base/sticky-bar/index.d.ts +0 -1
- package/dist/types/components/base/sticky-bar/sticky-bar.d.ts +0 -9
- package/dist/types/components/base/values/points-value.d.ts +0 -11
- package/dist/types/components/loading-bar/index.d.ts +0 -1
- package/dist/types/components/loading-bar/loading-bar.d.ts +0 -25
- package/dist/types/components/status-dot/index.d.ts +0 -1
- package/dist/types/components/status-dot/status-dot.d.ts +0 -47
- package/dist/types/components/table/table-loader-guard.d.ts +0 -45
- package/dist/types/components/table/table-loader.d.ts +0 -50
- package/dist/types/components/with-title/index.d.ts +0 -1
- package/dist/types/components/with-title/with-title.d.ts +0 -31
- package/dist/types/types/filter.d.ts +0 -8
- /package/dist/types/components/{detailed-page-title/detailed-page-title-copy-button.d.ts → base/detailed-page-title/copy-button.d.ts} +0 -0
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Children as
|
|
3
|
-
import { Guard as
|
|
4
|
-
import { HeadCell as
|
|
1
|
+
import { jsxs as x, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Children as p } from "react";
|
|
3
|
+
import { Guard as f } from "../guard/guard.js";
|
|
4
|
+
import { HeadCell as C } from "../head-cell/head-cell.js";
|
|
5
5
|
import "react-intl";
|
|
6
6
|
import "../buttons/button/button.js";
|
|
7
7
|
import "@gearbox-protocol/sdk/onchain";
|
|
8
|
-
import { cn as
|
|
8
|
+
import { cn as c } from "../../utils/cn.js";
|
|
9
9
|
import "luxon";
|
|
10
10
|
import "../../utils/z-index.js";
|
|
11
|
-
import { GridTable as
|
|
12
|
-
import "../
|
|
11
|
+
import { GridTable as j, GridTableHeader as H, GridTableRow as u, GridTableHead as N, GridTableBody as h, GridTableCell as B } from "../table/grid-table.js";
|
|
12
|
+
import { GridLoadingLine as S } from "../table/grid-loading-line.js";
|
|
13
13
|
import "../table/table.js";
|
|
14
|
-
import { TableLoaderGuard as S } from "../table/table-loader-guard.js";
|
|
15
14
|
import { useIsMobile as v } from "../../hooks/use-media-query.js";
|
|
16
|
-
import { BaseTableTest as
|
|
17
|
-
import { BaseTableLineTest as
|
|
15
|
+
import { BaseTableTest as m } from "./constants.js";
|
|
16
|
+
import { BaseTableLineTest as V } from "./constants.js";
|
|
18
17
|
function z({
|
|
19
18
|
message: i,
|
|
20
19
|
testId: o
|
|
21
20
|
}) {
|
|
22
|
-
return /* @__PURE__ */
|
|
21
|
+
return /* @__PURE__ */ t(u, { noHover: !0, last: !0, children: /* @__PURE__ */ t(
|
|
23
22
|
B,
|
|
24
23
|
{
|
|
25
24
|
span: "full",
|
|
@@ -31,70 +30,76 @@ function z({
|
|
|
31
30
|
}
|
|
32
31
|
) });
|
|
33
32
|
}
|
|
34
|
-
function
|
|
33
|
+
function Q({
|
|
35
34
|
columns: i,
|
|
36
35
|
isLoading: o,
|
|
37
|
-
emptyMessage:
|
|
38
|
-
sort:
|
|
39
|
-
rowHeight:
|
|
40
|
-
loaderRows:
|
|
41
|
-
className:
|
|
42
|
-
wrapperClassName:
|
|
43
|
-
children:
|
|
36
|
+
emptyMessage: g,
|
|
37
|
+
sort: s,
|
|
38
|
+
rowHeight: b = "66px",
|
|
39
|
+
loaderRows: l = 5,
|
|
40
|
+
className: T,
|
|
41
|
+
wrapperClassName: G,
|
|
42
|
+
children: d
|
|
44
43
|
}) {
|
|
45
|
-
const
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
-
|
|
44
|
+
const n = v(), w = i.map((e) => e.track).join(" ");
|
|
45
|
+
return /* @__PURE__ */ x(
|
|
46
|
+
j,
|
|
48
47
|
{
|
|
49
|
-
cols:
|
|
48
|
+
cols: n ? "1fr" : w,
|
|
50
49
|
gap: 0,
|
|
51
50
|
size: "lg",
|
|
52
|
-
className:
|
|
53
|
-
wrapperClassName:
|
|
54
|
-
"data-testid":
|
|
51
|
+
className: c("min-w-0 w-full", T),
|
|
52
|
+
wrapperClassName: G,
|
|
53
|
+
"data-testid": m.root,
|
|
55
54
|
children: [
|
|
56
|
-
!
|
|
57
|
-
const
|
|
58
|
-
return /* @__PURE__ */
|
|
59
|
-
|
|
55
|
+
!n && /* @__PURE__ */ t(H, { "data-testid": m.head, children: /* @__PURE__ */ t(u, { noHover: !0, height: "32px", children: i.map((e) => {
|
|
56
|
+
const a = e.justify ?? "start", r = e.sort, y = r && s ? s.getSortDirection(r.field) : void 0;
|
|
57
|
+
return /* @__PURE__ */ t(
|
|
58
|
+
N,
|
|
60
59
|
{
|
|
61
|
-
justify:
|
|
60
|
+
justify: a,
|
|
62
61
|
size: "sm",
|
|
63
|
-
className:
|
|
62
|
+
className: c(
|
|
64
63
|
"min-w-0 whitespace-nowrap",
|
|
65
|
-
|
|
64
|
+
e.headClassName
|
|
66
65
|
),
|
|
67
|
-
children: r &&
|
|
68
|
-
|
|
66
|
+
children: r && s ? /* @__PURE__ */ t(
|
|
67
|
+
C,
|
|
69
68
|
{
|
|
70
|
-
arrowPosition:
|
|
71
|
-
title:
|
|
72
|
-
sortDirection:
|
|
69
|
+
arrowPosition: a === "end" ? "left" : "right",
|
|
70
|
+
title: e.title,
|
|
71
|
+
sortDirection: y,
|
|
73
72
|
sortField: r.label,
|
|
74
|
-
onSort: () =>
|
|
73
|
+
onSort: () => s.onSort(
|
|
75
74
|
r.field,
|
|
76
75
|
r.defaultDirection
|
|
77
76
|
)
|
|
78
77
|
}
|
|
79
|
-
) :
|
|
78
|
+
) : e.title
|
|
80
79
|
},
|
|
81
|
-
|
|
80
|
+
e.id
|
|
82
81
|
);
|
|
83
82
|
}) }) }),
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
|
|
83
|
+
/* @__PURE__ */ t(
|
|
84
|
+
f,
|
|
86
85
|
{
|
|
87
86
|
showGuard: o,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
height: h,
|
|
91
|
-
cellClassName: "min-w-0 px-1 py-2 first:pl-4 last:pr-4",
|
|
92
|
-
children: !o && /* @__PURE__ */ e(
|
|
93
|
-
x,
|
|
87
|
+
guard: o && /* @__PURE__ */ t(h, { children: Array.from({ length: l }, (e, a) => /* @__PURE__ */ t(
|
|
88
|
+
S,
|
|
94
89
|
{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
90
|
+
height: b,
|
|
91
|
+
columns: n ? 1 : i.length,
|
|
92
|
+
cellClassName: "min-w-0 px-1 py-2 first:pl-4 last:pr-4",
|
|
93
|
+
last: a === l - 1
|
|
94
|
+
},
|
|
95
|
+
`${a}-${l}`
|
|
96
|
+
)) }),
|
|
97
|
+
children: !o && /* @__PURE__ */ t(
|
|
98
|
+
f,
|
|
99
|
+
{
|
|
100
|
+
showGuard: p.count(d) === 0,
|
|
101
|
+
guard: /* @__PURE__ */ t(z, { message: g, testId: m.empty }),
|
|
102
|
+
children: p.count(d) > 0 && /* @__PURE__ */ t(h, { children: d })
|
|
98
103
|
}
|
|
99
104
|
)
|
|
100
105
|
}
|
|
@@ -104,7 +109,7 @@ function V({
|
|
|
104
109
|
);
|
|
105
110
|
}
|
|
106
111
|
export {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
112
|
+
Q as BaseTable,
|
|
113
|
+
V as BaseTableLineTest,
|
|
114
|
+
m as BaseTableTest
|
|
110
115
|
};
|
|
@@ -33,12 +33,12 @@ import "../simple-accordion/simple-accordion.js";
|
|
|
33
33
|
import "../tip-card/tip-card.js";
|
|
34
34
|
import "../typography/typography.js";
|
|
35
35
|
import "../help-tip/help-tip.js";
|
|
36
|
-
import "../points-icon/points-icon.js";
|
|
37
36
|
import "viem";
|
|
37
|
+
import "../points-icon/points-icon.js";
|
|
38
38
|
import "../vertical-indicator/vertical-indicator.js";
|
|
39
39
|
import "../base/page-title/page-title.js";
|
|
40
|
-
import "../detailed-page-title/detailed-page-title-copy-button.js";
|
|
41
40
|
import "../detailed-page-title/detailed-page-title-explorer-dropdown.js";
|
|
41
|
+
import "../base/detailed-page-title/copy-button.js";
|
|
42
42
|
import "../base/details-view/detail-aside/detail-aside-scope.js";
|
|
43
43
|
import "../layout/main-aside-layout/main-aside-layout.js";
|
|
44
44
|
import "../base/details-view/details-view.js";
|
|
@@ -52,16 +52,29 @@ import "../breakpoint-provider.js";
|
|
|
52
52
|
import "lightweight-charts";
|
|
53
53
|
import "../graph/formatters.js";
|
|
54
54
|
import "../graph/graph-view.js";
|
|
55
|
-
import "../base/info-portal/info-portal.js";
|
|
56
55
|
import "../edit-input/edit-input.js";
|
|
57
56
|
import "../slider/slider.js";
|
|
58
57
|
import "../slider/slider-context.js";
|
|
59
58
|
import "../text-button/text-button.js";
|
|
60
|
-
import "../with-title/with-title.js";
|
|
61
59
|
import "react-router-dom";
|
|
62
60
|
import "../status-elements/status-elements.js";
|
|
61
|
+
import "../base/manage-pane/manage-pane.js";
|
|
62
|
+
import "../base/tabber/tabber.js";
|
|
63
|
+
import "../link/link.js";
|
|
64
|
+
import "../rounded-image/rounded-image.js";
|
|
65
|
+
import "../base-link/base-link.js";
|
|
66
|
+
import "../base-table/base-table-line.js";
|
|
67
|
+
import "../navigation-context/navigation-context.js";
|
|
68
|
+
import "../cards/card/card.js";
|
|
69
|
+
import "../client-adapters/styled-button/styled-button.js";
|
|
63
70
|
import "../client-adapters/styled-dialog-container/styled-dialog-container.js";
|
|
71
|
+
import "../simple-dropdown/simple-dropdown.js";
|
|
72
|
+
import "../simple-dropdown/simple-dropdown-menu-item.js";
|
|
73
|
+
import "../composites/tx-preview/confirm/amounts/TransactionConfirmAmountField.js";
|
|
74
|
+
import "../composites/tx-preview/confirm/dialog/constants.js";
|
|
64
75
|
import "../modal/modal.js";
|
|
76
|
+
import "../spinner/spinner.js";
|
|
77
|
+
import "../spinner-loader/spinner-loader.js";
|
|
65
78
|
import "@radix-ui/react-dialog";
|
|
66
79
|
import "../dialog/dialog-container.js";
|
|
67
80
|
import "../dialog/dialog-content.js";
|
|
@@ -73,20 +86,6 @@ import "../dialog/dialog-modal-container.js";
|
|
|
73
86
|
import "../dialog/dialog-overlay.js";
|
|
74
87
|
import "../input/input.js";
|
|
75
88
|
import { Label as k } from "../label/label.js";
|
|
76
|
-
import "../simple-dropdown/simple-dropdown.js";
|
|
77
|
-
import "../simple-dropdown/simple-dropdown-menu-item.js";
|
|
78
|
-
import "../base/tabber/tabber.js";
|
|
79
|
-
import "../link/link.js";
|
|
80
|
-
import "../rounded-image/rounded-image.js";
|
|
81
|
-
import "../base-link/base-link.js";
|
|
82
|
-
import "../base-table/base-table-line.js";
|
|
83
|
-
import "../navigation-context/navigation-context.js";
|
|
84
|
-
import "../cards/card/card.js";
|
|
85
|
-
import "../client-adapters/styled-button/styled-button.js";
|
|
86
|
-
import "../composites/tx-preview/confirm/amounts/TransactionConfirmAmountField.js";
|
|
87
|
-
import "../composites/tx-preview/confirm/dialog/constants.js";
|
|
88
|
-
import "../spinner/spinner.js";
|
|
89
|
-
import "../spinner-loader/spinner-loader.js";
|
|
90
89
|
import "../dropdown-menu/dropdown-menu.js";
|
|
91
90
|
import "../dropdown-menu/dropdown-menu-content.js";
|
|
92
91
|
import "../dropdown-menu/dropdown-menu-item.js";
|
|
@@ -101,9 +100,7 @@ import "../layout/layout/layout.js";
|
|
|
101
100
|
import "../legal-agreement/legal-agreement-theme.js";
|
|
102
101
|
import "../loader/loader.js";
|
|
103
102
|
import "../loading/loading.js";
|
|
104
|
-
import "../loading-bar/loading-bar.js";
|
|
105
103
|
import "../radio-group/radio-group.js";
|
|
106
|
-
import "../status-dot/status-dot.js";
|
|
107
104
|
import "../search-line/search-line.js";
|
|
108
105
|
import "../segmented-control/segmented-control.js";
|
|
109
106
|
import "../separate-line/separate-line.js";
|
|
@@ -6,7 +6,6 @@ import "tailwind-merge";
|
|
|
6
6
|
import { formatMoney as C } from "../../../utils/format-money.js";
|
|
7
7
|
import "luxon";
|
|
8
8
|
import "../../../utils/z-index.js";
|
|
9
|
-
import "../../points-icon/points-icon.js";
|
|
10
9
|
import { UtilizationValue as S } from "../../base/values/scalars.js";
|
|
11
10
|
import "../../badge/badge.js";
|
|
12
11
|
import "../../badge/chip.js";
|
|
@@ -37,7 +36,7 @@ function V(i, t) {
|
|
|
37
36
|
function B(i, t) {
|
|
38
37
|
return t <= 0n || i <= 0n ? 0 : Number(i * 10000n / t) / 1e4;
|
|
39
38
|
}
|
|
40
|
-
function
|
|
39
|
+
function ue({
|
|
41
40
|
asset: i,
|
|
42
41
|
underlyingToken: t,
|
|
43
42
|
last: T,
|
|
@@ -143,5 +142,5 @@ function he({
|
|
|
143
142
|
);
|
|
144
143
|
}
|
|
145
144
|
export {
|
|
146
|
-
|
|
145
|
+
ue as PoolAssetsTableRow
|
|
147
146
|
};
|
|
@@ -8,7 +8,6 @@ import { cn as A } from "../../utils/cn.js";
|
|
|
8
8
|
import { formatCompactPercent as O } from "../../utils/format-money.js";
|
|
9
9
|
import "luxon";
|
|
10
10
|
import "../../utils/z-index.js";
|
|
11
|
-
import "../points-icon/points-icon.js";
|
|
12
11
|
import "viem";
|
|
13
12
|
import "../tooltip/simple-tooltip.js";
|
|
14
13
|
import "../tooltip/tooltip.js";
|
|
@@ -70,7 +69,7 @@ function N() {
|
|
|
70
69
|
function p(t) {
|
|
71
70
|
return t == null ? !1 : I(t).length > 0 || k(t).length > 0;
|
|
72
71
|
}
|
|
73
|
-
function
|
|
72
|
+
function L({
|
|
74
73
|
apy: t,
|
|
75
74
|
maxLeverage: m,
|
|
76
75
|
collateralApy: e,
|
|
@@ -105,5 +104,5 @@ function R({
|
|
|
105
104
|
) : s();
|
|
106
105
|
}
|
|
107
106
|
export {
|
|
108
|
-
|
|
107
|
+
L as CompoundAPY
|
|
109
108
|
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DetailedPageTitleExplorerDropdown as l } from "./detailed-page-title-explorer-dropdown.js";
|
|
1
|
+
import { DetailedPageTitleExplorerDropdown as r } from "./detailed-page-title-explorer-dropdown.js";
|
|
3
2
|
export {
|
|
4
|
-
|
|
5
|
-
l as DetailedPageTitleExplorerDropdown
|
|
3
|
+
r as DetailedPageTitleExplorerDropdown
|
|
6
4
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { TickMarkType as
|
|
2
|
-
import { DateTime as
|
|
3
|
-
import { isBelowDisplayThreshold as H, FORMAT_CONSTANTS as
|
|
4
|
-
const { MIN_DISPLAY_THRESHOLD: k
|
|
1
|
+
import { TickMarkType as F } from "lightweight-charts";
|
|
2
|
+
import { DateTime as S } from "luxon";
|
|
3
|
+
import { isBelowDisplayThreshold as H, FORMAT_CONSTANTS as L, toSignificantDigits as E } from "../../utils/format-number.js";
|
|
4
|
+
const { MIN_DISPLAY_THRESHOLD: k } = L, R = 2, U = (t, e) => {
|
|
5
5
|
if (H(t))
|
|
6
6
|
return e ? `<${k}${e}` : `<${k}`;
|
|
7
7
|
if (t === 0)
|
|
8
8
|
return e ? `0${e}` : "0";
|
|
9
|
-
const s =
|
|
9
|
+
const s = E(t, R);
|
|
10
10
|
return e ? `${s}${e}` : s;
|
|
11
11
|
};
|
|
12
|
-
function
|
|
12
|
+
function B(t, e, s = 4) {
|
|
13
13
|
if (t === 0)
|
|
14
14
|
return e ? `0 ${e}` : "0";
|
|
15
15
|
const n = e && Math.abs(t) >= 1e3 ? 0 : s, f = t.toLocaleString("en-US", {
|
|
@@ -21,13 +21,13 @@ function G(t, e, s = 4) {
|
|
|
21
21
|
function D(t, e) {
|
|
22
22
|
return !t || e === "none" || e === "token" ? t : e === "$" ? `$${t}` : e === "%" ? `${t}%` : `${t} ${e}`;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function _(t) {
|
|
25
25
|
return t.includes("/");
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return
|
|
27
|
+
function $(t) {
|
|
28
|
+
return _(t) ? "none" : t;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function G(t, e, s) {
|
|
31
31
|
const n = s?.yScaleMin;
|
|
32
32
|
let f = t.length > 0 ? Math.min(...t) : 0, m = t.length > 0 ? Math.max(...t) : 0;
|
|
33
33
|
const a = () => {
|
|
@@ -43,28 +43,28 @@ function W(t, e, s) {
|
|
|
43
43
|
useGrouping: !1
|
|
44
44
|
});
|
|
45
45
|
return o > 1 ? `${c}${i}` : c;
|
|
46
|
-
},
|
|
46
|
+
}, N = (r, o, i) => {
|
|
47
47
|
for (let d = 0; d <= u; d++) {
|
|
48
48
|
const M = /* @__PURE__ */ new Set();
|
|
49
49
|
let c = !0;
|
|
50
|
-
for (const
|
|
51
|
-
const
|
|
52
|
-
if (M.has(
|
|
50
|
+
for (const l of r) {
|
|
51
|
+
const T = g(l, o, i, d);
|
|
52
|
+
if (M.has(T)) {
|
|
53
53
|
c = !1;
|
|
54
54
|
break;
|
|
55
55
|
}
|
|
56
|
-
M.add(
|
|
56
|
+
M.add(T);
|
|
57
57
|
}
|
|
58
58
|
if (c) return d;
|
|
59
59
|
}
|
|
60
60
|
return u;
|
|
61
61
|
}, A = (r) => {
|
|
62
62
|
if (n !== void 0 && r < n) return "";
|
|
63
|
-
if (r === 0) return D("0",
|
|
63
|
+
if (r === 0) return D("0", $(e));
|
|
64
64
|
const { scale: o, suffix: i } = a();
|
|
65
65
|
return D(
|
|
66
66
|
g(r, o, i, h),
|
|
67
|
-
|
|
67
|
+
$(e)
|
|
68
68
|
);
|
|
69
69
|
};
|
|
70
70
|
return {
|
|
@@ -73,12 +73,12 @@ function W(t, e, s) {
|
|
|
73
73
|
const { scale: o, suffix: i } = a(), d = r.filter(
|
|
74
74
|
(c) => c !== 0 && !(n !== void 0 && c < n)
|
|
75
75
|
);
|
|
76
|
-
h =
|
|
76
|
+
h = N(d, o, i);
|
|
77
77
|
const M = /* @__PURE__ */ new Set();
|
|
78
78
|
return r.map((c) => {
|
|
79
79
|
if (n !== void 0 && c < n) return "";
|
|
80
|
-
const
|
|
81
|
-
return !
|
|
80
|
+
const l = c === 0 ? "0" : g(c, o, i, h);
|
|
81
|
+
return !l || M.has(l) ? "" : (M.add(l), D(l, $(e)));
|
|
82
82
|
});
|
|
83
83
|
},
|
|
84
84
|
updateVisibleRange: (r) => {
|
|
@@ -86,31 +86,31 @@ function W(t, e, s) {
|
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
const
|
|
90
|
-
time:
|
|
89
|
+
const y = (t) => S.fromSeconds(Number(t)).toFormat("dd/LL/yyyy HH:mm"), w = (t) => S.fromSeconds(Number(t)).toFormat("HH:mm"), P = (t, e) => U(Number(t), e), x = {
|
|
90
|
+
time: y,
|
|
91
91
|
"%": P
|
|
92
92
|
};
|
|
93
|
-
function
|
|
93
|
+
function X(t) {
|
|
94
94
|
const e = /* @__PURE__ */ new Map();
|
|
95
95
|
return (s, n, f) => {
|
|
96
|
-
const m =
|
|
96
|
+
const m = S.fromSeconds(Number(s));
|
|
97
97
|
let a;
|
|
98
98
|
if (t === 0)
|
|
99
99
|
a = m.toFormat("HH:mm");
|
|
100
100
|
else
|
|
101
101
|
switch (n) {
|
|
102
|
-
case
|
|
102
|
+
case F.Year:
|
|
103
103
|
a = m.toFormat("yyyy");
|
|
104
104
|
break;
|
|
105
105
|
// Month boundaries (1st of a month) are reported as `Month` ticks by
|
|
106
106
|
// lightweight-charts. Render them the same way as regular day ticks so
|
|
107
107
|
// the axis reads uniformly ("01 Jul") instead of a stray "Jul 2026".
|
|
108
|
-
case
|
|
109
|
-
case
|
|
108
|
+
case F.Month:
|
|
109
|
+
case F.DayOfMonth:
|
|
110
110
|
a = t > 365 ? m.toFormat("dd MMM yyyy") : m.toFormat("dd MMM");
|
|
111
111
|
break;
|
|
112
|
-
case
|
|
113
|
-
case
|
|
112
|
+
case F.Time:
|
|
113
|
+
case F.TimeWithSeconds:
|
|
114
114
|
a = m.toFormat("HH:mm");
|
|
115
115
|
break;
|
|
116
116
|
default:
|
|
@@ -120,14 +120,14 @@ function U(t) {
|
|
|
120
120
|
return u || (u = /* @__PURE__ */ new Set(), e.set(n, u)), u.has(a) ? " " : (u.add(a), a);
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
|
-
const
|
|
123
|
+
const O = (t, e) => {
|
|
124
124
|
if (t === "time" && e && e.length > 0) {
|
|
125
|
-
const n =
|
|
125
|
+
const n = S.fromSeconds(Number(e[0].time)), f = S.fromSeconds(
|
|
126
126
|
Number(e[e.length - 1].time)
|
|
127
127
|
), m = n.hasSame(f, "day"), a = m ? 0 : Math.ceil(f.diff(n, "days").days);
|
|
128
128
|
return {
|
|
129
|
-
timeFormatter: m ?
|
|
130
|
-
tickMarkFormatter:
|
|
129
|
+
timeFormatter: m ? w : y,
|
|
130
|
+
tickMarkFormatter: X(a)
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
133
|
const s = x[t] || x.time;
|
|
@@ -135,12 +135,12 @@ const w = (t, e) => {
|
|
|
135
135
|
timeFormatter: s,
|
|
136
136
|
tickMarkFormatter: (n) => s(n, t)
|
|
137
137
|
};
|
|
138
|
-
},
|
|
138
|
+
}, W = (t, e) => O(t, e).timeFormatter;
|
|
139
139
|
export {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
140
|
+
G as createAdaptiveYAxisFormatter,
|
|
141
|
+
B as formatExactValue,
|
|
142
|
+
W as getXFormatter,
|
|
143
|
+
O as getXFormatters,
|
|
144
|
+
_ as isRatioUnit,
|
|
145
145
|
D as withYAxisUnit
|
|
146
146
|
};
|