@gearbox-protocol/permissionless-ui 1.24.0 → 1.24.2
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/complex-input/complex-input.cjs +1 -1
- package/dist/cjs/components/smart-number-input/smart-number-input.cjs +1 -1
- package/dist/cjs/components/tab-control/tab-control.cjs +1 -1
- package/dist/esm/components/complex-input/complex-input.js +14 -13
- package/dist/esm/components/smart-number-input/smart-number-input.js +1 -1
- package/dist/esm/components/tab-control/tab-control.js +131 -121
- package/dist/types/components/complex-input/complex-input.d.ts +1 -0
- package/dist/types/components/tab-control/tab-control.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),f=require("../input/input.cjs"),C=require("../with-title/with-title.cjs");require("react");const z=require("../../utils/bn-to-input-view.cjs");require("@gearbox-protocol/sdk");const B=require("../../utils/parse-input-to-bn.cjs"),v=require("../../utils/cn.cjs");require("sonner");require("luxon");require("../../utils/z-index.cjs");require("../accordion/accordion.cjs");require("@gearbox-protocol/static");require("@fortawesome/free-solid-svg-icons");require("../icons/fa-icon.cjs");require("../alert-badge/alert-badge.cjs");require("../alert-dialog/alert-dialog.cjs");require("../alert-modal/alert-modal.cjs");require("../tooltip/simple-tooltip.cjs");require("../tooltip/tooltip.cjs");require("react-intl");require("../arc-loader/arc-loader.cjs");require("../asset-line/asset-line.cjs");require("../buttons/back-button/back-button.cjs");require("../buttons/button/button.cjs");require("../buttons/copy-button/copy-button.cjs");require("../buttons/external-button/external-button.cjs");require("../buttons/filter-button/filter-button.cjs");require("../buttons/navigation-button/navigation-button.cjs");require("../buttons/tab-button/tab-button.cjs");require("../token-icon/token-icon.cjs");require("connectkit");require("wagmi");require("viem/siwe");require("../avatar/avatar.cjs");require("../badge/badge.cjs");require("../base-link/base-link.cjs");require("../navigation-context/navigation-context.cjs");require("../button-checkbox/button-checkbox.cjs");require("../card-grid/card-grid.cjs");require("../cards/card/card.cjs");require("../carousel/carousel.cjs");require("../checkbox/checkbox.cjs");require("../checkbox/checkbox-labeled.cjs");require("../checkbox-item/checkbox-item.cjs");require("../client-adapters/styled-button/styled-button.cjs");require("../client-adapters/styled-dialog-container/styled-dialog-container.cjs");require("../client-adapters/styled-rounded-image/styled-rounded-image.cjs");require("../colored-text/colored-text.cjs");require("../points-icon/points-icon.cjs");require("../skeleton/skeleton.cjs");require("../vertical-indicator/vertical-indicator.cjs");require("../vertical-list/vertical-list.cjs");require("../confirm-menu/confirm-menu.cjs");require("../currency-button/currency-button.cjs");require("../description/description.cjs");require("../detailed-apy/detailed-apy.cjs");require("../detailed-page-title/detailed-page-title.cjs");require("../detailed-page-title/detailed-page-title-copy-button.cjs");require("../detailed-page-title/detailed-page-title-explorer-dropdown.cjs");require("../modal/modal.cjs");require("@radix-ui/react-dialog");require("../dialog/dialog-container.cjs");require("../dialog/dialog-content.cjs");require("../dialog/dialog-description.cjs");require("../dialog/dialog-footer.cjs");require("../dialog/dialog-header.cjs");require("../dialog/dialog-title.cjs");require("../dialog/dialog-modal-container.cjs");require("../dialog/dialog-overlay.cjs");require("viem");require("../label/label.cjs");require("../dropdown-menu/dropdown-menu.cjs");require("../dropdown-menu/dropdown-menu-checkbox-item.cjs");require("../dropdown-menu/dropdown-menu-content.cjs");require("../dropdown-menu/dropdown-menu-item.cjs");require("../dropdown-menu/dropdown-menu-label.cjs");require("../dropdown-menu/dropdown-menu-radio-item.cjs");require("../dropdown-menu/dropdown-menu-separator.cjs");require("../dropdown-menu/dropdown-menu-shortcut.cjs");require("../dropdown-menu/dropdown-menu-sub-content.cjs");require("../dropdown-menu/dropdown-menu-sub-trigger.cjs");require("../edit-input/edit-input.cjs");require("../fadeout-loading/fadeout-loading.cjs");require("../filter/filter-block.cjs");require("../filter/filter-checkbox-item.cjs");require("../filter/filter-chip.cjs");require("../filter/filter-chips.cjs");require("../filter/filter-dropdown-item.cjs");require("../filter/filter-group.cjs");require("../filter/filter-label.cjs");require("../search-line/search-line.cjs");require("../tabs/tabs.cjs");require("../filter/filter-modal-item.cjs");require("../filter/filter-radio-item.cjs");require("../filter/filter-separator.cjs");require("../filter/variants.cjs");require("../graph/formatters.cjs");require("lightweight-charts");require("../graph/graph-view.cjs");require("../help-tip/help-tip.cjs");require("../health-factor/health-factor.cjs");require("../horizontal-indicator/horizontal-indicator.cjs");require("../icon-button/icon-button.cjs");require("../layout/col/col.cjs");require("../layout/container/container.cjs");require("../layout/footer/footer.cjs");require("../layout/grid/grid.cjs");require("../layout/header/header.cjs");require("../layout/layout/layout.cjs");require("../page-title/page-title.cjs");require("../layout/social-icons/social-icons.cjs");require("../link/link.cjs");require("../token-symbol/token-symbol.cjs");require("../../utils/reactochart-compat.cjs");const N=require("../short-string/short-string.cjs");require("../status-elements/status-elements.cjs");require("../text-button/text-button.cjs");require("../loader/loader.cjs");require("../loading/loading.cjs");require("../loading-bar/loading-bar.cjs");require("react-markdown");require("remark-gfm");require("../navbar/navbar.cjs");require("../navbar/navbar-indicator-context.cjs");require("../app-bar/app-bar.cjs");require("../navitem/navitem.cjs");require("../simple-dropdown/simple-dropdown.cjs");require("../progress/progress.cjs");require("../pool-indicator-icon/pool-indicator-icon.cjs");require("../progress-bar/progress-bar.cjs");require("../radio-group/radio-group.cjs");require("../rounded-image/rounded-image.cjs");require("../search-bar/search-bar.cjs");require("../segmented-control/segmented-control.cjs");require("../select/select.cjs");require("../separate-line/separate-line.cjs");require("../separator/separator.cjs");require("../simple-accordion/simple-accordion.cjs");require("../simple-dropdown/simple-dropdown-menu-item.cjs");require("../slider/slider.cjs");require("../slider/slider-context.cjs");require("@radix-ui/react-slider");const V=require("../smart-number-input/balance-indicator.cjs");require("../smart-number-input/smart-number-input.cjs");require("../spinner/spinner.cjs");require("../spinner-loader/spinner-loader.cjs");require("../split-list/split-list.cjs");require("../stat-badge/stat-badge.cjs");require("../status-dot/status-dot.cjs");require("../stepper/stepper.cjs");require("../switch/switch.cjs");require("../table/grid-table.cjs");require("../table/table.cjs");require("../table/grid-table-loader.cjs");require("../textarea/textarea.cjs");require("../theme-provider.cjs");require("../time-to-liquidation/time-to-liquidation.cjs");require("../tip-card/tip-card.cjs");require("../toggle/toggle.cjs");require("../typography/typography.cjs");require("../with-filter-button/with-filter-button.cjs");function k({titleProps:c,inputProps:l,balanceIndicatorProps:a}){const{title:m,className:p,size:d="md",...h}=c,{size:x="sm",title:g="Max",maxButton:I=!0,token:i,maxAmount:u,...T}=a,{decimals:t=18}=i||{},{colorTheme:_="filledLight",onChange:n,maxTokenLength:w=15,...j}=l,S=r=>{const q=r.target.value,[o,s]=B.parseInputToBN(q,t);o===null||s===null||n?.(o,s)},b=()=>{const r=u||0n,q=z.bnToInputView(r,t);n?.(r,q)};return e.jsx(C.WithTitle,{className:v.cn(p),size:d,title:e.jsxs("div",{className:"flex flex-nowrap justify-between items-center",children:[m,u!==void 0&&e.jsx(V.BalanceIndicator,{token:i,title:g,size:x,maxButton:I,maxAmount:u,onMaxButtonClick:b,...T})]}),...h,children:e.jsx(f.Input,{colorTheme:_,onChange:S,endingIcon:e.jsx(N.ShortString,{maxLength:w,children:i?.title}),...j})})}exports.ComplexInput=k;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("class-variance-authority"),Q=require("react"),X=require("../currency-button/currency-button.cjs"),$=require("@fortawesome/free-solid-svg-icons"),E=require("../icons/fa-icon.cjs"),d=require("../../hooks/use-media-query.cjs"),G=require("../../utils/bn-to-input-view.cjs");require("@gearbox-protocol/sdk");const H=require("../../utils/parse-input-to-bn.cjs"),m=require("../../utils/cn.cjs");require("sonner");require("luxon");require("../../utils/z-index.cjs");const J=require("./balance-indicator.cjs");function K(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 v=K(Q),U=p.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"}}),W=p.cva("font-medium text-foreground",{variants:{size:{sm:"text-xs",md:"text-sm"}},defaultVariants:{size:"md"}}),Y=p.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"}}),j=v.forwardRef(({amount:s,token:t,label:a="Amount",maxAmount:r,maxAmountLimit:c,maxButtonLabel:w,chainId:I,network:N,maxButton:q=!0,disabled:n=!1,active:z=!1,size:_="md",onSetAmount:o,onShowSelectDialog:f,onRemove:b,onFocus:V,onBlur:B},C)=>{const x=t?.decimals??18,M=u=>{const l=u.target.value,[h,y]=H.parseInputToBN(l,x);h===null||y===null||o&&o(h,y)},k=()=>{if(o){const u=r&&c&&r>c?c:r||0n,l=G.bnToInputView(u,x);o(u,l)}},[S,g]=v.useState(!1),T=()=>{g(!0),V?.()},O=()=>{g(!1),B?.()},i=_??"md",F=d.useIsMobile(),L=d.useIsTablet(),D=d.useIsDesktop(),P=F?20:L?30:D?
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("class-variance-authority"),Q=require("react"),X=require("../currency-button/currency-button.cjs"),$=require("@fortawesome/free-solid-svg-icons"),E=require("../icons/fa-icon.cjs"),d=require("../../hooks/use-media-query.cjs"),G=require("../../utils/bn-to-input-view.cjs");require("@gearbox-protocol/sdk");const H=require("../../utils/parse-input-to-bn.cjs"),m=require("../../utils/cn.cjs");require("sonner");require("luxon");require("../../utils/z-index.cjs");const J=require("./balance-indicator.cjs");function K(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 v=K(Q),U=p.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"}}),W=p.cva("font-medium text-foreground",{variants:{size:{sm:"text-xs",md:"text-sm"}},defaultVariants:{size:"md"}}),Y=p.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"}}),j=v.forwardRef(({amount:s,token:t,label:a="Amount",maxAmount:r,maxAmountLimit:c,maxButtonLabel:w,chainId:I,network:N,maxButton:q=!0,disabled:n=!1,active:z=!1,size:_="md",onSetAmount:o,onShowSelectDialog:f,onRemove:b,onFocus:V,onBlur:B},C)=>{const x=t?.decimals??18,M=u=>{const l=u.target.value,[h,y]=H.parseInputToBN(l,x);h===null||y===null||o&&o(h,y)},k=()=>{if(o){const u=r&&c&&r>c?c:r||0n,l=G.bnToInputView(u,x);o(u,l)}},[S,g]=v.useState(!1),T=()=>{g(!0),V?.()},O=()=>{g(!1),B?.()},i=_??"md",F=d.useIsMobile(),L=d.useIsTablet(),D=d.useIsDesktop(),P=F?20:L?30:D?22:30,R=!!(t||f);return e.jsxs("div",{ref:C,className:U({size:i}),"data-testid":"smart-number-input-root","data-active":S,"data-disabled":n,children:[b&&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":"smart-number-input-close",children:e.jsx("button",{type:"button",onClick:b,className:"flex h-5 w-5 items-center justify-center rounded-full bg-muted hover:bg-muted/80 text-muted-foreground",children:e.jsx(E.FaIcon,{icon:$.faXmark,className:"size-3"})})}),e.jsxs("div",{className:"mb-2 flex justify-between text-sm leading-[120%]",children:[e.jsx("span",{className:m.cn(W({size:i}),"grow shrink-0 basis-0"),"data-testid":"smart-number-input-label",children:a}),r!==void 0&&t&&e.jsx(J.BalanceIndicator,{title:w,token:t,maxAmount:r,size:i,disabled:n,maxButton:q,onMaxButtonClick:k})]}),e.jsxs("div",{className:m.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:T,onBlur:O,disabled:n||!o,className:m.cn(Y({size:i}),n&&"cursor-not-allowed"),"data-testid":"smart-number-input-input",minLength:1,maxLength:79,title:"Amount"})}),R?e.jsx(X.CurrencyButton,{active:z,size:i,disabled:n,token:t,showSelectDialog:f,chainId:I,network:N,maxLength:P,children:t?.symbol??"Select token"}):null]})]})});j.displayName="SmartNumberInput";exports.SmartNumberInput=j;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),i=require("react"),p=require("../navigation-context/navigation-context.cjs");require("@gearbox-protocol/sdk");const x=require("../../utils/cn.cjs");require("sonner");require("luxon");require("../../utils/z-index.cjs");function w(n){if(!n)return null;const{width:r=0,height:o=0}=n?.getBoundingClientRect()||{},a=n?.offsetTop||0,s=n?.offsetLeft||0;return{width:r,height:o,left:s,top:a}}function C(n,r,o){const a=i.useRef(null),[s,h]=i.useState(null),l=i.useRef(null),d=i.useCallback(e=>{h(e),l.current=e},[]);return i.useEffect(()=>{const e=o.current[n],c=()=>{const u=w(e),b=u?.height!==l.current?.height,g=u?.width!==l.current?.width,m=u?.left!==l.current?.left,v=u?.top!==l.current?.top;(b||g||m||v)&&d(u)};a.current=c,c();const t=e?new ResizeObserver(c):null;return e&&t?.observe(e),()=>{e&&t?.unobserve(e)}},[n,o,d]),i.useEffect(()=>{const e=r?new ResizeObserver(()=>{a.current?.()}):null;return r&&e?.observe(r),()=>{r&&e?.unobserve(r)}},[r]),s}function T({className:n,tabs:r,state:o,showBorder:a=!0,tabItemWrapPadding:s,variant:h="auto"}){const l=i.useRef(null),d=i.useRef({}),e=C(o.id,l.current,d),c=(t,u)=>()=>o.handleTabChange(t,u);return f.jsx("div",{className:x.cn("relative w-full flex flex-col flex-wrap overflow-y-hidden",n),children:f.jsxs("div",{ref:l,className:x.cn("relative w-full max-w-full grow-0 shrink-0 basis-full flex items-stretch overflow-x-auto overflow-y-hidden","scrollbar-hidden",a&&"after:content-[''] after:absolute after:bottom-0 after:left-0 after:right-0 after:h-px after:bg-border"),children:[e&&f.jsx("div",{className:"absolute left-0 h-[3px] bg-accent transition-[transform] duration-200 ease-in-out pointer-events-none bottom-[-1px]",style:{width:`${e.width}px`,transform:`translate(${e.left}px)`}}),r.map((t,u,b)=>{const g=u===b.length-1;return f.jsx("button",{ref:m=>{d.current[t.id]=m},type:"button",onClick:t.disabled?void 0:c(t.id,u),disabled:t.disabled,className:x.cn("flex items-center bg-transparent border-none shrink-0 text-foreground",s?"":"p-0 pb-3.5",h==="equal"?"grow shrink-0 basis-[0%] justify-center min-w-0":!g&&"mr-10 max-[500px]:mr-8",t.disabled&&"cursor-not-allowed",!t.disabled&&"cursor-pointer",!t.disabled&&"hover:text-foreground hover:[&>*]:text-foreground"),style:s?{padding:s}:void 0,children:t.item},`tab-item-${t.id}`)})]})})}function j({icon:n,label:r,selected:o,textSize:a="default",amount:s}){return f.jsxs(f.Fragment,{children:[n&&f.jsx("div",{className:x.cn("mr-3",o?"text-foreground":"text-secondary-foreground"),children:n}),f.jsx("div",{className:x.cn("m-0 p-0 whitespace-nowrap",a==="default"&&"text-sm leading-[17px] font-normal",a==="unset"&&"text-[unset] leading-[unset] font-[unset]",o?"text-foreground":"text-secondary-foreground"),children:r}),!!s&&f.jsx("div",{className:"ml-1.5",children:f.jsx("div",{className:"py-0.5 px-[9px] text-[11px] leading-[150%] font-normal bg-gray-50 rounded-[19px]",children:s})})]})}function y(n,r=0){const[o,a]=i.useState(n),[s,h]=i.useState(r),l=i.useCallback((d,e)=>{a(d),h(e)},[]);return{id:o,index:s,handleTabChange:l}}function N(n){const{useLocation:r,useNavigate:o}=p.useNavigationAdapter(),{hash:a}=r(),s=o(),h=i.useMemo(()=>n.reduce((t,u,b)=>(t[u.id]={id:u.id,index:b},t),{}),[n]),l=i.useMemo(()=>a.slice(1).toLowerCase(),[a]),{id:d,index:e}=h[l]||{},c=i.useCallback(t=>{s(`#${t}`)},[s]);return{id:d,index:e,handleTabChange:c}}function S({defaultTabs:n,pathRoot:r,selectedSection:o}){const{useNavigate:a}=p.useNavigationAdapter(),s=a(),h=i.useMemo(()=>n.reduce((c,t,u)=>(c[t.id]={id:t.id,index:u},c),{}),[n]),l=i.useCallback(c=>{s(`${r}/${c}`)},[s,r]),{id:d,index:e}=h[o]||{};return{id:d,index:e,handleTabChange:l}}exports.TabControl=T;exports.TabItem=j;exports.useHashTabs=N;exports.useSectionTab=S;exports.useTabControl=y;
|
|
@@ -5,7 +5,7 @@ import "react";
|
|
|
5
5
|
import { bnToInputView as V } from "../../utils/bn-to-input-view.js";
|
|
6
6
|
import "@gearbox-protocol/sdk";
|
|
7
7
|
import { parseInputToBN as j } from "../../utils/parse-input-to-bn.js";
|
|
8
|
-
import { cn as
|
|
8
|
+
import { cn as L } from "../../utils/cn.js";
|
|
9
9
|
import "sonner";
|
|
10
10
|
import "luxon";
|
|
11
11
|
import "../../utils/z-index.js";
|
|
@@ -160,7 +160,7 @@ import "../tip-card/tip-card.js";
|
|
|
160
160
|
import "../toggle/toggle.js";
|
|
161
161
|
import "../typography/typography.js";
|
|
162
162
|
import "../with-filter-button/with-filter-button.js";
|
|
163
|
-
function
|
|
163
|
+
function yi({
|
|
164
164
|
titleProps: s,
|
|
165
165
|
inputProps: a,
|
|
166
166
|
balanceIndicatorProps: c
|
|
@@ -176,22 +176,23 @@ function Li({
|
|
|
176
176
|
maxButton: I = !0,
|
|
177
177
|
token: i,
|
|
178
178
|
maxAmount: r,
|
|
179
|
-
...
|
|
179
|
+
...T
|
|
180
180
|
} = c, { decimals: p = 18 } = i || {}, {
|
|
181
|
-
colorTheme:
|
|
181
|
+
colorTheme: w = "filledLight",
|
|
182
182
|
onChange: e,
|
|
183
|
+
maxTokenLength: z = 15,
|
|
183
184
|
...C
|
|
184
|
-
} = a,
|
|
185
|
+
} = a, B = (t) => {
|
|
185
186
|
const m = t.target.value, [n, l] = j(m, p);
|
|
186
187
|
n === null || l === null || e?.(n, l);
|
|
187
|
-
},
|
|
188
|
+
}, k = () => {
|
|
188
189
|
const t = r || 0n, m = V(t, p);
|
|
189
190
|
e?.(t, m);
|
|
190
191
|
};
|
|
191
192
|
return /* @__PURE__ */ o(
|
|
192
193
|
S,
|
|
193
194
|
{
|
|
194
|
-
className:
|
|
195
|
+
className: L(d),
|
|
195
196
|
size: f,
|
|
196
197
|
title: /* @__PURE__ */ v("div", { className: "flex flex-nowrap justify-between items-center", children: [
|
|
197
198
|
u,
|
|
@@ -203,8 +204,8 @@ function Li({
|
|
|
203
204
|
size: x,
|
|
204
205
|
maxButton: I,
|
|
205
206
|
maxAmount: r,
|
|
206
|
-
onMaxButtonClick:
|
|
207
|
-
...
|
|
207
|
+
onMaxButtonClick: k,
|
|
208
|
+
...T
|
|
208
209
|
}
|
|
209
210
|
)
|
|
210
211
|
] }),
|
|
@@ -212,9 +213,9 @@ function Li({
|
|
|
212
213
|
children: /* @__PURE__ */ o(
|
|
213
214
|
N,
|
|
214
215
|
{
|
|
215
|
-
colorTheme:
|
|
216
|
-
onChange:
|
|
217
|
-
endingIcon: /* @__PURE__ */ o(M, { maxLength:
|
|
216
|
+
colorTheme: w,
|
|
217
|
+
onChange: B,
|
|
218
|
+
endingIcon: /* @__PURE__ */ o(M, { maxLength: z, children: i?.title }),
|
|
218
219
|
...C
|
|
219
220
|
}
|
|
220
221
|
)
|
|
@@ -222,5 +223,5 @@ function Li({
|
|
|
222
223
|
);
|
|
223
224
|
}
|
|
224
225
|
export {
|
|
225
|
-
|
|
226
|
+
yi as ComplexInput
|
|
226
227
|
};
|
|
@@ -75,7 +75,7 @@ const W = c(
|
|
|
75
75
|
h(!0), B?.();
|
|
76
76
|
}, D = () => {
|
|
77
77
|
h(!1), k?.();
|
|
78
|
-
}, n = I ?? "md", R = J(), S = K(), X = O(), $ = R ? 20 : S ? 30 : X ?
|
|
78
|
+
}, n = I ?? "md", R = J(), S = K(), X = O(), $ = R ? 20 : S ? 30 : X ? 22 : 30, q = !!(t || m);
|
|
79
79
|
return /* @__PURE__ */ u(
|
|
80
80
|
"div",
|
|
81
81
|
{
|
|
@@ -1,176 +1,186 @@
|
|
|
1
|
-
import { jsx as f, jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { useNavigationAdapter as
|
|
1
|
+
import { jsx as f, jsxs as T, Fragment as S } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as b, useState as v, useCallback as p, useMemo as w, useEffect as N } from "react";
|
|
3
|
+
import { useNavigationAdapter as y } from "../navigation-context/navigation-context.js";
|
|
4
4
|
import "@gearbox-protocol/sdk";
|
|
5
|
-
import { cn as
|
|
5
|
+
import { cn as m } from "../../utils/cn.js";
|
|
6
6
|
import "sonner";
|
|
7
7
|
import "luxon";
|
|
8
8
|
import "../../utils/z-index.js";
|
|
9
|
-
function U(
|
|
10
|
-
if (!
|
|
11
|
-
const { width:
|
|
12
|
-
return { width:
|
|
9
|
+
function U(n) {
|
|
10
|
+
if (!n) return null;
|
|
11
|
+
const { width: r = 0, height: s = 0 } = n?.getBoundingClientRect() || {}, i = n?.offsetTop || 0, o = n?.offsetLeft || 0;
|
|
12
|
+
return { width: r, height: s, left: o, top: i };
|
|
13
13
|
}
|
|
14
|
-
function $(
|
|
15
|
-
const
|
|
16
|
-
u(
|
|
14
|
+
function $(n, r, s) {
|
|
15
|
+
const i = b(null), [o, u] = v(null), l = b(null), c = p((e) => {
|
|
16
|
+
u(e), l.current = e;
|
|
17
17
|
}, []);
|
|
18
|
-
return
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
(h || x ||
|
|
18
|
+
return N(() => {
|
|
19
|
+
const e = s.current[n], d = () => {
|
|
20
|
+
const a = U(e), h = a?.height !== l.current?.height, x = a?.width !== l.current?.width, g = a?.left !== l.current?.left, C = a?.top !== l.current?.top;
|
|
21
|
+
(h || x || g || C) && c(a);
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
return
|
|
26
|
-
|
|
23
|
+
i.current = d, d();
|
|
24
|
+
const t = e ? new ResizeObserver(d) : null;
|
|
25
|
+
return e && t?.observe(e), () => {
|
|
26
|
+
e && t?.unobserve(e);
|
|
27
27
|
};
|
|
28
|
-
}, [
|
|
29
|
-
const
|
|
30
|
-
|
|
28
|
+
}, [n, s, c]), N(() => {
|
|
29
|
+
const e = r ? new ResizeObserver(() => {
|
|
30
|
+
i.current?.();
|
|
31
31
|
}) : null;
|
|
32
|
-
return
|
|
33
|
-
|
|
32
|
+
return r && e?.observe(r), () => {
|
|
33
|
+
r && e?.unobserve(r);
|
|
34
34
|
};
|
|
35
|
-
}, [
|
|
35
|
+
}, [r]), o;
|
|
36
36
|
}
|
|
37
37
|
function A({
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
className: n,
|
|
39
|
+
tabs: r,
|
|
40
|
+
state: s,
|
|
40
41
|
showBorder: i = !0,
|
|
41
42
|
tabItemWrapPadding: o,
|
|
42
|
-
variant:
|
|
43
|
+
variant: u = "auto"
|
|
43
44
|
}) {
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
),
|
|
49
|
-
return /* @__PURE__ */ f(
|
|
45
|
+
const l = b(null), c = b({}), e = $(
|
|
46
|
+
s.id,
|
|
47
|
+
l.current,
|
|
48
|
+
c
|
|
49
|
+
), d = (t, a) => () => s.handleTabChange(t, a);
|
|
50
|
+
return /* @__PURE__ */ f(
|
|
50
51
|
"div",
|
|
51
52
|
{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"scrollbar-hidden",
|
|
56
|
-
i && "after:content-[''] after:absolute after:bottom-0 after:left-0 after:right-0 after:h-px after:bg-border"
|
|
53
|
+
className: m(
|
|
54
|
+
"relative w-full flex flex-col flex-wrap overflow-y-hidden",
|
|
55
|
+
n
|
|
57
56
|
),
|
|
58
|
-
children:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
57
|
+
children: /* @__PURE__ */ T(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
ref: l,
|
|
61
|
+
className: m(
|
|
62
|
+
"relative w-full max-w-full grow-0 shrink-0 basis-full flex items-stretch overflow-x-auto overflow-y-hidden",
|
|
63
|
+
"scrollbar-hidden",
|
|
64
|
+
i && "after:content-[''] after:absolute after:bottom-0 after:left-0 after:right-0 after:h-px after:bg-border"
|
|
65
|
+
),
|
|
66
|
+
children: [
|
|
67
|
+
e && /* @__PURE__ */ f(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
className: "absolute left-0 h-[3px] bg-accent transition-[transform] duration-200 ease-in-out pointer-events-none bottom-[-1px]",
|
|
71
|
+
style: {
|
|
72
|
+
width: `${e.width}px`,
|
|
73
|
+
transform: `translate(${e.left}px)`
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
r.map((t, a, h) => {
|
|
78
|
+
const x = a === h.length - 1;
|
|
79
|
+
return /* @__PURE__ */ f(
|
|
80
|
+
"button",
|
|
81
|
+
{
|
|
82
|
+
ref: (g) => {
|
|
83
|
+
c.current[t.id] = g;
|
|
84
|
+
},
|
|
85
|
+
type: "button",
|
|
86
|
+
onClick: t.disabled ? void 0 : d(t.id, a),
|
|
87
|
+
disabled: t.disabled,
|
|
88
|
+
className: m(
|
|
89
|
+
"flex items-center bg-transparent border-none shrink-0 text-foreground",
|
|
90
|
+
o ? "" : "p-0 pb-3.5",
|
|
91
|
+
u === "equal" ? "grow shrink-0 basis-[0%] justify-center min-w-0" : !x && "mr-10 max-[500px]:mr-8",
|
|
92
|
+
t.disabled && "cursor-not-allowed",
|
|
93
|
+
!t.disabled && "cursor-pointer",
|
|
94
|
+
!t.disabled && "hover:text-foreground hover:[&>*]:text-foreground"
|
|
95
|
+
),
|
|
96
|
+
style: o ? { padding: o } : void 0,
|
|
97
|
+
children: t.item
|
|
98
|
+
},
|
|
99
|
+
`tab-item-${t.id}`
|
|
100
|
+
);
|
|
101
|
+
})
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
)
|
|
95
105
|
}
|
|
96
|
-
)
|
|
106
|
+
);
|
|
97
107
|
}
|
|
98
108
|
function B({
|
|
99
|
-
icon:
|
|
100
|
-
label:
|
|
101
|
-
selected:
|
|
102
|
-
textSize:
|
|
103
|
-
amount:
|
|
109
|
+
icon: n,
|
|
110
|
+
label: r,
|
|
111
|
+
selected: s,
|
|
112
|
+
textSize: i = "default",
|
|
113
|
+
amount: o
|
|
104
114
|
}) {
|
|
105
|
-
return /* @__PURE__ */
|
|
106
|
-
|
|
115
|
+
return /* @__PURE__ */ T(S, { children: [
|
|
116
|
+
n && /* @__PURE__ */ f(
|
|
107
117
|
"div",
|
|
108
118
|
{
|
|
109
|
-
className:
|
|
119
|
+
className: m(
|
|
110
120
|
"mr-3",
|
|
111
|
-
|
|
121
|
+
s ? "text-foreground" : "text-secondary-foreground"
|
|
112
122
|
),
|
|
113
|
-
children:
|
|
123
|
+
children: n
|
|
114
124
|
}
|
|
115
125
|
),
|
|
116
126
|
/* @__PURE__ */ f(
|
|
117
127
|
"div",
|
|
118
128
|
{
|
|
119
|
-
className:
|
|
129
|
+
className: m(
|
|
120
130
|
"m-0 p-0 whitespace-nowrap",
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
131
|
+
i === "default" && "text-sm leading-[17px] font-normal",
|
|
132
|
+
i === "unset" && "text-[unset] leading-[unset] font-[unset]",
|
|
133
|
+
s ? "text-foreground" : "text-secondary-foreground"
|
|
124
134
|
),
|
|
125
|
-
children:
|
|
135
|
+
children: r
|
|
126
136
|
}
|
|
127
137
|
),
|
|
128
|
-
!!
|
|
138
|
+
!!o && /* @__PURE__ */ f("div", { className: "ml-1.5", children: /* @__PURE__ */ f("div", { className: "py-0.5 px-[9px] text-[11px] leading-[150%] font-normal bg-gray-50 rounded-[19px]", children: o }) })
|
|
129
139
|
] });
|
|
130
140
|
}
|
|
131
|
-
function F(
|
|
132
|
-
const [
|
|
133
|
-
|
|
141
|
+
function F(n, r = 0) {
|
|
142
|
+
const [s, i] = v(n), [o, u] = v(r), l = p((c, e) => {
|
|
143
|
+
i(c), u(e);
|
|
134
144
|
}, []);
|
|
135
|
-
return { id:
|
|
145
|
+
return { id: s, index: o, handleTabChange: l };
|
|
136
146
|
}
|
|
137
|
-
function I(
|
|
138
|
-
const { useLocation:
|
|
139
|
-
() =>
|
|
140
|
-
(
|
|
147
|
+
function I(n) {
|
|
148
|
+
const { useLocation: r, useNavigate: s } = y(), { hash: i } = r(), o = s(), u = w(
|
|
149
|
+
() => n.reduce(
|
|
150
|
+
(t, a, h) => (t[a.id] = { id: a.id, index: h }, t),
|
|
141
151
|
{}
|
|
142
152
|
),
|
|
143
|
-
[
|
|
144
|
-
), l =
|
|
145
|
-
(
|
|
146
|
-
|
|
153
|
+
[n]
|
|
154
|
+
), l = w(() => i.slice(1).toLowerCase(), [i]), { id: c, index: e } = u[l] || {}, d = p(
|
|
155
|
+
(t) => {
|
|
156
|
+
o(`#${t}`);
|
|
147
157
|
},
|
|
148
|
-
[
|
|
158
|
+
[o]
|
|
149
159
|
);
|
|
150
160
|
return {
|
|
151
|
-
id:
|
|
152
|
-
index:
|
|
153
|
-
handleTabChange:
|
|
161
|
+
id: c,
|
|
162
|
+
index: e,
|
|
163
|
+
handleTabChange: d
|
|
154
164
|
};
|
|
155
165
|
}
|
|
156
166
|
function M({
|
|
157
|
-
defaultTabs:
|
|
158
|
-
pathRoot:
|
|
159
|
-
selectedSection:
|
|
167
|
+
defaultTabs: n,
|
|
168
|
+
pathRoot: r,
|
|
169
|
+
selectedSection: s
|
|
160
170
|
}) {
|
|
161
|
-
const { useNavigate:
|
|
162
|
-
() =>
|
|
163
|
-
(
|
|
171
|
+
const { useNavigate: i } = y(), o = i(), u = w(
|
|
172
|
+
() => n.reduce(
|
|
173
|
+
(d, t, a) => (d[t.id] = { id: t.id, index: a }, d),
|
|
164
174
|
{}
|
|
165
175
|
),
|
|
166
|
-
[
|
|
176
|
+
[n]
|
|
167
177
|
), l = p(
|
|
168
|
-
(
|
|
169
|
-
|
|
178
|
+
(d) => {
|
|
179
|
+
o(`${r}/${d}`);
|
|
170
180
|
},
|
|
171
|
-
[
|
|
172
|
-
), { id:
|
|
173
|
-
return { id:
|
|
181
|
+
[o, r]
|
|
182
|
+
), { id: c, index: e } = u[s] || {};
|
|
183
|
+
return { id: c, index: e, handleTabChange: l };
|
|
174
184
|
}
|
|
175
185
|
export {
|
|
176
186
|
A as TabControl,
|
|
@@ -4,13 +4,14 @@ export interface TabControl<T extends string> {
|
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
}
|
|
6
6
|
export interface TabControlProps<T extends string> {
|
|
7
|
+
className?: string;
|
|
7
8
|
tabs: Array<TabControl<T>>;
|
|
8
9
|
state: UseTabControlReturnType<T>;
|
|
9
10
|
showBorder?: boolean;
|
|
10
11
|
variant?: "equal" | "auto";
|
|
11
12
|
tabItemWrapPadding?: string;
|
|
12
13
|
}
|
|
13
|
-
export declare function TabControl<T extends string>({ tabs, state: controlState, showBorder, tabItemWrapPadding, variant, }: TabControlProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function TabControl<T extends string>({ className, tabs, state: controlState, showBorder, tabItemWrapPadding, variant, }: TabControlProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
interface TabItemProps {
|
|
15
16
|
icon?: React.ReactNode;
|
|
16
17
|
label: React.ReactNode;
|