@gearbox-protocol/ui-kit 3.7.1 → 3.8.1-next.1
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/composites/index.cjs +1 -1
- package/dist/cjs/components/composites/pool-credit-manager-info/index.cjs +1 -1
- package/dist/cjs/components/composites/pool-credit-manager-info/pool-credit-manager-info.cjs +1 -1
- package/dist/cjs/components/composites/pool-credit-managers-table/index.cjs +1 -1
- package/dist/cjs/components/composites/pool-credit-managers-table/pool-credit-managers-table-row.cjs +1 -1
- package/dist/cjs/components/currency-button/currency-button.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/smart-number-input/balance-indicator.cjs +1 -1
- package/dist/cjs/components/smart-number-input/smart-number-input.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/test-ids/currency-button.cjs +1 -0
- package/dist/cjs/test-ids/index.cjs +1 -0
- package/dist/cjs/test-ids/smart-number-input.cjs +1 -0
- package/dist/esm/components/composites/index.js +23 -27
- package/dist/esm/components/composites/pool-credit-manager-info/index.js +3 -5
- package/dist/esm/components/composites/pool-credit-manager-info/pool-credit-manager-info.js +17 -17
- package/dist/esm/components/composites/pool-credit-managers-table/index.js +3 -5
- package/dist/esm/components/composites/pool-credit-managers-table/pool-credit-managers-table-row.js +12 -12
- package/dist/esm/components/currency-button/currency-button.js +8 -7
- package/dist/esm/components/index.js +592 -596
- package/dist/esm/components/smart-number-input/balance-indicator.js +26 -25
- package/dist/esm/components/smart-number-input/smart-number-input.js +75 -74
- package/dist/esm/index.js +815 -810
- package/dist/esm/test-ids/currency-button.js +6 -0
- package/dist/esm/test-ids/index.js +11 -0
- package/dist/esm/test-ids/smart-number-input.js +13 -0
- package/dist/types/components/composites/pool-credit-manager-info/index.d.ts +0 -1
- package/dist/types/components/composites/pool-credit-managers-table/index.d.ts +0 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/test-ids/currency-button.d.ts +4 -0
- package/dist/types/test-ids/index.d.ts +11 -0
- package/dist/types/test-ids/smart-number-input.d.ts +12 -0
- package/package.json +6 -1
- /package/dist/cjs/{components/composites/pool-credit-manager-info/test-ids.cjs → test-ids/pool-credit-manager-info.cjs} +0 -0
- /package/dist/cjs/{components/composites/pool-credit-managers-table/test-ids.ts.cjs → test-ids/pool-credit-managers-table.cjs} +0 -0
- /package/dist/esm/{components/composites/pool-credit-manager-info/test-ids.js → test-ids/pool-credit-manager-info.js} +0 -0
- /package/dist/esm/{components/composites/pool-credit-managers-table/test-ids.ts.js → test-ids/pool-credit-managers-table.js} +0 -0
- /package/dist/types/{components/composites/pool-credit-manager-info/test-ids.d.ts → test-ids/pool-credit-manager-info.d.ts} +0 -0
- /package/dist/types/{components/composites/pool-credit-managers-table/test-ids.ts.d.ts → test-ids/pool-credit-managers-table.d.ts} +0 -0
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { jsxs as m, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { cva as
|
|
3
|
-
import { TextButton as
|
|
4
|
-
import { TokenTemplate as
|
|
2
|
+
import { cva as u } from "class-variance-authority";
|
|
3
|
+
import { TextButton as f } from "../text-button/text-button.js";
|
|
4
|
+
import { TokenTemplate as b } from "../token-template/token-template.js";
|
|
5
|
+
import { balanceIndicatorTestIds as s } from "../../test-ids/smart-number-input.js";
|
|
5
6
|
import "react";
|
|
6
7
|
import "@gearbox-protocol/sdk";
|
|
7
|
-
import { cn as
|
|
8
|
+
import { cn as o } from "../../utils/cn.js";
|
|
8
9
|
import "sonner";
|
|
9
10
|
import "@gearbox-protocol/sdk/common-utils";
|
|
10
11
|
import "luxon";
|
|
11
12
|
import "../../utils/z-index.js";
|
|
12
|
-
const
|
|
13
|
+
const h = u("font-normal leading-[130%] text-foreground", {
|
|
13
14
|
variants: {
|
|
14
15
|
size: {
|
|
15
16
|
sm: "text-xs",
|
|
@@ -18,35 +19,35 @@ const b = x("font-normal leading-[130%] text-foreground", {
|
|
|
18
19
|
},
|
|
19
20
|
defaultVariants: { size: "md" }
|
|
20
21
|
});
|
|
21
|
-
function
|
|
22
|
-
title:
|
|
23
|
-
className:
|
|
24
|
-
maxAmount:
|
|
25
|
-
token:
|
|
26
|
-
disabled:
|
|
27
|
-
maxButton:
|
|
28
|
-
onMaxButtonClick:
|
|
29
|
-
size:
|
|
22
|
+
function A({
|
|
23
|
+
title: i = "Balance",
|
|
24
|
+
className: l,
|
|
25
|
+
maxAmount: c,
|
|
26
|
+
token: d,
|
|
27
|
+
disabled: p,
|
|
28
|
+
maxButton: x = !0,
|
|
29
|
+
onMaxButtonClick: e,
|
|
30
|
+
size: r = "sm"
|
|
30
31
|
}) {
|
|
31
|
-
const
|
|
32
|
+
const a = !p && x, n = /* @__PURE__ */ t(b, { value: c, token: d, showSymbol: !1 });
|
|
32
33
|
return /* @__PURE__ */ m(
|
|
33
34
|
"div",
|
|
34
35
|
{
|
|
35
|
-
className:
|
|
36
|
-
"data-testid":
|
|
36
|
+
className: o("flex shrink-0 basis-auto items-center", l),
|
|
37
|
+
"data-testid": s.root,
|
|
37
38
|
children: [
|
|
38
|
-
/* @__PURE__ */ m("span", { className:
|
|
39
|
-
|
|
39
|
+
/* @__PURE__ */ m("span", { className: o(h({ size: r })), children: [
|
|
40
|
+
i,
|
|
40
41
|
": ",
|
|
41
|
-
|
|
42
|
+
a && r === "sm" ? /* @__PURE__ */ t(f, { onClick: e, children: n }) : n
|
|
42
43
|
] }),
|
|
43
|
-
|
|
44
|
+
a && r !== "sm" && /* @__PURE__ */ t("div", { className: "ml-2", children: /* @__PURE__ */ t(
|
|
44
45
|
"button",
|
|
45
46
|
{
|
|
46
47
|
type: "button",
|
|
47
|
-
onClick:
|
|
48
|
-
"data-testid":
|
|
49
|
-
className:
|
|
48
|
+
onClick: e,
|
|
49
|
+
"data-testid": s.max,
|
|
50
|
+
className: o(
|
|
50
51
|
"rounded-[6px] border-0 py-[3px] px-1 text-[11px]! leading-[13px]!",
|
|
51
52
|
"text-center uppercase text-foreground",
|
|
52
53
|
"bg-gray-70 hover:bg-gray-90 transition-colors"
|
|
@@ -59,5 +60,5 @@ function V({
|
|
|
59
60
|
);
|
|
60
61
|
}
|
|
61
62
|
export {
|
|
62
|
-
|
|
63
|
+
A as BalanceIndicator
|
|
63
64
|
};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { cva as
|
|
3
|
-
import * as
|
|
4
|
-
import { CurrencyButton as
|
|
5
|
-
import { faXmark as
|
|
6
|
-
import { FaIcon as
|
|
7
|
-
import { useIsMobile as
|
|
8
|
-
import {
|
|
1
|
+
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { cva as m } from "class-variance-authority";
|
|
3
|
+
import * as v from "react";
|
|
4
|
+
import { CurrencyButton as G } from "../currency-button/currency-button.js";
|
|
5
|
+
import { faXmark as H } from "@fortawesome/free-solid-svg-icons";
|
|
6
|
+
import { FaIcon as J } from "../icons/fa-icon.js";
|
|
7
|
+
import { useIsMobile as K, useIsTablet as O, useIsDesktop as P } from "../../hooks/use-media-query.js";
|
|
8
|
+
import { smartNumberInputTestIds as n } from "../../test-ids/smart-number-input.js";
|
|
9
|
+
import { bnToInputView as Q } from "../../utils/bn-to-input-view.js";
|
|
9
10
|
import "@gearbox-protocol/sdk";
|
|
10
|
-
import { parseInputToBN as
|
|
11
|
-
import { cn as
|
|
11
|
+
import { parseInputToBN as U } from "../../utils/parse-input-to-bn.js";
|
|
12
|
+
import { cn as u } from "../../utils/cn.js";
|
|
12
13
|
import "sonner";
|
|
13
14
|
import "@gearbox-protocol/sdk/common-utils";
|
|
14
15
|
import "luxon";
|
|
15
16
|
import "../../utils/z-index.js";
|
|
16
|
-
import { BalanceIndicator as
|
|
17
|
-
const
|
|
17
|
+
import { BalanceIndicator as W } from "./balance-indicator.js";
|
|
18
|
+
const Y = m(
|
|
18
19
|
"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",
|
|
19
20
|
{
|
|
20
21
|
variants: {
|
|
@@ -25,7 +26,7 @@ const W = c(
|
|
|
25
26
|
},
|
|
26
27
|
defaultVariants: { size: "md" }
|
|
27
28
|
}
|
|
28
|
-
),
|
|
29
|
+
), Z = m("font-medium text-foreground", {
|
|
29
30
|
variants: {
|
|
30
31
|
size: {
|
|
31
32
|
sm: "text-xs",
|
|
@@ -33,7 +34,7 @@ const W = c(
|
|
|
33
34
|
}
|
|
34
35
|
},
|
|
35
36
|
defaultVariants: { size: "md" }
|
|
36
|
-
}),
|
|
37
|
+
}), _ = m(
|
|
37
38
|
"w-full p-0 bg-transparent border-none outline-none text-foreground placeholder:text-secondary-foreground focus:outline-none",
|
|
38
39
|
{
|
|
39
40
|
variants: {
|
|
@@ -44,93 +45,93 @@ const W = c(
|
|
|
44
45
|
},
|
|
45
46
|
defaultVariants: { size: "md" }
|
|
46
47
|
}
|
|
47
|
-
),
|
|
48
|
+
), A = v.forwardRef(
|
|
48
49
|
({
|
|
49
|
-
amount:
|
|
50
|
+
amount: y,
|
|
50
51
|
token: t,
|
|
51
|
-
label:
|
|
52
|
+
label: w = "Amount",
|
|
52
53
|
maxAmount: a,
|
|
53
|
-
maxAmountLimit:
|
|
54
|
-
maxButtonLabel:
|
|
55
|
-
chainId:
|
|
56
|
-
network:
|
|
54
|
+
maxAmountLimit: l,
|
|
55
|
+
maxButtonLabel: z,
|
|
56
|
+
chainId: N,
|
|
57
|
+
network: I,
|
|
57
58
|
maxButton: C = !0,
|
|
58
59
|
disabled: r = !1,
|
|
59
60
|
active: V = !1,
|
|
60
|
-
size:
|
|
61
|
+
size: B = "md",
|
|
61
62
|
onSetAmount: s,
|
|
62
|
-
onShowSelectDialog:
|
|
63
|
-
onRemove:
|
|
64
|
-
onFocus:
|
|
65
|
-
onBlur:
|
|
66
|
-
},
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
},
|
|
63
|
+
onShowSelectDialog: p,
|
|
64
|
+
onRemove: f,
|
|
65
|
+
onFocus: k,
|
|
66
|
+
onBlur: M
|
|
67
|
+
}, j) => {
|
|
68
|
+
const h = t?.decimals ?? 18, F = (i) => {
|
|
69
|
+
const d = i.target.value, [x, b] = U(d, h);
|
|
70
|
+
x === null || b === null || s && s(x, b);
|
|
71
|
+
}, L = () => {
|
|
71
72
|
if (s) {
|
|
72
|
-
const
|
|
73
|
-
s(
|
|
73
|
+
const i = a && l && a > l ? l : a || 0n, d = Q(i, h);
|
|
74
|
+
s(i, d);
|
|
74
75
|
}
|
|
75
|
-
}, [
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
return /* @__PURE__ */
|
|
76
|
+
}, [T, g] = v.useState(!1), D = () => {
|
|
77
|
+
g(!0), k?.();
|
|
78
|
+
}, R = () => {
|
|
79
|
+
g(!1), M?.();
|
|
80
|
+
}, o = B ?? "md", S = K(), X = O(), $ = P(), q = S ? 20 : X ? 30 : $ ? 22 : 30, E = !!(t || p);
|
|
81
|
+
return /* @__PURE__ */ c(
|
|
81
82
|
"div",
|
|
82
83
|
{
|
|
83
|
-
ref:
|
|
84
|
-
className:
|
|
85
|
-
"data-testid":
|
|
86
|
-
"data-active":
|
|
84
|
+
ref: j,
|
|
85
|
+
className: Y({ size: o }),
|
|
86
|
+
"data-testid": n.root,
|
|
87
|
+
"data-active": T,
|
|
87
88
|
"data-disabled": r,
|
|
88
89
|
children: [
|
|
89
|
-
|
|
90
|
+
f && /* @__PURE__ */ e(
|
|
90
91
|
"div",
|
|
91
92
|
{
|
|
92
93
|
className: "absolute top-0 right-0 flex h-5 w-5 translate-x-1/2 -translate-y-1/2 items-center justify-center",
|
|
93
|
-
"data-testid":
|
|
94
|
+
"data-testid": n.close,
|
|
94
95
|
children: /* @__PURE__ */ e(
|
|
95
96
|
"button",
|
|
96
97
|
{
|
|
97
98
|
type: "button",
|
|
98
|
-
onClick:
|
|
99
|
+
onClick: f,
|
|
99
100
|
className: "flex h-5 w-5 items-center justify-center rounded-full bg-muted hover:bg-muted/80 text-muted-foreground",
|
|
100
|
-
children: /* @__PURE__ */ e(
|
|
101
|
+
children: /* @__PURE__ */ e(J, { icon: H, className: "size-3" })
|
|
101
102
|
}
|
|
102
103
|
)
|
|
103
104
|
}
|
|
104
105
|
),
|
|
105
|
-
/* @__PURE__ */
|
|
106
|
+
/* @__PURE__ */ c("div", { className: "mb-2 flex justify-between text-sm leading-[120%]", children: [
|
|
106
107
|
/* @__PURE__ */ e(
|
|
107
108
|
"span",
|
|
108
109
|
{
|
|
109
|
-
className:
|
|
110
|
-
|
|
110
|
+
className: u(
|
|
111
|
+
Z({ size: o }),
|
|
111
112
|
"grow shrink-0 basis-0"
|
|
112
113
|
),
|
|
113
|
-
"data-testid":
|
|
114
|
-
children:
|
|
114
|
+
"data-testid": n.label,
|
|
115
|
+
children: w
|
|
115
116
|
}
|
|
116
117
|
),
|
|
117
118
|
a !== void 0 && t && /* @__PURE__ */ e(
|
|
118
|
-
|
|
119
|
+
W,
|
|
119
120
|
{
|
|
120
|
-
title:
|
|
121
|
+
title: z,
|
|
121
122
|
token: t,
|
|
122
123
|
maxAmount: a,
|
|
123
|
-
size:
|
|
124
|
+
size: o,
|
|
124
125
|
disabled: r,
|
|
125
126
|
maxButton: C,
|
|
126
|
-
onMaxButtonClick:
|
|
127
|
+
onMaxButtonClick: L
|
|
127
128
|
}
|
|
128
129
|
)
|
|
129
130
|
] }),
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
+
/* @__PURE__ */ c(
|
|
131
132
|
"div",
|
|
132
133
|
{
|
|
133
|
-
className:
|
|
134
|
+
className: u(
|
|
134
135
|
"flex w-full max-w-full shrink-0 basis-full items-center"
|
|
135
136
|
),
|
|
136
137
|
children: [
|
|
@@ -144,32 +145,32 @@ const W = c(
|
|
|
144
145
|
spellCheck: "false",
|
|
145
146
|
pattern: "^[0-9]*[.,]?[0-9]*$",
|
|
146
147
|
placeholder: "0",
|
|
147
|
-
value:
|
|
148
|
-
onChange:
|
|
149
|
-
onFocus:
|
|
150
|
-
onBlur:
|
|
148
|
+
value: y,
|
|
149
|
+
onChange: F,
|
|
150
|
+
onFocus: D,
|
|
151
|
+
onBlur: R,
|
|
151
152
|
disabled: r || !s,
|
|
152
|
-
className:
|
|
153
|
-
|
|
153
|
+
className: u(
|
|
154
|
+
_({ size: o }),
|
|
154
155
|
r && "cursor-not-allowed"
|
|
155
156
|
),
|
|
156
|
-
"data-testid":
|
|
157
|
+
"data-testid": n.input,
|
|
157
158
|
minLength: 1,
|
|
158
159
|
maxLength: 79,
|
|
159
160
|
title: "Amount"
|
|
160
161
|
}
|
|
161
162
|
) }),
|
|
162
|
-
|
|
163
|
-
|
|
163
|
+
E ? /* @__PURE__ */ e(
|
|
164
|
+
G,
|
|
164
165
|
{
|
|
165
166
|
active: V,
|
|
166
|
-
size:
|
|
167
|
+
size: o,
|
|
167
168
|
disabled: r,
|
|
168
169
|
token: t,
|
|
169
|
-
showSelectDialog:
|
|
170
|
-
chainId:
|
|
171
|
-
network:
|
|
172
|
-
maxLength:
|
|
170
|
+
showSelectDialog: p,
|
|
171
|
+
chainId: N,
|
|
172
|
+
network: I,
|
|
173
|
+
maxLength: q,
|
|
173
174
|
children: t?.symbol ?? "Select token"
|
|
174
175
|
}
|
|
175
176
|
) : null
|
|
@@ -181,7 +182,7 @@ const W = c(
|
|
|
181
182
|
);
|
|
182
183
|
}
|
|
183
184
|
);
|
|
184
|
-
|
|
185
|
+
A.displayName = "SmartNumberInput";
|
|
185
186
|
export {
|
|
186
|
-
|
|
187
|
+
A as SmartNumberInput
|
|
187
188
|
};
|