@gearbox-protocol/ui-kit 4.0.0-next.4 → 4.0.0-next.6
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/assets-list-cell/assets-list-cell.cjs +1 -1
- package/dist/cjs/components/badge/badge.cjs +1 -1
- package/dist/cjs/components/badge/chip.cjs +1 -0
- package/dist/cjs/components/badge/index.cjs +1 -1
- package/dist/cjs/components/base/borrow-rate-block/borrow-rate-block.cjs +1 -1
- package/dist/cjs/components/base/chart-with-side-card/chart-with-side-card.cjs +1 -1
- package/dist/cjs/components/base/history-chart/history-chart.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/leverage-preset-chips/constants.cjs +1 -0
- package/dist/cjs/components/base/leverage-preset-chips/index.cjs +1 -0
- package/dist/cjs/components/base/leverage-preset-chips/leverage-preset-chips.cjs +1 -0
- package/dist/cjs/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/components/base/strategy-apy-breakdown-card/constants.cjs +1 -1
- package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/components/base/title-meta/constants.cjs +1 -1
- package/dist/cjs/components/base/title-meta/title-meta.cjs +1 -1
- package/dist/cjs/components/base/values/index.cjs +1 -1
- package/dist/cjs/components/base/values/position-status-badge.cjs +1 -0
- package/dist/cjs/components/base/values/position-type-badge.cjs +1 -1
- package/dist/cjs/components/base-table/base-table-line.cjs +1 -0
- package/dist/cjs/components/base-table/base-table.cjs +1 -0
- package/dist/cjs/components/base-table/constants.cjs +1 -0
- package/dist/cjs/components/base-table/index.cjs +1 -0
- package/dist/cjs/components/base-table/types.cjs +1 -0
- package/dist/cjs/components/block-sync-pill/block-sync-pill.cjs +1 -1
- package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
- package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
- package/dist/cjs/components/collateral-allocation-tooltip/allocation-wheel.cjs +1 -0
- package/dist/cjs/components/collateral-allocation-tooltip/collateral-allocation-tooltip.cjs +1 -0
- package/dist/cjs/components/collateral-allocation-tooltip/constants.cjs +1 -0
- package/dist/cjs/components/collateral-allocation-tooltip/index.cjs +1 -0
- package/dist/cjs/components/composites/index.cjs +1 -1
- package/dist/cjs/components/composites/pool-assets-table/constants.cjs +1 -0
- package/dist/cjs/components/composites/pool-assets-table/index.cjs +1 -1
- package/dist/cjs/components/composites/pool-assets-table/pool-assets-table-head.cjs +1 -1
- package/dist/cjs/components/composites/pool-assets-table/pool-assets-table-row.cjs +1 -1
- package/dist/cjs/components/composites/pool-assets-table/pool-assets-table.cjs +1 -1
- package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.cjs +1 -1
- package/dist/cjs/components/composites/tx-preview/confirm/dialog/index.cjs +1 -1
- package/dist/cjs/components/composites/tx-preview/confirm/dialog/transactionConfirmShellTypes.cjs +1 -0
- package/dist/cjs/components/composites/tx-preview/confirm/index.cjs +1 -1
- package/dist/cjs/components/composites/tx-preview/index.cjs +1 -1
- package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
- package/dist/cjs/components/filter/filter-chip.cjs +1 -1
- package/dist/cjs/components/graph/default-config.cjs +1 -1
- package/dist/cjs/components/graph/graph-view.cjs +1 -1
- package/dist/cjs/components/graph/graph.cjs +1 -1
- package/dist/cjs/components/hf-indicator/hf-indicator.cjs +1 -0
- package/dist/cjs/components/hf-indicator/index.cjs +1 -0
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/infinite-scroll/index.cjs +1 -0
- package/dist/cjs/components/infinite-scroll/infinite-scroll-wrapper.cjs +1 -0
- package/dist/cjs/components/name-cell/index.cjs +1 -0
- package/dist/cjs/components/name-cell/name-cell.cjs +1 -0
- package/dist/cjs/components/network-icon/index.cjs +1 -1
- package/dist/cjs/components/network-icon/network-indicator.cjs +1 -0
- package/dist/cjs/components/trading-view/trading-view.cjs +1 -1
- package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
- package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown-tooltip.cjs +1 -1
- package/dist/cjs/configs/tailwind-preset.cjs +1 -1
- package/dist/cjs/hooks/index.cjs +1 -1
- package/dist/cjs/hooks/use-observed-width-key.cjs +1 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/locale/en.json.cjs +1 -1
- package/dist/cjs/utils/format-money.cjs +1 -1
- package/dist/cjs/utils/index.cjs +1 -1
- package/dist/cjs/utils/leverage-presets.cjs +1 -0
- package/dist/esm/components/assets-list-cell/assets-list-cell.js +161 -159
- package/dist/esm/components/badge/badge.js +14 -8
- package/dist/esm/components/badge/chip.js +47 -0
- package/dist/esm/components/badge/index.js +8 -3
- package/dist/esm/components/base/borrow-rate-block/borrow-rate-block.js +3 -2
- package/dist/esm/components/base/chart-with-side-card/chart-with-side-card.js +6 -6
- package/dist/esm/components/base/history-chart/history-chart.js +86 -46
- package/dist/esm/components/base/index.js +144 -138
- package/dist/esm/components/base/info-list/info-list.js +7 -8
- package/dist/esm/components/base/leverage-input/leverage-input.js +1 -1
- package/dist/esm/components/base/leverage-preset-chips/constants.js +7 -0
- package/dist/esm/components/base/leverage-preset-chips/index.js +6 -0
- package/dist/esm/components/base/leverage-preset-chips/leverage-preset-chips.js +39 -0
- package/dist/esm/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.js +23 -30
- package/dist/esm/components/base/strategy-apy-breakdown-card/constants.js +3 -2
- package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +194 -32
- package/dist/esm/components/base/title-meta/constants.js +1 -0
- package/dist/esm/components/base/title-meta/title-meta.js +53 -33
- package/dist/esm/components/base/values/index.js +16 -14
- package/dist/esm/components/base/values/position-status-badge.js +26 -0
- package/dist/esm/components/base/values/position-type-badge.js +7 -6
- package/dist/esm/components/base-table/base-table-line.js +117 -0
- package/dist/esm/components/base-table/base-table.js +110 -0
- package/dist/esm/components/base-table/constants.js +12 -0
- package/dist/esm/components/base-table/index.js +9 -0
- package/dist/esm/components/base-table/types.js +1 -0
- package/dist/esm/components/block-sync-pill/block-sync-pill.js +9 -6
- package/dist/esm/components/checkbox/checkbox-labeled.js +7 -4
- package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +7 -4
- package/dist/esm/components/collateral-allocation-tooltip/allocation-wheel.js +71 -0
- package/dist/esm/components/collateral-allocation-tooltip/collateral-allocation-tooltip.js +102 -0
- package/dist/esm/components/collateral-allocation-tooltip/constants.js +12 -0
- package/dist/esm/components/collateral-allocation-tooltip/index.js +9 -0
- package/dist/esm/components/composites/index.js +31 -31
- package/dist/esm/components/composites/pool-assets-table/constants.js +9 -0
- package/dist/esm/components/composites/pool-assets-table/index.js +8 -6
- package/dist/esm/components/composites/pool-assets-table/pool-assets-table-head.js +52 -30
- package/dist/esm/components/composites/pool-assets-table/pool-assets-table-row.js +108 -76
- package/dist/esm/components/composites/pool-assets-table/pool-assets-table.js +44 -26
- package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.js +109 -52
- package/dist/esm/components/composites/tx-preview/confirm/dialog/index.js +8 -10
- package/dist/esm/components/composites/tx-preview/confirm/dialog/transactionConfirmShellTypes.js +1 -0
- package/dist/esm/components/composites/tx-preview/confirm/index.js +24 -26
- package/dist/esm/components/composites/tx-preview/index.js +24 -26
- package/dist/esm/components/compound-apy/compound-apy.js +85 -80
- package/dist/esm/components/filter/filter-chip.js +1 -0
- package/dist/esm/components/graph/default-config.js +20 -18
- package/dist/esm/components/graph/graph-view.js +32 -31
- package/dist/esm/components/graph/graph.js +459 -458
- package/dist/esm/components/hf-indicator/hf-indicator.js +33 -0
- package/dist/esm/components/hf-indicator/index.js +4 -0
- package/dist/esm/components/index.js +732 -701
- package/dist/esm/components/infinite-scroll/index.js +4 -0
- package/dist/esm/components/infinite-scroll/infinite-scroll-wrapper.js +30 -0
- package/dist/esm/components/name-cell/index.js +4 -0
- package/dist/esm/components/name-cell/name-cell.js +35 -0
- package/dist/esm/components/network-icon/index.js +4 -2
- package/dist/esm/components/network-icon/network-indicator.js +82 -0
- package/dist/esm/components/trading-view/trading-view.js +193 -155
- package/dist/esm/components/with-copy/with-copy.js +7 -4
- package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +112 -169
- package/dist/esm/configs/tailwind-preset.js +13 -1
- package/dist/esm/hooks/index.js +20 -18
- package/dist/esm/hooks/use-observed-width-key.js +24 -0
- package/dist/esm/index.js +881 -842
- package/dist/esm/locale/en.json.js +21 -18
- package/dist/esm/utils/format-money.js +59 -41
- package/dist/esm/utils/index.js +87 -83
- package/dist/esm/utils/leverage-presets.js +13 -0
- package/dist/globals.css +1 -1
- package/dist/types/components/assets-list-cell/assets-list-cell.d.ts +3 -0
- package/dist/types/components/badge/badge.d.ts +2 -1
- package/dist/types/components/badge/chip.d.ts +22 -0
- package/dist/types/components/badge/index.d.ts +1 -0
- package/dist/types/components/base/history-chart/history-chart.d.ts +13 -3
- package/dist/types/components/base/index.d.ts +1 -0
- package/dist/types/components/base/leverage-input/leverage-input.d.ts +1 -1
- package/dist/types/components/base/leverage-preset-chips/constants.d.ts +4 -0
- package/dist/types/components/base/leverage-preset-chips/index.d.ts +2 -0
- package/dist/types/components/base/leverage-preset-chips/leverage-preset-chips.d.ts +13 -0
- package/dist/types/components/base/liquidation-params-table/liquidation-params-table.d.ts +2 -2
- package/dist/types/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.d.ts +4 -5
- package/dist/types/components/base/strategy-apy-breakdown-card/constants.d.ts +1 -0
- package/dist/types/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.d.ts +12 -4
- package/dist/types/components/base/title-meta/constants.d.ts +1 -0
- package/dist/types/components/base/title-meta/title-meta.d.ts +9 -1
- package/dist/types/components/base/values/index.d.ts +1 -0
- package/dist/types/components/base/values/position-status-badge.d.ts +7 -0
- package/dist/types/components/base/values/position-type-badge.d.ts +1 -1
- package/dist/types/components/base-table/base-table-line.d.ts +21 -0
- package/dist/types/components/base-table/base-table.d.ts +19 -0
- package/dist/types/components/base-table/constants.d.ts +8 -0
- package/dist/types/components/base-table/index.d.ts +3 -0
- package/dist/types/components/base-table/types.d.ts +37 -0
- package/dist/types/components/collateral-allocation-tooltip/allocation-wheel.d.ts +10 -0
- package/dist/types/components/collateral-allocation-tooltip/collateral-allocation-tooltip.d.ts +23 -0
- package/dist/types/components/collateral-allocation-tooltip/constants.d.ts +8 -0
- package/dist/types/components/collateral-allocation-tooltip/index.d.ts +3 -0
- package/dist/types/components/composites/pool-assets-table/constants.d.ts +6 -0
- package/dist/types/components/composites/pool-assets-table/index.d.ts +1 -0
- package/dist/types/components/composites/pool-assets-table/pool-assets-table-head.d.ts +1 -2
- package/dist/types/components/composites/pool-assets-table/pool-assets-table-row.d.ts +8 -8
- package/dist/types/components/composites/pool-assets-table/pool-assets-table.d.ts +7 -20
- package/dist/types/components/composites/pool-assets-table/types.d.ts +4 -12
- package/dist/types/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.d.ts +23 -19
- package/dist/types/components/composites/tx-preview/confirm/dialog/index.d.ts +2 -2
- package/dist/types/components/composites/tx-preview/confirm/dialog/transactionConfirmPhase.d.ts +0 -3
- package/dist/types/components/composites/tx-preview/confirm/dialog/transactionConfirmShellTypes.d.ts +97 -0
- package/dist/types/components/graph/graph-view.d.ts +1 -1
- package/dist/types/components/graph/graph.d.ts +4 -0
- package/dist/types/components/hf-indicator/hf-indicator.d.ts +8 -0
- package/dist/types/components/hf-indicator/index.d.ts +1 -0
- package/dist/types/components/index.d.ts +5 -0
- package/dist/types/components/infinite-scroll/index.d.ts +1 -0
- package/dist/types/components/infinite-scroll/infinite-scroll-wrapper.d.ts +11 -0
- package/dist/types/components/name-cell/index.d.ts +1 -0
- package/dist/types/components/name-cell/name-cell.d.ts +13 -0
- package/dist/types/components/network-icon/index.d.ts +1 -0
- package/dist/types/components/network-icon/network-indicator.d.ts +23 -0
- package/dist/types/components/trading-view/trading-view.d.ts +10 -3
- package/dist/types/components/yield-breakdown-tooltip/yield-breakdown-tooltip.d.ts +6 -8
- package/dist/types/configs/tailwind-preset.d.ts +12 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/use-observed-width-key.d.ts +8 -0
- package/dist/types/index.d.ts +6 -1
- package/dist/types/locale/en.json.d.ts +23 -18
- package/dist/types/utils/format-money.d.ts +11 -5
- package/dist/types/utils/index.d.ts +2 -1
- package/dist/types/utils/leverage-presets.d.ts +7 -0
- package/package.json +1 -1
- package/src/styles/base.css +30 -0
- package/src/styles/theme.css +16 -0
- package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmModalView.cjs +0 -1
- package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmPageView.cjs +0 -1
- package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmModalView.js +0 -177
- package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmPageView.js +0 -54
- package/dist/types/components/composites/tx-preview/confirm/dialog/TransactionConfirmModalView.d.ts +0 -17
- package/dist/types/components/composites/tx-preview/confirm/dialog/TransactionConfirmPageView.d.ts +0 -16
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsxs as r, Fragment as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { DialogContainer as l } from "../dialog/dialog-container.js";
|
|
3
|
+
import { FormattedMessageTyped as p } from "../typed-intl/index.js";
|
|
4
|
+
import { Typography as s } from "../typography/typography.js";
|
|
5
|
+
import { VSpace as m } from "../vspace/vspace.js";
|
|
6
|
+
function g({
|
|
7
|
+
hasMore: o,
|
|
8
|
+
dataLength: t,
|
|
9
|
+
children: i,
|
|
10
|
+
onNextLoad: n
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ r("div", { className: "w-full", children: [
|
|
13
|
+
i,
|
|
14
|
+
o && t > 0 && /* @__PURE__ */ r(a, { children: [
|
|
15
|
+
/* @__PURE__ */ e(m, { size: "md" }),
|
|
16
|
+
/* @__PURE__ */ e(l, { padding: !1, children: /* @__PURE__ */ e(
|
|
17
|
+
"button",
|
|
18
|
+
{
|
|
19
|
+
type: "button",
|
|
20
|
+
onClick: n,
|
|
21
|
+
className: "flex w-full cursor-pointer items-center justify-center gap-2 p-3.5 hover:text-white",
|
|
22
|
+
children: /* @__PURE__ */ e(s, { as: "span", variant: "bodySmall", color: "secondary", children: /* @__PURE__ */ e(p, { messageId: "components.infiniteScrollWrapper.showMore" }) })
|
|
23
|
+
}
|
|
24
|
+
) })
|
|
25
|
+
] })
|
|
26
|
+
] });
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
g as InfiniteScrollWrapper
|
|
30
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Typography as l } from "../typography/typography.js";
|
|
3
|
+
function f({
|
|
4
|
+
title: c,
|
|
5
|
+
subtitle: r,
|
|
6
|
+
chips: o,
|
|
7
|
+
caption: s,
|
|
8
|
+
leading: n,
|
|
9
|
+
disabledStyle: t = !1
|
|
10
|
+
}) {
|
|
11
|
+
const i = /* @__PURE__ */ a("div", { className: "flex min-w-0 flex-col items-start justify-center gap-0.5", children: [
|
|
12
|
+
/* @__PURE__ */ a("div", { className: "flex min-w-0 w-full items-start gap-x-2", children: [
|
|
13
|
+
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 break-words [overflow-wrap:anywhere]", children: c }),
|
|
14
|
+
o
|
|
15
|
+
] }),
|
|
16
|
+
r && /* @__PURE__ */ e(
|
|
17
|
+
l,
|
|
18
|
+
{
|
|
19
|
+
variant: "caption",
|
|
20
|
+
color: "secondary",
|
|
21
|
+
as: "span",
|
|
22
|
+
className: "block min-w-0 text-xs",
|
|
23
|
+
children: r
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
t && s && /* @__PURE__ */ e(l, { as: "span", variant: "caption", className: "leading-none", children: s })
|
|
27
|
+
] });
|
|
28
|
+
return n ? /* @__PURE__ */ a("div", { className: "grid min-w-0 grid-cols-[auto_1fr] gap-x-3", children: [
|
|
29
|
+
n,
|
|
30
|
+
i
|
|
31
|
+
] }) : i;
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
f as NameCell
|
|
35
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { faChevronDown as h } from "@fortawesome/free-solid-svg-icons";
|
|
3
|
+
import { forwardRef as b } from "react";
|
|
4
|
+
import "../buttons/back-button/back-button.js";
|
|
5
|
+
import { Button as y } from "../buttons/button/button.js";
|
|
6
|
+
import "../buttons/copy-button/copy-button.js";
|
|
7
|
+
import "../buttons/external-button/external-button.js";
|
|
8
|
+
import "../buttons/filter-button/filter-button.js";
|
|
9
|
+
import "../buttons/navigation-button/navigation-button.js";
|
|
10
|
+
import "@gearbox-protocol/sdk";
|
|
11
|
+
import { cn as a } from "../../utils/cn.js";
|
|
12
|
+
import "sonner";
|
|
13
|
+
import "@gearbox-protocol/sdk/common-utils";
|
|
14
|
+
import "luxon";
|
|
15
|
+
import "../../utils/z-index.js";
|
|
16
|
+
import "../buttons/tab-button/tab-button.js";
|
|
17
|
+
import { FaIcon as u } from "../icons/fa-icon.js";
|
|
18
|
+
import { FormattedMessageTyped as I } from "../typed-intl/index.js";
|
|
19
|
+
import { Typography as w } from "../typography/typography.js";
|
|
20
|
+
import { NetworkIcon as v } from "./network-icon.js";
|
|
21
|
+
const x = {
|
|
22
|
+
sm: "sm",
|
|
23
|
+
md: "default",
|
|
24
|
+
default: "default",
|
|
25
|
+
lg: "lg"
|
|
26
|
+
}, N = b(
|
|
27
|
+
({
|
|
28
|
+
network: m,
|
|
29
|
+
chainId: k,
|
|
30
|
+
size: d = "md",
|
|
31
|
+
iconSize: n = 20,
|
|
32
|
+
chevronSize: o = 12,
|
|
33
|
+
showTitle: s = !0,
|
|
34
|
+
opened: p,
|
|
35
|
+
onClick: t,
|
|
36
|
+
interactive: l,
|
|
37
|
+
className: c,
|
|
38
|
+
...f
|
|
39
|
+
}, g) => {
|
|
40
|
+
const e = l ?? !!t;
|
|
41
|
+
return /* @__PURE__ */ r(
|
|
42
|
+
y,
|
|
43
|
+
{
|
|
44
|
+
ref: g,
|
|
45
|
+
variant: "outline",
|
|
46
|
+
size: x[d],
|
|
47
|
+
disabled: !e,
|
|
48
|
+
onClick: t,
|
|
49
|
+
className: a(
|
|
50
|
+
c,
|
|
51
|
+
"min-w-fit",
|
|
52
|
+
"h-10 rounded-[20px]",
|
|
53
|
+
"hover:bg-transparent hover:border hover:border-gray-60",
|
|
54
|
+
"disabled:text-primary-foreground disabled:bg-transparent disabled:border disabled:border-gray-40"
|
|
55
|
+
),
|
|
56
|
+
...f,
|
|
57
|
+
children: /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
58
|
+
s && /* @__PURE__ */ i(w, { as: "span", variant: "bodySmall", color: "secondary", children: [
|
|
59
|
+
/* @__PURE__ */ r(I, { messageId: "components.networkIndicator.title" }),
|
|
60
|
+
":"
|
|
61
|
+
] }),
|
|
62
|
+
/* @__PURE__ */ r(v, { network: m, size: n }),
|
|
63
|
+
e && /* @__PURE__ */ r(
|
|
64
|
+
u,
|
|
65
|
+
{
|
|
66
|
+
icon: h,
|
|
67
|
+
className: a(
|
|
68
|
+
"text-secondary-foreground transition-transform",
|
|
69
|
+
p && "rotate-180"
|
|
70
|
+
),
|
|
71
|
+
style: { width: o, height: o }
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
] })
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
N.displayName = "NetworkIndicator";
|
|
80
|
+
export {
|
|
81
|
+
N as NetworkIndicator
|
|
82
|
+
};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { toast as
|
|
4
|
-
import {
|
|
1
|
+
import { jsxs as p, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as I, useCallback as fe, useRef as C } from "react";
|
|
3
|
+
import { toast as be } from "sonner";
|
|
4
|
+
import { SectionHeading as we } from "../base/section-heading/section-heading.js";
|
|
5
|
+
import { useIsMobile as he } from "../../hooks/use-media-query.js";
|
|
5
6
|
import "@gearbox-protocol/sdk";
|
|
6
|
-
import { cn as
|
|
7
|
+
import { cn as pe } from "../../utils/cn.js";
|
|
7
8
|
import "@gearbox-protocol/sdk/common-utils";
|
|
8
9
|
import "luxon";
|
|
9
10
|
import "../../utils/z-index.js";
|
|
10
|
-
import {
|
|
11
|
-
import { DEFAULT_SERIES_COLORS as j, getSeriesColorPalette as ae, GraphLegend as we } from "../graph/graph.js";
|
|
11
|
+
import { DEFAULT_SERIES_COLORS as T, getSeriesColorPalette as ve, GraphLegend as ge } from "../graph/graph.js";
|
|
12
12
|
import { GraphViewWithData as xe } from "../graph/graph-view.js";
|
|
13
|
-
import {
|
|
14
|
-
|
|
13
|
+
import { Select as Se, SelectTrigger as ye, SelectValue as Ae, SelectContent as Ie, SelectItem as Ce } from "../select/select.js";
|
|
14
|
+
import { GraphDropdown as Ne } from "./graph-dropdown.js";
|
|
15
|
+
const Me = ({ size: e = 16 }) => /* @__PURE__ */ p(
|
|
15
16
|
"svg",
|
|
16
17
|
{
|
|
17
18
|
width: e,
|
|
@@ -24,11 +25,11 @@ const pe = ({ size: e = 16 }) => /* @__PURE__ */ h(
|
|
|
24
25
|
strokeLinejoin: "round",
|
|
25
26
|
"aria-label": "Expand fullscreen",
|
|
26
27
|
children: [
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */
|
|
28
|
+
/* @__PURE__ */ n("title", { children: "Expand fullscreen" }),
|
|
29
|
+
/* @__PURE__ */ n("path", { d: "M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3" })
|
|
29
30
|
]
|
|
30
31
|
}
|
|
31
|
-
),
|
|
32
|
+
), ke = ({ size: e = 16 }) => /* @__PURE__ */ p(
|
|
32
33
|
"svg",
|
|
33
34
|
{
|
|
34
35
|
width: e,
|
|
@@ -41,132 +42,138 @@ const pe = ({ size: e = 16 }) => /* @__PURE__ */ h(
|
|
|
41
42
|
strokeLinejoin: "round",
|
|
42
43
|
"aria-label": "Exit fullscreen",
|
|
43
44
|
children: [
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
45
|
+
/* @__PURE__ */ n("title", { children: "Exit fullscreen" }),
|
|
46
|
+
/* @__PURE__ */ n("path", { d: "M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3" })
|
|
46
47
|
]
|
|
47
48
|
}
|
|
48
|
-
),
|
|
49
|
-
|
|
49
|
+
), Ee = {
|
|
50
|
+
timeScale: { borderVisible: !1 },
|
|
51
|
+
rightPriceScale: { borderVisible: !1 },
|
|
52
|
+
leftPriceScale: { borderVisible: !1 }
|
|
53
|
+
}, X = "ui-kit:tradingview-series-colors:";
|
|
54
|
+
function j(e) {
|
|
50
55
|
if (typeof window > "u" || !window.localStorage)
|
|
51
56
|
return /* @__PURE__ */ new Map();
|
|
52
57
|
try {
|
|
53
|
-
const
|
|
54
|
-
if (!
|
|
55
|
-
const c = JSON.parse(
|
|
58
|
+
const r = window.localStorage.getItem(X + e);
|
|
59
|
+
if (!r) return /* @__PURE__ */ new Map();
|
|
60
|
+
const c = JSON.parse(r);
|
|
56
61
|
return c == null || typeof c != "object" ? /* @__PURE__ */ new Map() : new Map(
|
|
57
62
|
Object.entries(c).filter(
|
|
58
|
-
([,
|
|
63
|
+
([, o]) => typeof o == "number" && o >= 0 && o < T.length
|
|
59
64
|
)
|
|
60
65
|
);
|
|
61
66
|
} catch {
|
|
62
67
|
return /* @__PURE__ */ new Map();
|
|
63
68
|
}
|
|
64
69
|
}
|
|
65
|
-
function
|
|
70
|
+
function Re(e, r) {
|
|
66
71
|
if (!(typeof window > "u" || !window.localStorage))
|
|
67
72
|
try {
|
|
68
73
|
window.localStorage.setItem(
|
|
69
|
-
|
|
70
|
-
JSON.stringify(Object.fromEntries(
|
|
74
|
+
X + e,
|
|
75
|
+
JSON.stringify(Object.fromEntries(r))
|
|
71
76
|
);
|
|
72
77
|
} catch {
|
|
73
78
|
}
|
|
74
79
|
}
|
|
75
|
-
function
|
|
76
|
-
if (
|
|
77
|
-
const c =
|
|
78
|
-
for (const [
|
|
79
|
-
c.set(
|
|
80
|
-
|
|
80
|
+
function $(e, r) {
|
|
81
|
+
if (r.size === 0) return;
|
|
82
|
+
const c = j(e);
|
|
83
|
+
for (const [o, v] of r)
|
|
84
|
+
c.set(o, v);
|
|
85
|
+
Re(e, c);
|
|
81
86
|
}
|
|
82
|
-
function
|
|
87
|
+
function Ze({
|
|
83
88
|
data: e,
|
|
84
|
-
yMeasureUnit:
|
|
89
|
+
yMeasureUnit: r,
|
|
85
90
|
height: c = 306,
|
|
86
|
-
defaultGraph:
|
|
91
|
+
defaultGraph: o,
|
|
87
92
|
onGraphSelected: v,
|
|
88
93
|
graphs: f,
|
|
89
|
-
isMultipleSelect:
|
|
90
|
-
range:
|
|
91
|
-
rangeList:
|
|
92
|
-
setRange:
|
|
93
|
-
onGraphExpanded:
|
|
94
|
-
isGraphExpanded:
|
|
95
|
-
onUnselectSeries:
|
|
96
|
-
graphsWithNoData:
|
|
97
|
-
loadingGraphs:
|
|
98
|
-
isLoading:
|
|
94
|
+
isMultipleSelect: q,
|
|
95
|
+
range: Q,
|
|
96
|
+
rangeList: S,
|
|
97
|
+
setRange: Y,
|
|
98
|
+
onGraphExpanded: N,
|
|
99
|
+
isGraphExpanded: Z,
|
|
100
|
+
onUnselectSeries: L,
|
|
101
|
+
graphsWithNoData: D,
|
|
102
|
+
loadingGraphs: M,
|
|
103
|
+
isLoading: V,
|
|
99
104
|
noDataMessage: _ = "No data available for this graph",
|
|
100
|
-
currentValueDecimals:
|
|
105
|
+
currentValueDecimals: P,
|
|
101
106
|
containerClassName: U,
|
|
102
107
|
useSharedPriceScale: K,
|
|
103
|
-
showCurrentValue:
|
|
104
|
-
yScaleMin:
|
|
105
|
-
yScaleMinMultiple:
|
|
106
|
-
seriesColorPersistenceKey:
|
|
107
|
-
|
|
108
|
+
showCurrentValue: G,
|
|
109
|
+
yScaleMin: ee,
|
|
110
|
+
yScaleMinMultiple: te,
|
|
111
|
+
seriesColorPersistenceKey: d,
|
|
112
|
+
title: re,
|
|
113
|
+
trailing: k,
|
|
114
|
+
...oe
|
|
108
115
|
}) {
|
|
109
|
-
const
|
|
110
|
-
(
|
|
111
|
-
|
|
116
|
+
const g = I(() => Array.isArray(e) ? e : e ? [e] : [], [e]), ne = I(() => Array.isArray(e) && e.length > 1, [e]), z = he(), le = fe(
|
|
117
|
+
(u, y) => {
|
|
118
|
+
be.error(_);
|
|
112
119
|
},
|
|
113
120
|
[_]
|
|
114
|
-
),
|
|
115
|
-
if (
|
|
116
|
-
return Array.isArray(
|
|
117
|
-
}, [
|
|
118
|
-
if (f && f.length > 0 && !
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
|
|
121
|
+
), ie = I(() => {
|
|
122
|
+
if (r)
|
|
123
|
+
return Array.isArray(r) ? r[0] : r;
|
|
124
|
+
}, [r]), se = !!(v && f && o), i = C(/* @__PURE__ */ new Map()), b = C(0), F = C(!1);
|
|
125
|
+
if (f && f.length > 0 && !F.current) {
|
|
126
|
+
F.current = !0;
|
|
127
|
+
const u = d ? j(d) : /* @__PURE__ */ new Map(), y = String(f[0].value);
|
|
128
|
+
i.current.set(y, 0), b.current = 1;
|
|
122
129
|
for (let t = 1; t < f.length; t++) {
|
|
123
|
-
const
|
|
124
|
-
if (
|
|
125
|
-
const
|
|
126
|
-
|
|
130
|
+
const a = String(f[t].value);
|
|
131
|
+
if (i.current.has(a)) continue;
|
|
132
|
+
const x = u.get(a) ?? t;
|
|
133
|
+
i.current.set(a, x), b.current = Math.max(b.current, x + 1);
|
|
127
134
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
135
|
+
d && $(
|
|
136
|
+
d,
|
|
137
|
+
i.current
|
|
131
138
|
);
|
|
132
139
|
}
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
-
if (
|
|
136
|
-
const t =
|
|
137
|
-
for (const [
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
140
|
+
const w = I(() => {
|
|
141
|
+
const u = Array.isArray(r) ? r : void 0;
|
|
142
|
+
if (d) {
|
|
143
|
+
const t = j(d);
|
|
144
|
+
for (const [a, h] of t)
|
|
145
|
+
i.current.has(a) || (i.current.set(a, h), b.current = Math.max(
|
|
146
|
+
b.current,
|
|
147
|
+
h + 1
|
|
141
148
|
));
|
|
142
149
|
}
|
|
143
|
-
const y =
|
|
144
|
-
const
|
|
145
|
-
if (!
|
|
146
|
-
const
|
|
147
|
-
Array.from(
|
|
150
|
+
const y = g.map((t, a) => {
|
|
151
|
+
const h = t?.title || `Series ${a + 1}`, x = o != null ? Array.isArray(o) ? o[0]?.value ?? o[0] : typeof o == "object" && "value" in o ? o.value : o : null, R = g.length === 1 ? x != null ? String(x) : "single" : t?.id || h;
|
|
152
|
+
if (!i.current.has(R)) {
|
|
153
|
+
const l = new Set(
|
|
154
|
+
Array.from(i.current.values())
|
|
148
155
|
);
|
|
149
|
-
let s =
|
|
150
|
-
for (let
|
|
151
|
-
const
|
|
152
|
-
if (!
|
|
153
|
-
s =
|
|
156
|
+
let s = b.current;
|
|
157
|
+
for (let m = 0; m < T.length; m++) {
|
|
158
|
+
const A = (b.current + m) % T.length;
|
|
159
|
+
if (!l.has(A)) {
|
|
160
|
+
s = A;
|
|
154
161
|
break;
|
|
155
162
|
}
|
|
156
163
|
}
|
|
157
|
-
|
|
164
|
+
i.current.set(R, s), b.current = s + 1;
|
|
158
165
|
}
|
|
159
|
-
const
|
|
160
|
-
const
|
|
161
|
-
return
|
|
162
|
-
}).reduce((
|
|
163
|
-
const
|
|
164
|
-
return
|
|
165
|
-
}, []),
|
|
166
|
+
const ae = i.current.get(R) ?? 0, O = ve(ae), me = [...t?.data || []].sort((l, s) => {
|
|
167
|
+
const m = typeof l.time == "number" ? l.time : Number(l.time), A = typeof s.time == "number" ? s.time : Number(s.time);
|
|
168
|
+
return m - A;
|
|
169
|
+
}).reduce((l, s) => {
|
|
170
|
+
const m = s.time;
|
|
171
|
+
return l.length === 0 || l[l.length - 1].time !== m ? l.push({ time: m, value: s.value }) : l[l.length - 1] = { time: m, value: s.value }, l;
|
|
172
|
+
}, []), J = t?.lineColor ?? t?.color ?? void 0;
|
|
166
173
|
return {
|
|
167
|
-
data:
|
|
168
|
-
label:
|
|
169
|
-
yMeasureUnit:
|
|
174
|
+
data: me,
|
|
175
|
+
label: h,
|
|
176
|
+
yMeasureUnit: u?.[a] ?? (Array.isArray(r) ? void 0 : r),
|
|
170
177
|
...t?.priceScaleId != null && {
|
|
171
178
|
priceScaleId: t.priceScaleId
|
|
172
179
|
},
|
|
@@ -176,8 +183,8 @@ function ze({
|
|
|
176
183
|
...t?.lineStyle != null && {
|
|
177
184
|
lineStyle: t.lineStyle
|
|
178
185
|
},
|
|
179
|
-
...
|
|
180
|
-
lineColor:
|
|
186
|
+
...J != null ? {
|
|
187
|
+
lineColor: J,
|
|
181
188
|
...t?.topColor != null && {
|
|
182
189
|
topColor: t.topColor
|
|
183
190
|
},
|
|
@@ -185,79 +192,110 @@ function ze({
|
|
|
185
192
|
bottomColor: t.bottomColor
|
|
186
193
|
}
|
|
187
194
|
} : {
|
|
188
|
-
color:
|
|
189
|
-
topColor:
|
|
190
|
-
bottomColor:
|
|
195
|
+
color: O.line,
|
|
196
|
+
topColor: O.top,
|
|
197
|
+
bottomColor: O.bottom
|
|
191
198
|
}
|
|
192
199
|
};
|
|
193
200
|
});
|
|
194
|
-
return
|
|
195
|
-
|
|
196
|
-
|
|
201
|
+
return d && i.current.size > 0 && $(
|
|
202
|
+
d,
|
|
203
|
+
i.current
|
|
197
204
|
), y;
|
|
198
|
-
}, [
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
205
|
+
}, [g, o, r, d]), H = V !== void 0 ? V : M !== void 0 ? M.size > 0 : ne && g.length > 0 ? g.some((u) => !u) : !e, B = C(w);
|
|
206
|
+
w.length > 0 && (B.current = w);
|
|
207
|
+
const W = w.length > 0 ? w : H ? B.current : w, E = re, ce = !z && N ? !0 : S.length > 0 || se || E != null || k != null, ue = v && f && o ? /* @__PURE__ */ n(
|
|
208
|
+
Ne,
|
|
209
|
+
{
|
|
210
|
+
onSelected: v,
|
|
211
|
+
items: f,
|
|
212
|
+
defaultItem: o,
|
|
213
|
+
multiple: q,
|
|
214
|
+
graphsWithNoData: D,
|
|
215
|
+
loadingGraphs: M,
|
|
216
|
+
onNoDataSelected: le
|
|
217
|
+
}
|
|
218
|
+
) : E != null ? /* @__PURE__ */ n(we, { className: "min-w-0 truncate", children: E }) : null, de = ce && /* @__PURE__ */ p("div", { className: "flex w-full flex-row flex-wrap items-center justify-between gap-3", children: [
|
|
219
|
+
/* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: ue }),
|
|
220
|
+
/* @__PURE__ */ p("div", { className: "flex shrink-0 flex-row flex-nowrap items-center gap-3", children: [
|
|
221
|
+
k,
|
|
222
|
+
k != null && S.length > 0 ? /* @__PURE__ */ n("div", { className: "h-4 w-px shrink-0 bg-border" }) : null,
|
|
223
|
+
S.length > 0 ? /* @__PURE__ */ p(Se, { value: Q, onValueChange: Y, children: [
|
|
224
|
+
/* @__PURE__ */ n(
|
|
225
|
+
ye,
|
|
226
|
+
{
|
|
227
|
+
size: "sm",
|
|
228
|
+
className: "h-8 w-auto min-w-[4.5rem] gap-1.5 border-border bg-muted shadow-none",
|
|
229
|
+
children: /* @__PURE__ */ n(Ae, {})
|
|
230
|
+
}
|
|
231
|
+
),
|
|
232
|
+
/* @__PURE__ */ n(Ie, { align: "end", children: S.map((u) => /* @__PURE__ */ n(Ce, { value: u.value, children: u.label }, u.value)) })
|
|
233
|
+
] }) : null,
|
|
234
|
+
!z && N && /* @__PURE__ */ n(
|
|
221
235
|
"button",
|
|
222
236
|
{
|
|
223
237
|
type: "button",
|
|
224
|
-
className: "
|
|
225
|
-
onClick:
|
|
226
|
-
children:
|
|
238
|
+
className: "flex min-h-[26px] min-w-[44px] cursor-pointer items-center justify-center rounded-md border border-muted bg-muted px-2.5 py-1.5 text-center text-xs font-medium leading-[14px] text-muted-foreground transition-colors hover:border-secondary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
239
|
+
onClick: N,
|
|
240
|
+
children: Z ? /* @__PURE__ */ n(ke, { size: 16 }) : /* @__PURE__ */ n(Me, { size: 16 })
|
|
227
241
|
}
|
|
228
242
|
)
|
|
229
243
|
] })
|
|
230
244
|
] });
|
|
231
|
-
return /* @__PURE__ */
|
|
245
|
+
return /* @__PURE__ */ p(
|
|
232
246
|
"div",
|
|
233
247
|
{
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
248
|
+
className: pe(
|
|
249
|
+
"flex w-full flex-col gap-3 rounded-lg border border-border bg-card p-4 shadow-none",
|
|
250
|
+
U
|
|
251
|
+
),
|
|
252
|
+
children: [
|
|
253
|
+
de,
|
|
254
|
+
/* @__PURE__ */ n(
|
|
255
|
+
"div",
|
|
256
|
+
{
|
|
257
|
+
style: {
|
|
258
|
+
width: "100%",
|
|
259
|
+
height: c ? `${c}px` : void 0
|
|
260
|
+
},
|
|
261
|
+
className: "w-full",
|
|
262
|
+
children: /* @__PURE__ */ n(
|
|
263
|
+
xe,
|
|
264
|
+
{
|
|
265
|
+
...oe,
|
|
266
|
+
series: w,
|
|
267
|
+
loading: H,
|
|
268
|
+
size: c ? "full" : "default",
|
|
269
|
+
padding: "none",
|
|
270
|
+
variant: "ghost",
|
|
271
|
+
className: "rounded-md border border-border bg-card",
|
|
272
|
+
containerClassName: "h-full overflow-hidden rounded-none border-0 bg-transparent shadow-none",
|
|
273
|
+
showLegend: !1,
|
|
274
|
+
onUnselectSeries: L,
|
|
275
|
+
yMeasureUnit: ie,
|
|
276
|
+
currentValueDecimals: P,
|
|
277
|
+
useSharedPriceScale: K,
|
|
278
|
+
showCurrentValue: G,
|
|
279
|
+
yScaleMin: ee,
|
|
280
|
+
yScaleMinMultiple: te,
|
|
281
|
+
hideDefaultTooltip: !0,
|
|
282
|
+
optionsOverrides: Ee
|
|
283
|
+
}
|
|
284
|
+
)
|
|
285
|
+
}
|
|
286
|
+
),
|
|
287
|
+
W.length > 0 ? /* @__PURE__ */ n(
|
|
288
|
+
ge,
|
|
289
|
+
{
|
|
290
|
+
series: W,
|
|
291
|
+
onUnselect: L,
|
|
292
|
+
inline: !0
|
|
293
|
+
}
|
|
294
|
+
) : null
|
|
295
|
+
]
|
|
258
296
|
}
|
|
259
297
|
);
|
|
260
298
|
}
|
|
261
299
|
export {
|
|
262
|
-
|
|
300
|
+
Ze as TradingView
|
|
263
301
|
};
|