@gearbox-protocol/ui-kit 3.14.0-next.2 → 3.14.0-next.4

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),f=require("class-variance-authority"),X=require("react"),$=require("../currency-button/currency-button.cjs"),E=require("@fortawesome/free-solid-svg-icons"),G=require("../icons/fa-icon.cjs"),m=require("../../hooks/use-media-query.cjs"),c=require("../../test-ids/smart-number-input.cjs"),H=require("../../utils/bn-to-input-view.cjs");require("@gearbox-protocol/sdk");const J=require("../../utils/parse-input-to-bn.cjs"),p=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../utils/z-index.cjs");const K=require("./balance-indicator.cjs");function U(s){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const a in s)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:()=>s[a]})}}return t.default=s,Object.freeze(t)}const I=U(X),W=f.cva("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",{variants:{size:{sm:"px-3 py-[7px] h-[60px] rounded-[8px]",md:"pl-4 pr-3 py-[10px] h-[82px] rounded-lg"}},defaultVariants:{size:"md"}}),Y=f.cva("font-medium text-foreground",{variants:{size:{sm:"text-xs",md:"text-sm"}},defaultVariants:{size:"md"}}),Z=f.cva("w-full p-0 bg-transparent border-none outline-none text-foreground placeholder:text-secondary-foreground focus:outline-none",{variants:{size:{sm:"text-[18px]! leading-[21px]!",md:"text-[28px]! leading-[33px]!"}},defaultVariants:{size:"md"}}),N=I.forwardRef(({amount:s,token:t,label:a="Amount",maxAmount:r,maxAmountLimit:l,maxButtonLabel:j,chainId:w,network:q,maxButton:z=!0,disabled:n=!1,active:_=!1,size:V="md",onSetAmount:o,onShowSelectDialog:b,onRemove:x,onFocus:B,onBlur:T},C)=>{const g=t?.decimals??18,M=u=>{const d=u.target.value,[y,v]=J.parseInputToBN(d,g);y===null||v===null||o&&o(y,v)},k=()=>{if(o){const u=r&&l&&r>l?l:r||0n,d=H.bnToInputView(u,g);o(u,d)}},[S,h]=I.useState(!1),O=()=>{h(!0),B?.()},F=()=>{h(!1),T?.()},i=V??"md",L=m.useIsMobile(),D=m.useIsTablet(),P=m.useIsDesktop(),R=L?20:D?30:P?22:30,Q=!!(t||b);return e.jsxs("div",{ref:C,className:W({size:i}),"data-testid":c.smartNumberInputTestIds.root,"data-active":S,"data-disabled":n,children:[x&&e.jsx("div",{className:"absolute top-0 right-0 flex h-5 w-5 translate-x-1/2 -translate-y-1/2 items-center justify-center","data-testid":c.smartNumberInputTestIds.close,children:e.jsx("button",{type:"button",onClick:x,className:"flex h-5 w-5 items-center justify-center rounded-full bg-muted hover:bg-muted/80 text-muted-foreground",children:e.jsx(G.FaIcon,{icon:E.faXmark,className:"size-3"})})}),e.jsxs("div",{className:"mb-2 flex justify-between text-sm leading-[120%]",children:[e.jsx("span",{className:p.cn(Y({size:i}),"grow shrink-0 basis-0"),"data-testid":c.smartNumberInputTestIds.label,children:a}),r!==void 0&&t&&e.jsx(K.BalanceIndicator,{title:j,token:t,maxAmount:r,size:i,disabled:n,maxButton:z,onMaxButtonClick:k})]}),e.jsxs("div",{className:p.cn("flex w-full max-w-full shrink-0 basis-full items-center"),children:[e.jsx("div",{className:"mr-3 grow shrink-0 basis-0",children:e.jsx("input",{type:"text",inputMode:"decimal",autoComplete:"off",autoCorrect:"off",spellCheck:"false",pattern:"^[0-9]*[.,]?[0-9]*$",placeholder:"0",value:s,onChange:M,onFocus:O,onBlur:F,disabled:n||!o,className:p.cn(Z({size:i}),n&&"cursor-not-allowed"),"data-testid":c.smartNumberInputTestIds.input,minLength:1,maxLength:79,title:"Amount"})}),Q?e.jsx($.CurrencyButton,{active:_,size:i,disabled:n,token:t,showSelectDialog:b,chainId:w,network:q,maxLength:R,children:t?.symbol??"Select token"}):null]})]})});N.displayName="SmartNumberInput";exports.SmartNumberInput=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),I=require("class-variance-authority"),A=require("react"),ee=require("react-dom"),te=require("../currency-button/currency-button.cjs"),ne=require("@fortawesome/free-solid-svg-icons"),re=require("../icons/fa-icon.cjs"),y=require("../../hooks/use-media-query.cjs"),h=require("../../test-ids/smart-number-input.cjs"),se=require("../../utils/bn-to-input-view.cjs");require("@gearbox-protocol/sdk");const ae=require("../../utils/parse-input-to-bn.cjs"),w=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../utils/z-index.cjs");const oe=require("./balance-indicator.cjs");function ie(o){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const i in o)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(o,i);Object.defineProperty(r,i,s.get?s:{enumerable:!0,get:()=>o[i]})}}return r.default=o,Object.freeze(r)}const a=ie(A),ce=I.cva("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",{variants:{size:{sm:"px-3 py-[7px] h-[60px] rounded-[8px]",md:"pl-4 pr-3 py-[10px] h-[82px] rounded-lg"}},defaultVariants:{size:"md"}}),ue=I.cva("font-medium text-foreground",{variants:{size:{sm:"text-xs",md:"text-sm"}},defaultVariants:{size:"md"}}),le=I.cva("w-full p-0 bg-transparent border-none outline-none text-foreground placeholder:text-secondary-foreground focus:outline-none",{variants:{size:{sm:"text-[18px]! leading-[21px]!",md:"text-[28px]! leading-[33px]!"}},defaultVariants:{size:"md"}}),_=a.forwardRef(({amount:o,token:r,label:i="Amount",maxAmount:s,maxAmountLimit:x,maxButtonLabel:k,chainId:B,network:L,maxButton:M=!0,disabled:c=!1,active:S=!1,size:T="md",symbolMaxLength:V,tokenOptions:b,onSetAmount:l,onShowSelectDialog:N,onRemove:j,onFocus:E,onBlur:R},O)=>{const q=r?.decimals??18,D=e=>{const n=e.target.value,[m,g]=ae.parseInputToBN(n,q);m===null||g===null||l&&l(m,g)},F=()=>{if(l){const e=s&&x&&s>x?x:s||0n,n=se.bnToInputView(e,q);l(e,n)}},[P,z]=a.useState(!1),W=()=>{z(!0),E?.()},Q=()=>{z(!1),R?.()},d=T??"md",X=y.useIsMobile(),$=y.useIsTablet(),G=y.useIsDesktop(),H=V??(X?20:$?30:G?22:30),[u,v]=a.useState(!1),f=a.useRef(null),C=a.useRef(null),[J,K]=a.useState({});a.useLayoutEffect(()=>{if(!u||!f.current)return;const e=()=>{const n=f.current?.getBoundingClientRect();n&&K({position:"fixed",top:n.bottom+4,right:window.innerWidth-n.right,minWidth:n.width,zIndex:9999})};return e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[u]),a.useEffect(()=>{if(!u)return;const e=n=>{const m=n.target,g=f.current?.contains(m),Z=C.current?.contains(m);!g&&!Z&&v(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[u]);const p=!!(b&&b.length>0),U=!c&&p?()=>v(e=>!e):N,Y=!!(r||N||p);return t.jsxs("div",{ref:O,className:ce({size:d}),"data-testid":h.smartNumberInputTestIds.root,"data-active":P,"data-disabled":c,children:[j&&t.jsx("div",{className:"absolute top-0 right-0 flex h-5 w-5 translate-x-1/2 -translate-y-1/2 items-center justify-center","data-testid":h.smartNumberInputTestIds.close,children:t.jsx("button",{type:"button",onClick:j,className:"flex h-5 w-5 items-center justify-center rounded-full bg-muted hover:bg-muted/80 text-muted-foreground",children:t.jsx(re.FaIcon,{icon:ne.faXmark,className:"size-3"})})}),t.jsxs("div",{className:"mb-2 flex justify-between text-sm leading-[120%]",children:[t.jsx("span",{className:w.cn(ue({size:d}),"grow shrink-0 basis-0"),"data-testid":h.smartNumberInputTestIds.label,children:i}),s!==void 0&&r&&t.jsx(oe.BalanceIndicator,{title:k,token:r,maxAmount:s,size:d,disabled:c,maxButton:M,onMaxButtonClick:F})]}),t.jsxs("div",{className:w.cn("flex w-full max-w-full shrink-0 basis-full items-center"),children:[t.jsx("div",{className:"mr-3 grow shrink-0 basis-0",children:t.jsx("input",{type:"text",inputMode:"decimal",autoComplete:"off",autoCorrect:"off",spellCheck:"false",pattern:"^[0-9]*[.,]?[0-9]*$",placeholder:"0",value:o,onChange:D,onFocus:W,onBlur:Q,disabled:c||!l,className:w.cn(le({size:d}),c&&"cursor-not-allowed"),"data-testid":h.smartNumberInputTestIds.input,minLength:1,maxLength:79,title:"Amount"})}),Y?t.jsxs("div",{ref:f,className:"shrink-0",children:[t.jsx(te.CurrencyButton,{active:p?u:S,size:d,disabled:c,token:r,showSelectDialog:U,chainId:B,network:L,maxLength:H,children:r?.symbol??"Select token"}),p&&u&&ee.createPortal(t.jsx("div",{ref:C,style:J,className:"overflow-hidden rounded-lg border border-gray-30 bg-gray-20 shadow-lg",children:b?.map((e,n)=>t.jsxs("button",{type:"button",onClick:()=>{e.onSelect(),v(!1)},className:"flex w-full items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-gray-30 text-left",children:[e.icon?t.jsx("span",{className:"inline-flex shrink-0 items-center",children:e.icon}):null,t.jsx("span",{className:"truncate",children:e.label})]},n))}),document.body)]}):null]})]})});_.displayName="SmartNumberInput";exports.SmartNumberInput=_;
@@ -1,21 +1,22 @@
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 u, jsx as r } from "react/jsx-runtime";
2
+ import { cva as b } from "class-variance-authority";
3
+ import * as n from "react";
4
+ import { createPortal as _ } from "react-dom";
5
+ import { CurrencyButton as A } from "../currency-button/currency-button.js";
6
+ import { faXmark as ee } from "@fortawesome/free-solid-svg-icons";
7
+ import { FaIcon as te } from "../icons/fa-icon.js";
8
+ import { useIsMobile as re, useIsTablet as ne, useIsDesktop as se } from "../../hooks/use-media-query.js";
9
+ import { smartNumberInputTestIds as h } from "../../test-ids/smart-number-input.js";
10
+ import { bnToInputView as oe } from "../../utils/bn-to-input-view.js";
10
11
  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";
12
+ import { parseInputToBN as ae } from "../../utils/parse-input-to-bn.js";
13
+ import { cn as w } from "../../utils/cn.js";
13
14
  import "sonner";
14
15
  import "@gearbox-protocol/sdk/common-utils";
15
16
  import "luxon";
16
17
  import "../../utils/z-index.js";
17
- import { BalanceIndicator as W } from "./balance-indicator.js";
18
- const Y = m(
18
+ import { BalanceIndicator as ie } from "./balance-indicator.js";
19
+ const le = b(
19
20
  "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
21
  {
21
22
  variants: {
@@ -26,7 +27,7 @@ const Y = m(
26
27
  },
27
28
  defaultVariants: { size: "md" }
28
29
  }
29
- ), Z = m("font-medium text-foreground", {
30
+ ), ce = b("font-medium text-foreground", {
30
31
  variants: {
31
32
  size: {
32
33
  sm: "text-xs",
@@ -34,7 +35,7 @@ const Y = m(
34
35
  }
35
36
  },
36
37
  defaultVariants: { size: "md" }
37
- }), _ = m(
38
+ }), de = b(
38
39
  "w-full p-0 bg-transparent border-none outline-none text-foreground placeholder:text-secondary-foreground focus:outline-none",
39
40
  {
40
41
  variants: {
@@ -45,97 +46,123 @@ const Y = m(
45
46
  },
46
47
  defaultVariants: { size: "md" }
47
48
  }
48
- ), A = v.forwardRef(
49
+ ), ue = n.forwardRef(
49
50
  ({
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);
51
+ amount: I,
52
+ token: s,
53
+ label: k = "Amount",
54
+ maxAmount: i,
55
+ maxAmountLimit: g,
56
+ maxButtonLabel: B,
57
+ chainId: M,
58
+ network: V,
59
+ maxButton: E = !0,
60
+ disabled: o = !1,
61
+ active: R = !1,
62
+ size: S = "md",
63
+ symbolMaxLength: T,
64
+ tokenOptions: x,
65
+ onSetAmount: l,
66
+ onShowSelectDialog: y,
67
+ onRemove: N,
68
+ onFocus: j,
69
+ onBlur: F
70
+ }, D) => {
71
+ const z = s?.decimals ?? 18, W = (e) => {
72
+ const t = e.target.value, [d, p] = ae(t, z);
73
+ d === null || p === null || l && l(d, p);
74
+ }, O = () => {
75
+ if (l) {
76
+ const e = i && g && i > g ? g : i || 0n, t = oe(e, z);
77
+ l(e, t);
75
78
  }
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(
79
+ }, [P, C] = n.useState(!1), X = () => {
80
+ C(!0), j?.();
81
+ }, $ = () => {
82
+ C(!1), F?.();
83
+ }, c = S ?? "md", q = re(), G = ne(), H = se(), J = T ?? (q ? 20 : G ? 30 : H ? 22 : 30), [a, v] = n.useState(!1), m = n.useRef(null), L = n.useRef(null), [K, Q] = n.useState({});
84
+ n.useLayoutEffect(() => {
85
+ if (!a || !m.current) return;
86
+ const e = () => {
87
+ const t = m.current?.getBoundingClientRect();
88
+ t && Q({
89
+ position: "fixed",
90
+ top: t.bottom + 4,
91
+ right: window.innerWidth - t.right,
92
+ minWidth: t.width,
93
+ zIndex: 9999
94
+ });
95
+ };
96
+ return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
97
+ window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
98
+ };
99
+ }, [a]), n.useEffect(() => {
100
+ if (!a) return;
101
+ const e = (t) => {
102
+ const d = t.target, p = m.current?.contains(d), Z = L.current?.contains(d);
103
+ !p && !Z && v(!1);
104
+ };
105
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
106
+ }, [a]);
107
+ const f = !!(x && x.length > 0), U = !o && f ? () => v((e) => !e) : y, Y = !!(s || y || f);
108
+ return /* @__PURE__ */ u(
82
109
  "div",
83
110
  {
84
- ref: j,
85
- className: Y({ size: o }),
86
- "data-testid": n.root,
87
- "data-active": T,
88
- "data-disabled": r,
111
+ ref: D,
112
+ className: le({ size: c }),
113
+ "data-testid": h.root,
114
+ "data-active": P,
115
+ "data-disabled": o,
89
116
  children: [
90
- f && /* @__PURE__ */ e(
117
+ N && /* @__PURE__ */ r(
91
118
  "div",
92
119
  {
93
120
  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(
121
+ "data-testid": h.close,
122
+ children: /* @__PURE__ */ r(
96
123
  "button",
97
124
  {
98
125
  type: "button",
99
- onClick: f,
126
+ onClick: N,
100
127
  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" })
128
+ children: /* @__PURE__ */ r(te, { icon: ee, className: "size-3" })
102
129
  }
103
130
  )
104
131
  }
105
132
  ),
106
- /* @__PURE__ */ c("div", { className: "mb-2 flex justify-between text-sm leading-[120%]", children: [
107
- /* @__PURE__ */ e(
133
+ /* @__PURE__ */ u("div", { className: "mb-2 flex justify-between text-sm leading-[120%]", children: [
134
+ /* @__PURE__ */ r(
108
135
  "span",
109
136
  {
110
- className: u(
111
- Z({ size: o }),
137
+ className: w(
138
+ ce({ size: c }),
112
139
  "grow shrink-0 basis-0"
113
140
  ),
114
- "data-testid": n.label,
115
- children: w
141
+ "data-testid": h.label,
142
+ children: k
116
143
  }
117
144
  ),
118
- a !== void 0 && t && /* @__PURE__ */ e(
119
- W,
145
+ i !== void 0 && s && /* @__PURE__ */ r(
146
+ ie,
120
147
  {
121
- title: z,
122
- token: t,
123
- maxAmount: a,
124
- size: o,
125
- disabled: r,
126
- maxButton: C,
127
- onMaxButtonClick: L
148
+ title: B,
149
+ token: s,
150
+ maxAmount: i,
151
+ size: c,
152
+ disabled: o,
153
+ maxButton: E,
154
+ onMaxButtonClick: O
128
155
  }
129
156
  )
130
157
  ] }),
131
- /* @__PURE__ */ c(
158
+ /* @__PURE__ */ u(
132
159
  "div",
133
160
  {
134
- className: u(
161
+ className: w(
135
162
  "flex w-full max-w-full shrink-0 basis-full items-center"
136
163
  ),
137
164
  children: [
138
- /* @__PURE__ */ e("div", { className: "mr-3 grow shrink-0 basis-0", children: /* @__PURE__ */ e(
165
+ /* @__PURE__ */ r("div", { className: "mr-3 grow shrink-0 basis-0", children: /* @__PURE__ */ r(
139
166
  "input",
140
167
  {
141
168
  type: "text",
@@ -145,35 +172,63 @@ const Y = m(
145
172
  spellCheck: "false",
146
173
  pattern: "^[0-9]*[.,]?[0-9]*$",
147
174
  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"
175
+ value: I,
176
+ onChange: W,
177
+ onFocus: X,
178
+ onBlur: $,
179
+ disabled: o || !l,
180
+ className: w(
181
+ de({ size: c }),
182
+ o && "cursor-not-allowed"
156
183
  ),
157
- "data-testid": n.input,
184
+ "data-testid": h.input,
158
185
  minLength: 1,
159
186
  maxLength: 79,
160
187
  title: "Amount"
161
188
  }
162
189
  ) }),
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
190
+ Y ? /* @__PURE__ */ u("div", { ref: m, className: "shrink-0", children: [
191
+ /* @__PURE__ */ r(
192
+ A,
193
+ {
194
+ active: f ? a : R,
195
+ size: c,
196
+ disabled: o,
197
+ token: s,
198
+ showSelectDialog: U,
199
+ chainId: M,
200
+ network: V,
201
+ maxLength: J,
202
+ children: s?.symbol ?? "Select token"
203
+ }
204
+ ),
205
+ f && a && _(
206
+ /* @__PURE__ */ r(
207
+ "div",
208
+ {
209
+ ref: L,
210
+ style: K,
211
+ className: "overflow-hidden rounded-lg border border-gray-30 bg-gray-20 shadow-lg",
212
+ children: x?.map((e, t) => /* @__PURE__ */ u(
213
+ "button",
214
+ {
215
+ type: "button",
216
+ onClick: () => {
217
+ e.onSelect(), v(!1);
218
+ },
219
+ className: "flex w-full items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-gray-30 text-left",
220
+ children: [
221
+ e.icon ? /* @__PURE__ */ r("span", { className: "inline-flex shrink-0 items-center", children: e.icon }) : null,
222
+ /* @__PURE__ */ r("span", { className: "truncate", children: e.label })
223
+ ]
224
+ },
225
+ t
226
+ ))
227
+ }
228
+ ),
229
+ document.body
230
+ )
231
+ ] }) : null
177
232
  ]
178
233
  }
179
234
  )
@@ -182,7 +237,7 @@ const Y = m(
182
237
  );
183
238
  }
184
239
  );
185
- A.displayName = "SmartNumberInput";
240
+ ue.displayName = "SmartNumberInput";
186
241
  export {
187
- A as SmartNumberInput
242
+ ue as SmartNumberInput
188
243
  };
@@ -1,6 +1,14 @@
1
1
  import { NetworkType } from '@gearbox-protocol/sdk';
2
2
  import { TokenFullData } from '../../types/common';
3
3
  import * as React from "react";
4
+ export interface TokenOption {
5
+ /** Display label for this option. */
6
+ label: string;
7
+ /** Optional icon to display before the label. */
8
+ icon?: React.ReactNode;
9
+ /** Called when this option is selected. */
10
+ onSelect: () => void;
11
+ }
4
12
  /** A-matching SmartNumberInput size for layout (styles.tsx). */
5
13
  export type SmartNumberInputSize = "sm" | "md";
6
14
  export interface SmartNumberInputProps {
@@ -28,6 +36,10 @@ export interface SmartNumberInputProps {
28
36
  size?: SmartNumberInputSize;
29
37
  /** When true, currency dropdown is open (expand icon rotated). */
30
38
  active?: boolean;
39
+ /** Override max character length for token symbol display. When omitted, computed from viewport width. */
40
+ symbolMaxLength?: number;
41
+ /** Inline token options for dropdown selection (alternative to onShowSelectDialog). */
42
+ tokenOptions?: TokenOption[];
31
43
  /** Callback when amount changes. Called with (value: bigint, valueView: string). */
32
44
  onSetAmount?: (value: bigint, valueView: string) => void;
33
45
  /** Callback to show token select dialog. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/ui-kit",
3
- "version": "3.14.0-next.2",
3
+ "version": "3.14.0-next.4",
4
4
  "description": "Internal UI components",
5
5
  "repository": "https://github.com/gearbox-protocol/ui-kit",
6
6
  "license": "MIT",