@gearbox-protocol/ui-kit 3.14.0-next.1 → 3.14.0-next.11
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/buttons/button/button.cjs +1 -1
- package/dist/cjs/components/client-adapters/styled-button/styled-button.cjs +1 -1
- package/dist/cjs/components/graph/formatters.cjs +1 -1
- package/dist/cjs/components/layout/main-aside-layout/main-aside-layout.cjs +1 -1
- package/dist/cjs/components/smart-number-input/smart-number-input.cjs +1 -1
- package/dist/cjs/components/trading-view/trading-view.cjs +1 -1
- package/dist/cjs/locale/en.json.cjs +1 -1
- package/dist/esm/components/buttons/button/button.js +1 -0
- package/dist/esm/components/client-adapters/styled-button/styled-button.js +11 -11
- package/dist/esm/components/graph/formatters.js +127 -132
- package/dist/esm/components/health-factor/health-factor.js +3 -3
- package/dist/esm/components/layout/main-aside-layout/main-aside-layout.js +78 -55
- package/dist/esm/components/smart-number-input/smart-number-input.js +253 -104
- package/dist/esm/components/trading-view/trading-view.js +58 -58
- package/dist/esm/locale/en.json.js +2 -0
- package/dist/globals.css +1 -1
- package/dist/types/components/buttons/button/button.d.ts +4 -3
- package/dist/types/components/help-tip/help-tip.d.ts +2 -2
- package/dist/types/components/layout/main-aside-layout/main-aside-layout.d.ts +34 -0
- package/dist/types/components/smart-number-input/smart-number-input.d.ts +52 -0
- package/dist/types/components/tip-card/tip-card.d.ts +1 -1
- package/dist/types/locale/en.json.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as f, jsx as c } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { formatPercentage as p, PERCENTAGE_FACTOR as v } from "@gearbox-protocol/sdk";
|
|
3
3
|
import { cva as x } from "class-variance-authority";
|
|
4
4
|
import "react";
|
|
5
5
|
import { cn as C } from "../../utils/cn.js";
|
|
@@ -10,7 +10,7 @@ import "../../utils/z-index.js";
|
|
|
10
10
|
import { StatusBars as F } from "../status-elements/status-elements.js";
|
|
11
11
|
const g = 15e3, A = 11e3, H = 10500, N = (t) => {
|
|
12
12
|
if (t)
|
|
13
|
-
return t >= g ? "good" : t > A ? "medium" : t > H ? "bad" : t >
|
|
13
|
+
return t >= g ? "good" : t > A ? "medium" : t > H ? "bad" : t > v ? "critical" : "liquidation";
|
|
14
14
|
}, b = x(
|
|
15
15
|
"inline-flex items-center font-medium [text-decoration:inherit]",
|
|
16
16
|
{
|
|
@@ -38,7 +38,7 @@ function G({
|
|
|
38
38
|
const n = e !== void 0 && e === 0n, r = !n && i === "color" ? o === void 0 ? N(t) : o : void 0, s = r === void 0 ? void 0 : r === null ? "unset" : r, d = () => {
|
|
39
39
|
if (n) return "N/A";
|
|
40
40
|
const l = Number(t);
|
|
41
|
-
return
|
|
41
|
+
return p(l, a);
|
|
42
42
|
};
|
|
43
43
|
return /* @__PURE__ */ f(
|
|
44
44
|
"span",
|
|
@@ -1,83 +1,106 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { cn as
|
|
4
|
-
const
|
|
1
|
+
import { jsx as m, jsxs as o, Fragment as c } from "react/jsx-runtime";
|
|
2
|
+
import * as b from "react";
|
|
3
|
+
import { cn as i } from "../../../utils/cn.js";
|
|
4
|
+
const k = b.forwardRef(
|
|
5
5
|
({
|
|
6
|
-
children:
|
|
7
|
-
aside:
|
|
8
|
-
asidePosition:
|
|
9
|
-
asideClassName:
|
|
10
|
-
mainClassName:
|
|
11
|
-
mainRef:
|
|
12
|
-
variant:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
children: n,
|
|
7
|
+
aside: s,
|
|
8
|
+
asidePosition: x = "right",
|
|
9
|
+
asideClassName: w,
|
|
10
|
+
mainClassName: f,
|
|
11
|
+
mainRef: p,
|
|
12
|
+
variant: g = "default",
|
|
13
|
+
centeredMain: u = !1,
|
|
14
|
+
className: v,
|
|
15
|
+
...d
|
|
16
|
+
}, h) => {
|
|
17
|
+
const e = g === "detail", r = x === "left", l = e && u, a = s == null ? null : /* @__PURE__ */ m(
|
|
17
18
|
"aside",
|
|
18
19
|
{
|
|
19
|
-
className:
|
|
20
|
+
className: i(
|
|
20
21
|
"min-w-0 shrink-0",
|
|
21
|
-
l && [
|
|
22
|
+
e && !l && [
|
|
22
23
|
"w-full",
|
|
23
24
|
"z-30 lg:w-[420px] lg:min-w-[420px] lg:max-w-[420px]",
|
|
24
25
|
"xl:w-[460px] xl:min-w-[460px] xl:max-w-[460px]",
|
|
25
26
|
"max-h-full lg:max-h-[100vh] overflow-y-visible lg:overflow-y-auto",
|
|
26
27
|
// sticky below 2450px, fixed at ≥2450px
|
|
27
28
|
"lg:max-[2449px]:sticky lg:max-[2449px]:top-4",
|
|
28
|
-
"min-[2450px]:fixed min-[2450px]:top-28
|
|
29
|
+
"min-[2450px]:fixed min-[2450px]:top-28",
|
|
30
|
+
// fixed anchor matches asidePosition
|
|
31
|
+
r ? "min-[2450px]:left-32" : "min-[2450px]:right-32"
|
|
32
|
+
],
|
|
33
|
+
l && [
|
|
34
|
+
"w-full",
|
|
35
|
+
"z-30 lg:w-[420px] lg:min-w-[420px] lg:max-w-[420px]",
|
|
36
|
+
"xl:w-[460px] xl:min-w-[460px] xl:max-w-[460px]",
|
|
37
|
+
"overflow-y-visible lg:max-h-[100vh] lg:overflow-y-auto",
|
|
38
|
+
// sticky in the LP-style fill range (lg…1799px)
|
|
39
|
+
"lg:max-[1799px]:sticky lg:max-[1799px]:top-4",
|
|
40
|
+
// ≥1800px: gutter beside the viewport-centred main column
|
|
41
|
+
"min-[1800px]:absolute min-[1800px]:top-0",
|
|
42
|
+
r ? "min-[1800px]:right-full min-[1800px]:mr-6" : "min-[1800px]:left-full min-[1800px]:ml-6"
|
|
29
43
|
],
|
|
30
|
-
|
|
44
|
+
w
|
|
31
45
|
),
|
|
32
|
-
children:
|
|
46
|
+
children: s
|
|
33
47
|
}
|
|
34
|
-
)
|
|
35
|
-
|
|
48
|
+
), y = i(
|
|
49
|
+
// lg…1799: children participate in the outer flex row (LP-style fill)
|
|
50
|
+
"lg:contents",
|
|
51
|
+
// ≥1800: viewport-centred shell; aside is absolute in the gutter
|
|
52
|
+
"min-[1800px]:block min-[1800px]:relative min-[1800px]:mx-auto min-[1800px]:w-full",
|
|
53
|
+
"min-[1800px]:max-w-[min(80rem,calc(100vw-460px-1.5rem-4rem))]"
|
|
54
|
+
), t = i(
|
|
55
|
+
"relative z-0 min-w-0 w-full",
|
|
56
|
+
!l && "flex-1",
|
|
57
|
+
e && !l && [
|
|
58
|
+
"relative z-0 w-full",
|
|
59
|
+
"min-[2450px]:mx-auto min-[2450px]:flex-none",
|
|
60
|
+
"min-[2450px]:max-w-[min(80rem,calc(100vw-460px-8rem))]",
|
|
61
|
+
r && "min-[2450px]:ml-[calc(460px+8rem)]"
|
|
62
|
+
],
|
|
63
|
+
l && "flex-1 lg:max-w-none",
|
|
64
|
+
f
|
|
65
|
+
), N = x === "left" ? /* @__PURE__ */ o(c, { children: [
|
|
66
|
+
a,
|
|
67
|
+
/* @__PURE__ */ m("div", { ref: p, className: t, children: n })
|
|
68
|
+
] }) : /* @__PURE__ */ o(c, { children: [
|
|
69
|
+
/* @__PURE__ */ m("div", { ref: p, className: t, children: n }),
|
|
70
|
+
a
|
|
71
|
+
] });
|
|
72
|
+
return /* @__PURE__ */ m(
|
|
36
73
|
"div",
|
|
37
74
|
{
|
|
38
|
-
ref:
|
|
39
|
-
className:
|
|
75
|
+
ref: h,
|
|
76
|
+
className: i(
|
|
40
77
|
// base: mobile stack (column-reverse), desktop row
|
|
41
|
-
"flex w-full flex-col-reverse gap-6 lg:
|
|
42
|
-
l &&
|
|
78
|
+
"flex w-full flex-col-reverse gap-6 lg:items-start",
|
|
79
|
+
!l && "lg:flex-row",
|
|
80
|
+
e && !l && [
|
|
43
81
|
"relative mx-auto min-w-0",
|
|
44
|
-
// cap width so aside doesn't overflow on medium-wide screens
|
|
45
82
|
"max-w-[calc(80rem+420px+1.5rem)]",
|
|
46
83
|
"xl:max-w-[calc(80rem+460px+1.5rem)]",
|
|
47
|
-
// at ≥2450px aside is fixed → switch wrapper to block so main can
|
|
48
|
-
// centre independently
|
|
49
84
|
"min-[2450px]:block min-[2450px]:max-w-none min-[2450px]:gap-0"
|
|
50
85
|
],
|
|
51
|
-
|
|
86
|
+
l && [
|
|
87
|
+
"relative mx-auto min-w-0 lg:flex-row",
|
|
88
|
+
"max-w-[calc(80rem+420px+1.5rem)] xl:max-w-[calc(80rem+460px+1.5rem)]",
|
|
89
|
+
"min-[1800px]:block min-[1800px]:max-w-none"
|
|
90
|
+
],
|
|
91
|
+
v
|
|
52
92
|
),
|
|
53
|
-
...
|
|
54
|
-
children: [
|
|
55
|
-
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
ref: t,
|
|
60
|
-
className: x(
|
|
61
|
-
"min-w-0 flex-1",
|
|
62
|
-
l && [
|
|
63
|
-
"relative z-0 w-full",
|
|
64
|
-
// at ≥2450px: stop growing and centre with explicit max-width
|
|
65
|
-
// (leaves room for the fixed 460px aside + 8rem right offset)
|
|
66
|
-
"min-[2450px]:mx-auto min-[2450px]:flex-none",
|
|
67
|
-
"min-[2450px]:max-w-[min(80rem,calc(100vw-460px-8rem))]"
|
|
68
|
-
],
|
|
69
|
-
p
|
|
70
|
-
),
|
|
71
|
-
children: r
|
|
72
|
-
}
|
|
73
|
-
),
|
|
74
|
-
e === "right" && a
|
|
75
|
-
]
|
|
93
|
+
...d,
|
|
94
|
+
children: l ? /* @__PURE__ */ m("div", { className: y, children: N }) : /* @__PURE__ */ o(c, { children: [
|
|
95
|
+
x === "left" && a,
|
|
96
|
+
/* @__PURE__ */ m("div", { ref: p, className: t, children: n }),
|
|
97
|
+
x === "right" && a
|
|
98
|
+
] })
|
|
76
99
|
}
|
|
77
100
|
);
|
|
78
101
|
}
|
|
79
102
|
);
|
|
80
|
-
|
|
103
|
+
k.displayName = "MainAsideLayout";
|
|
81
104
|
export {
|
|
82
|
-
|
|
105
|
+
k as MainAsideLayout
|
|
83
106
|
};
|
|
@@ -1,32 +1,39 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { cva as
|
|
3
|
-
import * as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { cva as k } from "class-variance-authority";
|
|
3
|
+
import * as s from "react";
|
|
4
|
+
import { createPortal as de } from "react-dom";
|
|
5
|
+
import { Checkbox as ue } from "../checkbox/checkbox.js";
|
|
6
|
+
import "../checkbox/checkbox-labeled.js";
|
|
7
|
+
import { CurrencyButton as me } from "../currency-button/currency-button.js";
|
|
8
|
+
import { HealthFactor as fe } from "../health-factor/health-factor.js";
|
|
9
|
+
import { faXmark as pe } from "@fortawesome/free-solid-svg-icons";
|
|
10
|
+
import { FaIcon as he } from "../icons/fa-icon.js";
|
|
11
|
+
import { Slider as ge } from "../slider/slider.js";
|
|
12
|
+
import "../slider/slider-context.js";
|
|
13
|
+
import { useIntlTyped as xe, FormattedMessageTyped as B } from "../typed-intl/index.js";
|
|
14
|
+
import { useIsMobile as be, useIsTablet as ve, useIsDesktop as we } from "../../hooks/use-media-query.js";
|
|
15
|
+
import { smartNumberInputTestIds as w } from "../../test-ids/smart-number-input.js";
|
|
16
|
+
import { bnToInputView as ye } from "../../utils/bn-to-input-view.js";
|
|
10
17
|
import "@gearbox-protocol/sdk";
|
|
11
|
-
import { parseInputToBN as
|
|
12
|
-
import { cn as
|
|
18
|
+
import { parseInputToBN as Ne } from "../../utils/parse-input-to-bn.js";
|
|
19
|
+
import { cn as y } from "../../utils/cn.js";
|
|
13
20
|
import "sonner";
|
|
14
21
|
import "@gearbox-protocol/sdk/common-utils";
|
|
15
22
|
import "luxon";
|
|
16
23
|
import "../../utils/z-index.js";
|
|
17
|
-
import { BalanceIndicator as
|
|
18
|
-
const
|
|
24
|
+
import { BalanceIndicator as Ie } from "./balance-indicator.js";
|
|
25
|
+
const Ce = k(
|
|
19
26
|
"relative w-full text-foreground bg-gray-20 border border-gray-30 transition-[background-color] duration-100 ease-linear [&:hover]:bg-gray-30 [&:hover]:border-gray-40 data-[active=true]:bg-gray-30 data-[active=true]:outline data-[active=true]:outline-2 data-[active=true]:outline-primary data-[active=true]:outline-offset-[-2px] data-[disabled=true]:cursor-not-allowed",
|
|
20
27
|
{
|
|
21
28
|
variants: {
|
|
22
29
|
size: {
|
|
23
|
-
sm: "px-3 py-[7px] h-[60px] rounded-[8px]",
|
|
24
|
-
md: "pl-4 pr-3 py-[10px] h-[82px] rounded-lg"
|
|
30
|
+
sm: "px-3 py-[7px] min-h-[60px] rounded-[8px]",
|
|
31
|
+
md: "pl-4 pr-3 py-[10px] min-h-[82px] rounded-lg"
|
|
25
32
|
}
|
|
26
33
|
},
|
|
27
34
|
defaultVariants: { size: "md" }
|
|
28
35
|
}
|
|
29
|
-
),
|
|
36
|
+
), ke = k("font-medium text-foreground", {
|
|
30
37
|
variants: {
|
|
31
38
|
size: {
|
|
32
39
|
sm: "text-xs",
|
|
@@ -34,7 +41,7 @@ const Y = m(
|
|
|
34
41
|
}
|
|
35
42
|
},
|
|
36
43
|
defaultVariants: { size: "md" }
|
|
37
|
-
}),
|
|
44
|
+
}), Me = k(
|
|
38
45
|
"w-full p-0 bg-transparent border-none outline-none text-foreground placeholder:text-secondary-foreground focus:outline-none",
|
|
39
46
|
{
|
|
40
47
|
variants: {
|
|
@@ -45,97 +52,172 @@ const Y = m(
|
|
|
45
52
|
},
|
|
46
53
|
defaultVariants: { size: "md" }
|
|
47
54
|
}
|
|
48
|
-
)
|
|
55
|
+
);
|
|
56
|
+
function C(a) {
|
|
57
|
+
return Math.round(a * 100);
|
|
58
|
+
}
|
|
59
|
+
function ze(a) {
|
|
60
|
+
return a / 100;
|
|
61
|
+
}
|
|
62
|
+
function Fe(a, r) {
|
|
63
|
+
if (!r) return null;
|
|
64
|
+
const f = parseFloat(a.replace(",", ".") || "0");
|
|
65
|
+
if (!Number.isFinite(f) || f === 0) return null;
|
|
66
|
+
const o = f * r, x = Math.abs(o) < 100;
|
|
67
|
+
try {
|
|
68
|
+
return new Intl.NumberFormat("en-US", {
|
|
69
|
+
style: "currency",
|
|
70
|
+
currency: "USD",
|
|
71
|
+
minimumFractionDigits: x ? 2 : 0,
|
|
72
|
+
maximumFractionDigits: x ? 2 : 0
|
|
73
|
+
}).format(o);
|
|
74
|
+
} catch {
|
|
75
|
+
return "$0";
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const Le = s.forwardRef(
|
|
49
79
|
({
|
|
50
|
-
amount:
|
|
51
|
-
token:
|
|
52
|
-
label:
|
|
53
|
-
maxAmount:
|
|
54
|
-
maxAmountLimit:
|
|
55
|
-
maxButtonLabel:
|
|
56
|
-
chainId:
|
|
57
|
-
network:
|
|
58
|
-
maxButton:
|
|
59
|
-
disabled:
|
|
60
|
-
active:
|
|
61
|
-
size:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
80
|
+
amount: a,
|
|
81
|
+
token: r,
|
|
82
|
+
label: f,
|
|
83
|
+
maxAmount: o,
|
|
84
|
+
maxAmountLimit: g,
|
|
85
|
+
maxButtonLabel: x,
|
|
86
|
+
chainId: S,
|
|
87
|
+
network: E,
|
|
88
|
+
maxButton: R = !0,
|
|
89
|
+
disabled: u = !1,
|
|
90
|
+
active: D = !1,
|
|
91
|
+
size: j = "md",
|
|
92
|
+
symbolMaxLength: $,
|
|
93
|
+
tokenOptions: N,
|
|
94
|
+
multiSelectMode: H = !1,
|
|
95
|
+
onSetAmount: p,
|
|
96
|
+
onShowSelectDialog: M,
|
|
97
|
+
onRemove: z,
|
|
98
|
+
onFocus: U,
|
|
99
|
+
onBlur: W,
|
|
100
|
+
usdPrice: F,
|
|
101
|
+
hfSlider: c
|
|
102
|
+
}, O) => {
|
|
103
|
+
const { formatMessage: P } = xe(), X = s.useId(), L = r?.decimals ?? 18, q = (e) => {
|
|
104
|
+
const n = e.target.value, [i, d] = Ne(n, L);
|
|
105
|
+
i === null || d === null || p && p(i, d);
|
|
106
|
+
}, G = () => {
|
|
107
|
+
if (p) {
|
|
108
|
+
const e = o && g && o > g ? g : o || 0n, n = ye(e, L);
|
|
109
|
+
p(e, n);
|
|
75
110
|
}
|
|
76
|
-
}, [
|
|
77
|
-
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
|
|
111
|
+
}, [J, T] = s.useState(!1), K = () => {
|
|
112
|
+
T(!0), U?.();
|
|
113
|
+
}, Q = () => {
|
|
114
|
+
T(!1), W?.();
|
|
115
|
+
}, Y = be(), Z = c?.min ?? 1, _ = c?.max ?? 3, A = c?.step ?? 0.01, ee = Math.max(1, Math.round(1 / A)), h = j ?? "md", te = Y, ne = ve(), re = we(), se = $ ?? (te ? 20 : ne ? 30 : re ? 22 : 30), [m, I] = s.useState(!1), b = s.useRef(null), V = s.useRef(null), [ae, oe] = s.useState({});
|
|
116
|
+
s.useLayoutEffect(() => {
|
|
117
|
+
if (!m || !b.current) return;
|
|
118
|
+
const e = () => {
|
|
119
|
+
const n = b.current?.getBoundingClientRect();
|
|
120
|
+
n && oe({
|
|
121
|
+
position: "fixed",
|
|
122
|
+
top: n.bottom + 4,
|
|
123
|
+
right: window.innerWidth - n.right,
|
|
124
|
+
minWidth: n.width,
|
|
125
|
+
zIndex: 9999
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
|
|
129
|
+
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
|
|
130
|
+
};
|
|
131
|
+
}, [m]), s.useEffect(() => {
|
|
132
|
+
if (!m) return;
|
|
133
|
+
const e = (n) => {
|
|
134
|
+
const i = n.target, d = b.current?.contains(i), ce = V.current?.contains(i);
|
|
135
|
+
!d && !ce && I(!1);
|
|
136
|
+
};
|
|
137
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
138
|
+
}, [m]);
|
|
139
|
+
const v = !!(N && N.length > 0), ie = !u && v ? () => I((e) => !e) : M, le = !!(r || M || v);
|
|
140
|
+
return /* @__PURE__ */ l(
|
|
82
141
|
"div",
|
|
83
142
|
{
|
|
84
|
-
ref:
|
|
85
|
-
className:
|
|
86
|
-
"data-testid":
|
|
87
|
-
"data-active":
|
|
88
|
-
"data-disabled":
|
|
143
|
+
ref: O,
|
|
144
|
+
className: Ce({ size: h }),
|
|
145
|
+
"data-testid": w.root,
|
|
146
|
+
"data-active": J,
|
|
147
|
+
"data-disabled": u,
|
|
89
148
|
children: [
|
|
90
|
-
|
|
149
|
+
z && /* @__PURE__ */ t(
|
|
91
150
|
"div",
|
|
92
151
|
{
|
|
93
152
|
className: "absolute top-0 right-0 flex h-5 w-5 translate-x-1/2 -translate-y-1/2 items-center justify-center",
|
|
94
|
-
"data-testid":
|
|
95
|
-
children: /* @__PURE__ */
|
|
153
|
+
"data-testid": w.close,
|
|
154
|
+
children: /* @__PURE__ */ t(
|
|
96
155
|
"button",
|
|
97
156
|
{
|
|
98
157
|
type: "button",
|
|
99
|
-
onClick:
|
|
158
|
+
onClick: z,
|
|
100
159
|
className: "flex h-5 w-5 items-center justify-center rounded-full bg-muted hover:bg-muted/80 text-muted-foreground",
|
|
101
|
-
children: /* @__PURE__ */
|
|
160
|
+
children: /* @__PURE__ */ t(he, { icon: pe, className: "size-3" })
|
|
102
161
|
}
|
|
103
162
|
)
|
|
104
163
|
}
|
|
105
164
|
),
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
-
/* @__PURE__ */
|
|
165
|
+
/* @__PURE__ */ l("div", { className: "mb-2 flex justify-between text-sm leading-[120%]", children: [
|
|
166
|
+
/* @__PURE__ */ t(
|
|
108
167
|
"span",
|
|
109
168
|
{
|
|
110
|
-
className:
|
|
111
|
-
|
|
169
|
+
className: y(
|
|
170
|
+
ke({ size: h }),
|
|
112
171
|
"grow shrink-0 basis-0"
|
|
113
172
|
),
|
|
114
|
-
"data-testid":
|
|
115
|
-
children:
|
|
173
|
+
"data-testid": w.label,
|
|
174
|
+
children: f ?? /* @__PURE__ */ t(B, { messageId: "components.smartNumberInput.amountLabel" })
|
|
116
175
|
}
|
|
117
176
|
),
|
|
118
|
-
|
|
119
|
-
|
|
177
|
+
c !== void 0 ? /* @__PURE__ */ l("div", { className: "ml-auto flex w-1/2 min-w-0 items-center gap-1", children: [
|
|
178
|
+
/* @__PURE__ */ t("span", { className: "shrink-0 text-xs text-secondary-foreground", children: "HF" }),
|
|
179
|
+
/* @__PURE__ */ t("div", { className: "min-w-0 flex-1 [&>div]:px-0 [&>div]:pb-0", children: /* @__PURE__ */ t(
|
|
180
|
+
ge,
|
|
181
|
+
{
|
|
182
|
+
from: C(Z),
|
|
183
|
+
to: C(_),
|
|
184
|
+
value: C(c.value),
|
|
185
|
+
precision: ee,
|
|
186
|
+
markerStep: 0,
|
|
187
|
+
epsilon: 0,
|
|
188
|
+
onChangeValue: (e) => c.onChange(ze(e))
|
|
189
|
+
}
|
|
190
|
+
) }),
|
|
191
|
+
/* @__PURE__ */ t(
|
|
192
|
+
fe,
|
|
193
|
+
{
|
|
194
|
+
value: Math.round(c.value * 1e4),
|
|
195
|
+
debt: 1n,
|
|
196
|
+
decimals: 2,
|
|
197
|
+
className: "shrink-0 text-xs tabular-nums"
|
|
198
|
+
}
|
|
199
|
+
)
|
|
200
|
+
] }) : o !== void 0 && r && /* @__PURE__ */ t(
|
|
201
|
+
Ie,
|
|
120
202
|
{
|
|
121
|
-
title:
|
|
122
|
-
token:
|
|
123
|
-
maxAmount:
|
|
124
|
-
size:
|
|
125
|
-
disabled:
|
|
126
|
-
maxButton:
|
|
127
|
-
onMaxButtonClick:
|
|
203
|
+
title: x,
|
|
204
|
+
token: r,
|
|
205
|
+
maxAmount: o,
|
|
206
|
+
size: h,
|
|
207
|
+
disabled: u,
|
|
208
|
+
maxButton: R,
|
|
209
|
+
onMaxButtonClick: G
|
|
128
210
|
}
|
|
129
211
|
)
|
|
130
212
|
] }),
|
|
131
|
-
/* @__PURE__ */
|
|
213
|
+
/* @__PURE__ */ l(
|
|
132
214
|
"div",
|
|
133
215
|
{
|
|
134
|
-
className:
|
|
216
|
+
className: y(
|
|
135
217
|
"flex w-full max-w-full shrink-0 basis-full items-center"
|
|
136
218
|
),
|
|
137
219
|
children: [
|
|
138
|
-
/* @__PURE__ */
|
|
220
|
+
/* @__PURE__ */ t("div", { className: "mr-3 grow shrink-0 basis-0", children: /* @__PURE__ */ t(
|
|
139
221
|
"input",
|
|
140
222
|
{
|
|
141
223
|
type: "text",
|
|
@@ -145,44 +227,111 @@ const Y = m(
|
|
|
145
227
|
spellCheck: "false",
|
|
146
228
|
pattern: "^[0-9]*[.,]?[0-9]*$",
|
|
147
229
|
placeholder: "0",
|
|
148
|
-
value:
|
|
149
|
-
onChange:
|
|
150
|
-
onFocus:
|
|
151
|
-
onBlur:
|
|
152
|
-
disabled:
|
|
153
|
-
className:
|
|
154
|
-
|
|
155
|
-
|
|
230
|
+
value: a,
|
|
231
|
+
onChange: q,
|
|
232
|
+
onFocus: K,
|
|
233
|
+
onBlur: Q,
|
|
234
|
+
disabled: u || !p,
|
|
235
|
+
className: y(
|
|
236
|
+
Me({ size: h }),
|
|
237
|
+
u && "cursor-not-allowed"
|
|
156
238
|
),
|
|
157
|
-
"data-testid":
|
|
239
|
+
"data-testid": w.input,
|
|
158
240
|
minLength: 1,
|
|
159
241
|
maxLength: 79,
|
|
160
|
-
title:
|
|
242
|
+
title: P({
|
|
243
|
+
messageId: "components.smartNumberInput.inputTitle"
|
|
244
|
+
})
|
|
161
245
|
}
|
|
162
246
|
) }),
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
247
|
+
le ? /* @__PURE__ */ l("div", { ref: b, className: "shrink-0", children: [
|
|
248
|
+
/* @__PURE__ */ t(
|
|
249
|
+
me,
|
|
250
|
+
{
|
|
251
|
+
active: v ? m : D,
|
|
252
|
+
size: h,
|
|
253
|
+
disabled: u,
|
|
254
|
+
token: r,
|
|
255
|
+
showSelectDialog: ie,
|
|
256
|
+
chainId: S,
|
|
257
|
+
network: E,
|
|
258
|
+
maxLength: se,
|
|
259
|
+
children: r?.symbol ?? /* @__PURE__ */ t(B, { messageId: "components.smartNumberInput.selectToken" })
|
|
260
|
+
}
|
|
261
|
+
),
|
|
262
|
+
v && m && de(
|
|
263
|
+
/* @__PURE__ */ t(
|
|
264
|
+
"div",
|
|
265
|
+
{
|
|
266
|
+
ref: V,
|
|
267
|
+
style: ae,
|
|
268
|
+
className: "overflow-hidden rounded-lg border border-gray-30 bg-gray-20 shadow-lg",
|
|
269
|
+
children: N?.map((e, n) => {
|
|
270
|
+
const i = `${X}-${n}`, d = "flex w-full min-w-0 items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-gray-30";
|
|
271
|
+
return H ? /* @__PURE__ */ l(
|
|
272
|
+
"div",
|
|
273
|
+
{
|
|
274
|
+
className: d,
|
|
275
|
+
children: [
|
|
276
|
+
/* @__PURE__ */ t(
|
|
277
|
+
ue,
|
|
278
|
+
{
|
|
279
|
+
id: i,
|
|
280
|
+
checked: !!e.checked,
|
|
281
|
+
color: "secondary",
|
|
282
|
+
size: "md",
|
|
283
|
+
className: "shrink-0",
|
|
284
|
+
onCheckedChange: () => e.onSelect()
|
|
285
|
+
}
|
|
286
|
+
),
|
|
287
|
+
/* @__PURE__ */ l(
|
|
288
|
+
"label",
|
|
289
|
+
{
|
|
290
|
+
htmlFor: i,
|
|
291
|
+
className: "flex min-w-0 flex-1 cursor-pointer items-center gap-2 text-left",
|
|
292
|
+
children: [
|
|
293
|
+
e.icon ? /* @__PURE__ */ t("span", { className: "inline-flex shrink-0 items-center", children: e.icon }) : null,
|
|
294
|
+
/* @__PURE__ */ t("span", { className: "truncate", children: e.label })
|
|
295
|
+
]
|
|
296
|
+
}
|
|
297
|
+
)
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
n
|
|
301
|
+
) : /* @__PURE__ */ l(
|
|
302
|
+
"button",
|
|
303
|
+
{
|
|
304
|
+
type: "button",
|
|
305
|
+
onClick: () => {
|
|
306
|
+
e.onSelect(), I(!1);
|
|
307
|
+
},
|
|
308
|
+
className: y(d, "text-left"),
|
|
309
|
+
children: [
|
|
310
|
+
e.icon ? /* @__PURE__ */ t("span", { className: "inline-flex shrink-0 items-center", children: e.icon }) : null,
|
|
311
|
+
/* @__PURE__ */ t("span", { className: "truncate", children: e.label })
|
|
312
|
+
]
|
|
313
|
+
},
|
|
314
|
+
n
|
|
315
|
+
);
|
|
316
|
+
})
|
|
317
|
+
}
|
|
318
|
+
),
|
|
319
|
+
document.body
|
|
320
|
+
)
|
|
321
|
+
] }) : null
|
|
177
322
|
]
|
|
178
323
|
}
|
|
179
|
-
)
|
|
324
|
+
),
|
|
325
|
+
F !== void 0 && (() => {
|
|
326
|
+
const e = Fe(a, F);
|
|
327
|
+
return e ? /* @__PURE__ */ t("div", { className: "mt-1 text-xs leading-[130%] text-secondary-foreground", children: e }) : null;
|
|
328
|
+
})()
|
|
180
329
|
]
|
|
181
330
|
}
|
|
182
331
|
);
|
|
183
332
|
}
|
|
184
333
|
);
|
|
185
|
-
|
|
334
|
+
Le.displayName = "SmartNumberInput";
|
|
186
335
|
export {
|
|
187
|
-
|
|
336
|
+
Le as SmartNumberInput
|
|
188
337
|
};
|