@gearbox-protocol/ui-kit 3.13.1 → 3.14.0-next.10

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 (30) hide show
  1. package/dist/cjs/components/buttons/button/button.cjs +1 -1
  2. package/dist/cjs/components/client-adapters/styled-button/styled-button.cjs +1 -1
  3. package/dist/cjs/components/composites/strategies-table/components/rewards-tooltip/tooltip-content.cjs +1 -1
  4. package/dist/cjs/components/graph/formatters.cjs +1 -1
  5. package/dist/cjs/components/graph/graph.cjs +1 -1
  6. package/dist/cjs/components/layout/main-aside-layout/main-aside-layout.cjs +1 -1
  7. package/dist/cjs/components/smart-number-input/smart-number-input.cjs +1 -1
  8. package/dist/cjs/components/trading-view/trading-view.cjs +1 -1
  9. package/dist/cjs/locale/en.json.cjs +1 -1
  10. package/dist/esm/components/buttons/button/button.js +1 -0
  11. package/dist/esm/components/client-adapters/styled-button/styled-button.js +11 -11
  12. package/dist/esm/components/composites/strategies-table/components/rewards-tooltip/tooltip-content.js +131 -122
  13. package/dist/esm/components/graph/formatters.js +127 -132
  14. package/dist/esm/components/graph/graph.js +339 -293
  15. package/dist/esm/components/health-factor/health-factor.js +3 -3
  16. package/dist/esm/components/layout/main-aside-layout/main-aside-layout.js +104 -21
  17. package/dist/esm/components/smart-number-input/smart-number-input.js +253 -104
  18. package/dist/esm/components/trading-view/trading-view.js +58 -58
  19. package/dist/esm/locale/en.json.js +2 -0
  20. package/dist/globals.css +1 -1
  21. package/dist/types/components/buttons/button/button.d.ts +4 -3
  22. package/dist/types/components/graph/graph.d.ts +8 -1
  23. package/dist/types/components/help-tip/help-tip.d.ts +2 -2
  24. package/dist/types/components/layout/main-aside-layout/main-aside-layout.d.ts +80 -5
  25. package/dist/types/components/smart-number-input/smart-number-input.d.ts +52 -0
  26. package/dist/types/components/tip-card/tip-card.d.ts +1 -1
  27. package/dist/types/components/trading-view/trading-view.d.ts +7 -0
  28. package/dist/types/locale/en.json.d.ts +2 -0
  29. package/package.json +3 -3
  30. package/src/styles/base.css +4 -2
@@ -1,5 +1,5 @@
1
1
  import { jsxs as f, jsx as c } from "react/jsx-runtime";
2
- import { PERCENTAGE_FACTOR as p, formatPercentage as v } from "@gearbox-protocol/sdk";
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 > p ? "critical" : "liquidation";
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 v(l, a);
41
+ return p(l, a);
42
42
  };
43
43
  return /* @__PURE__ */ f(
44
44
  "span",
@@ -1,35 +1,118 @@
1
- import { jsx as s, jsxs as f } from "react/jsx-runtime";
2
- import * as c from "react";
1
+ import { jsx as m, jsxs as d } from "react/jsx-runtime";
2
+ import * as h from "react";
3
3
  import { cn as a } from "../../../utils/cn.js";
4
- const d = c.forwardRef(
4
+ const y = h.forwardRef(
5
5
  ({
6
- children: i,
7
- aside: e,
8
- asidePosition: l = "right",
9
- asideClassName: t,
10
- className: m,
11
- ...o
12
- }, n) => {
13
- const r = e == null ? null : /* @__PURE__ */ s("aside", { className: a("min-w-0 shrink-0", t), children: e });
14
- return /* @__PURE__ */ f(
6
+ children: t,
7
+ aside: i,
8
+ asidePosition: x = "right",
9
+ asideClassName: w,
10
+ mainClassName: o,
11
+ mainRef: c,
12
+ variant: f = "default",
13
+ centeredMain: s = !1,
14
+ className: g,
15
+ ...u
16
+ }, v) => {
17
+ const e = f === "detail", r = x === "left", l = e && s, p = i == null ? null : /* @__PURE__ */ m(
18
+ "aside",
19
+ {
20
+ className: a(
21
+ "min-w-0 shrink-0",
22
+ e && !l && [
23
+ "w-full",
24
+ "z-30 lg:w-[420px] lg:min-w-[420px] lg:max-w-[420px]",
25
+ "xl:w-[460px] xl:min-w-[460px] xl:max-w-[460px]",
26
+ "max-h-full lg:max-h-[100vh] overflow-y-visible lg:overflow-y-auto",
27
+ // sticky below 2450px, fixed at ≥2450px
28
+ "lg:max-[2449px]:sticky lg:max-[2449px]:top-4",
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
+ ],
41
+ w
42
+ ),
43
+ children: i
44
+ }
45
+ ), n = l ? /* @__PURE__ */ m(
46
+ "div",
47
+ {
48
+ "aria-hidden": !0,
49
+ className: "hidden shrink-0 min-[1800px]:block min-[1800px]:w-[8rem]"
50
+ }
51
+ ) : null;
52
+ return /* @__PURE__ */ d(
15
53
  "div",
16
54
  {
17
- ref: n,
55
+ ref: v,
18
56
  className: a(
19
- "flex w-full flex-col-reverse gap-6 lg:flex-row lg:items-start",
20
- m
57
+ // base: mobile stack (column-reverse), desktop row
58
+ "flex w-full flex-col-reverse gap-6 lg:items-start",
59
+ !l && "lg:flex-row",
60
+ e && !l && [
61
+ "relative mx-auto min-w-0",
62
+ // cap width so aside doesn't overflow on medium-wide screens
63
+ "max-w-[calc(80rem+420px+1.5rem)]",
64
+ "xl:max-w-[calc(80rem+460px+1.5rem)]",
65
+ // at ≥2450px aside is fixed → switch wrapper to block so main can
66
+ // centre independently
67
+ "min-[2450px]:block min-[2450px]:max-w-none min-[2450px]:gap-0"
68
+ ],
69
+ // centred-main (hybrid): below 1800px behave like the LP detail row
70
+ // (aside in flow, main fills the rest, wrapper capped + centred as a
71
+ // unit). At ≥1800px the wrapper spans the full width and centres the
72
+ // aside + main + mirror-spacer group, so the main column is optically
73
+ // centred on the viewport while still scaling up to 80rem.
74
+ l && [
75
+ "relative mx-auto min-w-0 lg:flex-row",
76
+ "max-w-[calc(80rem+420px+1.5rem)] xl:max-w-[calc(80rem+460px+1.5rem)]",
77
+ "min-[1800px]:max-w-none min-[1800px]:justify-center"
78
+ ],
79
+ g
21
80
  ),
22
- ...o,
81
+ ...u,
23
82
  children: [
24
- l === "left" && r,
25
- /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: i }),
26
- l === "right" && r
83
+ x === "left" && p,
84
+ x === "right" && n,
85
+ /* @__PURE__ */ m(
86
+ "div",
87
+ {
88
+ ref: c,
89
+ className: a(
90
+ "min-w-0",
91
+ !l && "flex-1",
92
+ e && !l && [
93
+ "relative z-0 w-full",
94
+ // at ≥2450px: stop growing and centre with explicit max-width
95
+ // (leaves room for the fixed 460px aside + 8rem inset offset)
96
+ "min-[2450px]:mx-auto min-[2450px]:flex-none",
97
+ "min-[2450px]:max-w-[min(80rem,calc(100vw-460px-8rem))]",
98
+ // when aside is on the left, push main column off the fixed aside
99
+ r && "min-[2450px]:ml-[calc(460px+8rem)]"
100
+ ],
101
+ // centred-main: fill the available row width, capped at 96rem
102
+ l && "relative z-0 w-full flex-1 lg:max-w-[96rem]",
103
+ o
104
+ ),
105
+ children: t
106
+ }
107
+ ),
108
+ x === "left" && n,
109
+ x === "right" && p
27
110
  ]
28
111
  }
29
112
  );
30
113
  }
31
114
  );
32
- d.displayName = "MainAsideLayout";
115
+ y.displayName = "MainAsideLayout";
33
116
  export {
34
- d as MainAsideLayout
117
+ y as MainAsideLayout
35
118
  };
@@ -1,32 +1,39 @@
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";
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 U } from "../../utils/parse-input-to-bn.js";
12
- import { cn as u } from "../../utils/cn.js";
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 W } from "./balance-indicator.js";
18
- const Y = m(
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
- ), Z = m("font-medium text-foreground", {
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
- }), _ = m(
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
- ), A = v.forwardRef(
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: y,
51
- token: t,
52
- label: w = "Amount",
53
- maxAmount: a,
54
- maxAmountLimit: l,
55
- maxButtonLabel: z,
56
- chainId: N,
57
- network: I,
58
- maxButton: C = !0,
59
- disabled: r = !1,
60
- active: V = !1,
61
- size: B = "md",
62
- onSetAmount: s,
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 = () => {
72
- if (s) {
73
- const i = a && l && a > l ? l : a || 0n, d = Q(i, h);
74
- s(i, d);
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
- }, [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(
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: j,
85
- className: Y({ size: o }),
86
- "data-testid": n.root,
87
- "data-active": T,
88
- "data-disabled": r,
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
- f && /* @__PURE__ */ e(
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": n.close,
95
- children: /* @__PURE__ */ e(
153
+ "data-testid": w.close,
154
+ children: /* @__PURE__ */ t(
96
155
  "button",
97
156
  {
98
157
  type: "button",
99
- onClick: f,
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__ */ e(J, { icon: H, className: "size-3" })
160
+ children: /* @__PURE__ */ t(he, { icon: pe, className: "size-3" })
102
161
  }
103
162
  )
104
163
  }
105
164
  ),
106
- /* @__PURE__ */ c("div", { className: "mb-2 flex justify-between text-sm leading-[120%]", children: [
107
- /* @__PURE__ */ e(
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: u(
111
- Z({ size: o }),
169
+ className: y(
170
+ ke({ size: h }),
112
171
  "grow shrink-0 basis-0"
113
172
  ),
114
- "data-testid": n.label,
115
- children: w
173
+ "data-testid": w.label,
174
+ children: f ?? /* @__PURE__ */ t(B, { messageId: "components.smartNumberInput.amountLabel" })
116
175
  }
117
176
  ),
118
- a !== void 0 && t && /* @__PURE__ */ e(
119
- W,
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: z,
122
- token: t,
123
- maxAmount: a,
124
- size: o,
125
- disabled: r,
126
- maxButton: C,
127
- onMaxButtonClick: L
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__ */ c(
213
+ /* @__PURE__ */ l(
132
214
  "div",
133
215
  {
134
- className: u(
216
+ className: y(
135
217
  "flex w-full max-w-full shrink-0 basis-full items-center"
136
218
  ),
137
219
  children: [
138
- /* @__PURE__ */ e("div", { className: "mr-3 grow shrink-0 basis-0", children: /* @__PURE__ */ e(
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: y,
149
- onChange: F,
150
- onFocus: D,
151
- onBlur: R,
152
- disabled: r || !s,
153
- className: u(
154
- _({ size: o }),
155
- r && "cursor-not-allowed"
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": n.input,
239
+ "data-testid": w.input,
158
240
  minLength: 1,
159
241
  maxLength: 79,
160
- title: "Amount"
242
+ title: P({
243
+ messageId: "components.smartNumberInput.inputTitle"
244
+ })
161
245
  }
162
246
  ) }),
163
- E ? /* @__PURE__ */ e(
164
- G,
165
- {
166
- active: V,
167
- size: o,
168
- disabled: r,
169
- token: t,
170
- showSelectDialog: p,
171
- chainId: N,
172
- network: I,
173
- maxLength: q,
174
- children: t?.symbol ?? "Select token"
175
- }
176
- ) : null
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
- A.displayName = "SmartNumberInput";
334
+ Le.displayName = "SmartNumberInput";
186
335
  export {
187
- A as SmartNumberInput
336
+ Le as SmartNumberInput
188
337
  };