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