@gearbox-protocol/ui-kit 3.12.2 → 3.13.0
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/compound-apy/compound-apy.cjs +1 -1
- package/dist/cjs/components/rounded-image/rounded-image.cjs +1 -1
- package/dist/cjs/components/token-icon/token-icon.cjs +1 -1
- package/dist/cjs/components/token-symbol/token-symbol.cjs +1 -1
- package/dist/cjs/types/common.cjs +1 -1
- package/dist/esm/components/compound-apy/compound-apy.js +71 -68
- package/dist/esm/components/rounded-image/rounded-image.js +16 -16
- package/dist/esm/components/token-icon/token-icon.js +134 -44
- package/dist/esm/components/token-symbol/token-symbol.js +55 -46
- package/dist/esm/types/common.js +6 -1
- package/dist/globals.css +1 -1
- package/dist/types/components/compound-apy/compound-apy.d.ts +1 -3
- package/dist/types/components/help-tip/help-tip.d.ts +2 -2
- package/dist/types/components/token-icon/index.d.ts +1 -1
- package/dist/types/components/token-icon/token-icon.d.ts +8 -3
- package/dist/types/types/common.d.ts +11 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),M=require("@gearbox-protocol/static"),k=require("react"),E=require("../points-icon/points-icon.cjs"),N=require("../pool-apy-tooltip/pool-apy-tooltip.cjs"),V=require("../token-icon/token-icon.cjs"),$=require("../../types/common.cjs"),_=require("../../utils/format-money.cjs"),C=require("../../utils/static.cjs");require("../accordion/accordion.cjs");require("@fortawesome/free-solid-svg-icons");require("../icons/fa-icon.cjs");require("@gearbox-protocol/sdk");require("clsx");require("tailwind-merge");require("sonner");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../utils/z-index.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("wagmi");require("../auth/wallet-ui-context.cjs");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("../input/input.cjs");require("../with-title/with-title.cjs");require("../smart-number-input/balance-indicator.cjs");require("../smart-number-input/smart-number-input.cjs");require("../table/grid-table.cjs");const I=require("../token-symbol/token-symbol.cjs");require("../typography/typography.cjs");require("../help-tip/help-tip.cjs");require("../description/description.cjs");require("../confirm-menu/confirm-menu.cjs");require("../dialog/dialog-modal-container.cjs");require("../text-button/text-button.cjs");require("../vertical-indicator/vertical-indicator.cjs");require("../rounded-image/rounded-image.cjs");require("../progress/progress.cjs");require("../pool-indicator-icon/pool-indicator-icon.cjs");require("../skeleton/skeleton.cjs");require("../composites/strategies-table/components/feature/feature.styles.cjs");require("viem");require("../icon-button/icon-button.cjs");require("../separate-line/separate-line.cjs");require("../tip-card/tip-card.cjs");require("../vertical-list/vertical-list.cjs");require("../composites/strategies-table/components/rewards-tooltip/rewards-tooltip-root.cjs");require("../currency-button/currency-button.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-overlay.cjs");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("../health-factor/health-factor.cjs");require("../horizontal-indicator/horizontal-indicator.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("../layout/main-aside-layout/main-aside-layout.cjs");require("../page-title/page-title.cjs");require("../layout/social-icons/social-icons.cjs");require("../link/link.cjs");require("../../utils/reactochart-compat.cjs");require("../status-elements/status-elements.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-bar/progress-bar.cjs");require("../radio-group/radio-group.cjs");require("../search-bar/search-bar.cjs");require("../segmented-control/segmented-control.cjs");require("../select/select.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");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/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("../toggle/toggle.cjs");require("../with-filter-button/with-filter-button.cjs");function A(e){const q=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(q,n,t.get?t:{enumerable:!0,get:()=>e[n]})}}return q.default=e,Object.freeze(q)}const g=A(k);function S(e,q){if(e?.icon!==void 0&&$.isIconComposite(e.icon))return I.getSymbolOrIcon(e)??(e.symbol||q);const n=e?.symbol||q;return n==="GEAR"?{icon:C.getStatic("/logo/logo_symbol.png")}:I.getSymbolOrIcon(e)||n}function L({totalAPY:e,totalAPYLoading:q,baseAPY:n,extraAPY:t,externalAPY:i,points:s,apy7DAgo:T,tokensList:p,decimals:f=2,className:w}){const c=g.useMemo(()=>{if(i)return{...i,value:i.value??i.apy??0}},[i]),a=g.useMemo(()=>t.filter(d=>(d.apy||0)>0),[t]),b=!q&&e>=.001,h=()=>{const d=a.length>0,R=c&&!q&&c.totalValue>0&&c.totalValue!==e,O=s&&s.length>0,z=`${[_.formatPercentAmount(e,f),...R?[_.formatPercentAmount(c.totalValue,f)]:[]].join("-")}%`,j=Math.max(a.length,0),x=s?.filter(r=>r.reward)??[],l=j+x.length;return u.jsxs("div",{className:w,children:[u.jsxs("span",{className:"inline-flex items-center",children:[z,b&&u.jsx("span",{className:"ml-1.5 leading-[0] text-gray-70",children:u.jsx(M.IconInfo,{size:14})})]}),u.jsx("div",{}),(d||O)&&u.jsxs("span",{className:"relative inline-flex",children:[a.map((r,o)=>{const m=p?.[r.rewardToken],y=o===l-1;return u.jsx("span",{style:{zIndex:l-o,marginRight:y?0:-7},children:u.jsx(V.TokenIcon,{symbol:S(m,r.rewardTokenSymbol),size:14,style:{margin:r.rewardTokenSymbol==="GEAR"?"-3px 0 0 0":"0"}})},`extra-${r.rewardToken}-${r.apy}`)}),x.map((r,o)=>{const m=o+j,y=m===l-1;return u.jsx("span",{style:{zIndex:l-m,marginRight:y?0:-7},children:u.jsx(E.PointsIcon,{reward:{name:r.reward?.name||r.name,type:r.reward?.type||r.name.toLowerCase()},size:14})},`points-${r.name}-${o}`)})]})]})},v=g.useMemo(()=>{if(i)return{totalValue:i.totalValue,apy:i.value??i.apy??0,name:i.name,tooltip:i.tooltip}},[i]);return b?u.jsx(N.PoolAPYTooltip,{baseAPY:n,extraAPY:a,totalAPY:e,externalAPY:v,points:s,apy7DAgo:T,tokensList:p,children:h()}):h()}exports.CompoundAPY=L;exports.getRewardTokenSymbol=S;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react/jsx-runtime"),n=require("react");require("@gearbox-protocol/sdk");const h=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");const I=require("../../utils/static.cjs");require("luxon");require("../../utils/z-index.cjs");function _(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const L=_(n),i=I.getStatic("/tokens/default.svg"),l=new Map;function d(e){return l.get(e)?i:e}const f=L.forwardRef(({className:e,size:t,rounded:r=!0,style:o,src:a,defaultIcon:g=i,fit:b="cover",...m},y)=>{const[j,s]=n.useState(void 0),[p,u]=n.useState(!1),c=n.useRef(!1);n.useEffect(()=>{d(a),s(void 0),u(!1),c.current=!1},[a]);const q=v=>{c.current||(c.current=!0,l.set(v.currentTarget.src,!0),s(g))},R=()=>{u(!0)};return O.jsx("img",{ref:y,src:j||d(a),alt:"",className:h.cn(b==="cover"?"object-cover":"object-contain",r&&"rounded-full",!p&&"bg-gray-90 dark:bg-gray-110 rounded-full",e),style:{width:t,height:t,...o},loading:"lazy",decoding:"async",onError:q,onLoad:R,...m})});f.displayName="RoundedImage";exports.RoundedImage=f;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react/jsx-runtime"),n=require("react");require("@gearbox-protocol/sdk");const h=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");const I=require("../../utils/static.cjs");require("luxon");require("../../utils/z-index.cjs");function _(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const L=_(n),i=I.getStatic("/tokens/default.svg"),l=new Map;function d(e){return l.get(e)?i:e}const f=L.forwardRef(({className:e,size:t,rounded:r=!0,style:o,src:a,defaultIcon:g=i,fit:b="cover",...m},y)=>{const[j,s]=n.useState(void 0),[p,u]=n.useState(!1),c=n.useRef(!1);n.useEffect(()=>{d(a),s(void 0),u(!1),c.current=!1},[a]);const q=v=>{c.current||(c.current=!0,l.set(v.currentTarget.src,!0),s(g))},R=()=>{u(!0)};return O.jsx("img",{ref:y,src:j||d(a),alt:"",className:h.cn(b==="cover"?"object-cover":"object-contain object-center",r&&"rounded-full",!p&&"bg-gray-90 dark:bg-gray-110 rounded-full",e),style:{width:t,height:t,...o},loading:"lazy",decoding:"async",onError:q,onLoad:R,...m})});f.displayName="RoundedImage";exports.RoundedImage=f;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),T=require("react");require("@gearbox-protocol/sdk");const h=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");const p=require("../../utils/static.cjs");require("luxon");require("../../utils/z-index.cjs");const u=require("../rounded-image/rounded-image.cjs"),i=p.getStatic("/tokens/default.svg");function j(e){return e.replace("/","").replace(" ","").replace("-f","").replace("-","_").toLowerCase()}function U(e){return typeof e=="object"&&e!==null&&"icon"in e&&!("kind"in e)}function g(e){return typeof e=="object"&&e!==null&&"kind"in e&&e.kind==="composite"}function m(e){if(e.type==="url")return e.url;const n=j(e.symbol);return n?p.getStatic(`/tokens/${n}.svg`):i}function x(e){if(!e||g(e))return i;if(U(e))return e.icon;const n=j(e);return n?p.getStatic(`/tokens/${n}.svg`):i}function _(e){return e?g(e)?e.layers.map(m):[x(e)]:[i]}const C=.65,w=T.forwardRef(function({symbol:n,size:t=48,fit:o="contain",rounded:c=!1,className:a,...l},s){if(g(n))return r.jsx(y,{ref:s,composite:n,size:t,fit:o,rounded:c,className:a});const d=x(n);return r.jsx(u.RoundedImage,{ref:s,className:a,src:d,alt:"",rounded:c,fit:o,width:t,height:t,size:t,...l})}),y=T.forwardRef(function({composite:n,size:t,fit:o,rounded:c,className:a},l){const{preset:s,layers:d,scaleFactor:q=C}=n,[R,S]=d,k=m(R),N=m(S),f=Math.round(t*q);let I;switch(s){case"centered_foreground":I=r.jsxs(r.Fragment,{children:[r.jsx(u.RoundedImage,{className:"absolute inset-0",style:{zIndex:0},src:k,alt:"background",rounded:c,fit:o,size:t}),r.jsx("div",{className:h.cn("absolute left-1/2 top-1/2 z-[1] -translate-x-1/2 -translate-y-1/2","flex items-center justify-center"),style:{width:f,height:f},children:r.jsx(u.RoundedImage,{src:N,alt:"foreground",rounded:c,fit:o,size:f})})]});break;default:return console.error("Unknown TokenIcon composite preset",s),r.jsx(u.RoundedImage,{src:k,alt:"error",rounded:c,fit:o,size:t})}return r.jsx("div",{ref:l,className:h.cn("relative inline-block shrink-0",a),style:{width:t,height:t},children:I})});y.displayName="TokenIconComposite";w.displayName="TokenIcon";function b(e){for(const n of e)for(const t of _(n)){const o=new window.Image;o.src=t}}exports.TokenIcon=w;exports.preloadTokenIcons=b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),y=require("class-variance-authority"),I=require("react"),S=require("../rounded-image/rounded-image.cjs"),v=require("../short-string/short-string.cjs"),a=require("../token-icon/token-icon.cjs"),j=require("../tooltip/simple-tooltip.cjs");require("../tooltip/tooltip.cjs");const _=require("../../types/common.cjs");require("@gearbox-protocol/sdk");const b=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");const T=require("../../utils/network-icons.cjs");require("luxon");require("../../utils/z-index.cjs");const N=y.cva("",{variants:{marginSize:{sm:"gap-1",md:"gap-2",lg:"gap-3"}},defaultVariants:{marginSize:"md"}});function u(e){if(e){if(typeof e=="string")return e;if(e.icon!==void 0){if(typeof e.icon=="string")return{icon:e.icon};if(_.isIconComposite(e.icon))return e.icon}return e.symbol}}function R(e){if(e)return typeof e=="string"?e:e.title}const d=I.forwardRef(({className:e,marginSize:m="lg",token:t,title:s,size:o=24,showSymbol:g=!1,showIcon:f=!0,maxLength:p,chainId:O,comment:c,network:i,...h},x)=>{const n=u(t),q=s||R(t),l=()=>i?r.jsxs("div",{className:"relative",children:[r.jsx(a.TokenIcon,{symbol:n,size:o,className:"shrink-0 self-center"}),r.jsx("div",{className:"absolute -top-[10px] -right-[7px]",children:r.jsx(S.RoundedImage,{src:T.getNetworkIcon(i),alt:i,size:14,rounded:!0})})]}):r.jsx(a.TokenIcon,{symbol:n,size:o,className:"shrink-0 self-center"});return r.jsxs("div",{ref:x,className:b.cn("flex items-center",N({marginSize:m}),e),...h,children:[f&&n&&(i!==void 0?r.jsxs(j.SimpleTooltip,{title:l(),children:["Network: ",i]}):l()),(s||g)&&r.jsxs("div",{className:"flex items-center gap-1 self-center",children:[r.jsx("div",{children:r.jsx(v.ShortString,{maxLength:p,children:q})}),c&&r.jsxs("div",{className:"text-md text-muted-foreground leading-tight",children:["(",c,")"]})]})]})});d.displayName="TokenSymbol";exports.TokenSymbol=d;exports.getSymbolOrIcon=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function t(o){return typeof o=="object"&&o!==null&&"kind"in o&&o.kind==="composite"}exports.isIconComposite=t;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { IconInfo as
|
|
1
|
+
import { jsx as i, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { IconInfo as N } from "@gearbox-protocol/static";
|
|
3
3
|
import * as y from "react";
|
|
4
|
-
import { PointsIcon as
|
|
5
|
-
import { PoolAPYTooltip as
|
|
6
|
-
import { TokenIcon as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { PointsIcon as j } from "../points-icon/points-icon.js";
|
|
5
|
+
import { PoolAPYTooltip as C } from "../pool-apy-tooltip/pool-apy-tooltip.js";
|
|
6
|
+
import { TokenIcon as L } from "../token-icon/token-icon.js";
|
|
7
|
+
import { isIconComposite as G } from "../../types/common.js";
|
|
8
|
+
import { formatPercentAmount as T } from "../../utils/format-money.js";
|
|
9
|
+
import { getStatic as Z } from "../../utils/static.js";
|
|
9
10
|
import "../accordion/accordion.js";
|
|
10
11
|
import "@fortawesome/free-solid-svg-icons";
|
|
11
12
|
import "../icons/fa-icon.js";
|
|
@@ -53,7 +54,7 @@ import "../with-title/with-title.js";
|
|
|
53
54
|
import "../smart-number-input/balance-indicator.js";
|
|
54
55
|
import "../smart-number-input/smart-number-input.js";
|
|
55
56
|
import "../table/grid-table.js";
|
|
56
|
-
import { getSymbolOrIcon as
|
|
57
|
+
import { getSymbolOrIcon as R } from "../token-symbol/token-symbol.js";
|
|
57
58
|
import "../typography/typography.js";
|
|
58
59
|
import "../help-tip/help-tip.js";
|
|
59
60
|
import "../description/description.js";
|
|
@@ -164,112 +165,114 @@ import "../theme-provider.js";
|
|
|
164
165
|
import "../time-to-liquidation/time-to-liquidation.js";
|
|
165
166
|
import "../toggle/toggle.js";
|
|
166
167
|
import "../with-filter-button/with-filter-button.js";
|
|
167
|
-
function
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
function O(r, m) {
|
|
169
|
+
if (r?.icon !== void 0 && G(r.icon))
|
|
170
|
+
return R(r) ?? (r.symbol || m);
|
|
171
|
+
const n = r?.symbol || m;
|
|
172
|
+
return n === "GEAR" ? { icon: Z("/logo/logo_symbol.png") } : R(r) || n;
|
|
170
173
|
}
|
|
171
|
-
function
|
|
172
|
-
totalAPY:
|
|
173
|
-
totalAPYLoading:
|
|
174
|
-
baseAPY:
|
|
174
|
+
function Fr({
|
|
175
|
+
totalAPY: r,
|
|
176
|
+
totalAPYLoading: m,
|
|
177
|
+
baseAPY: n,
|
|
175
178
|
extraAPY: u,
|
|
176
|
-
externalAPY:
|
|
177
|
-
points:
|
|
178
|
-
apy7DAgo:
|
|
179
|
+
externalAPY: t,
|
|
180
|
+
points: e,
|
|
181
|
+
apy7DAgo: z,
|
|
179
182
|
tokensList: g,
|
|
180
|
-
decimals:
|
|
181
|
-
className:
|
|
183
|
+
decimals: b = 2,
|
|
184
|
+
className: E
|
|
182
185
|
}) {
|
|
183
186
|
const a = y.useMemo(() => {
|
|
184
|
-
if (
|
|
187
|
+
if (t)
|
|
185
188
|
return {
|
|
186
|
-
...
|
|
187
|
-
value:
|
|
189
|
+
...t,
|
|
190
|
+
value: t.value ?? t.apy ?? 0
|
|
188
191
|
};
|
|
189
|
-
}, [
|
|
190
|
-
const d = s.length > 0,
|
|
191
|
-
|
|
192
|
-
...
|
|
193
|
-
].join("-")}%`,
|
|
194
|
-
return /* @__PURE__ */ h("div", { className:
|
|
192
|
+
}, [t]), s = y.useMemo(() => u.filter((d) => (d.apy || 0) > 0), [u]), w = !m && r >= 1e-3, v = () => {
|
|
193
|
+
const d = s.length > 0, V = a && !m && a.totalValue > 0 && a.totalValue !== r, $ = e && e.length > 0, M = `${[
|
|
194
|
+
T(r, b),
|
|
195
|
+
...V ? [T(a.totalValue, b)] : []
|
|
196
|
+
].join("-")}%`, x = Math.max(s.length, 0), I = e?.filter((o) => o.reward) ?? [], l = x + I.length;
|
|
197
|
+
return /* @__PURE__ */ h("div", { className: E, children: [
|
|
195
198
|
/* @__PURE__ */ h("span", { className: "inline-flex items-center", children: [
|
|
196
|
-
|
|
197
|
-
|
|
199
|
+
M,
|
|
200
|
+
w && /* @__PURE__ */ i("span", { className: "ml-1.5 leading-[0] text-gray-70", children: /* @__PURE__ */ i(N, { size: 14 }) })
|
|
198
201
|
] }),
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
-
(d ||
|
|
201
|
-
s.map((
|
|
202
|
-
const c = g?.[
|
|
203
|
-
return /* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ i("div", {}),
|
|
203
|
+
(d || $) && /* @__PURE__ */ h("span", { className: "relative inline-flex", children: [
|
|
204
|
+
s.map((o, p) => {
|
|
205
|
+
const c = g?.[o.rewardToken], f = p === l - 1;
|
|
206
|
+
return /* @__PURE__ */ i(
|
|
204
207
|
"span",
|
|
205
208
|
{
|
|
206
209
|
style: {
|
|
207
|
-
zIndex: l -
|
|
210
|
+
zIndex: l - p,
|
|
208
211
|
marginRight: f ? 0 : -7
|
|
209
212
|
},
|
|
210
|
-
children: /* @__PURE__ */
|
|
211
|
-
|
|
213
|
+
children: /* @__PURE__ */ i(
|
|
214
|
+
L,
|
|
212
215
|
{
|
|
213
|
-
symbol:
|
|
216
|
+
symbol: O(c, o.rewardTokenSymbol),
|
|
214
217
|
size: 14,
|
|
215
218
|
style: {
|
|
216
|
-
margin:
|
|
219
|
+
margin: o.rewardTokenSymbol === "GEAR" ? "-3px 0 0 0" : "0"
|
|
217
220
|
}
|
|
218
221
|
}
|
|
219
222
|
)
|
|
220
223
|
},
|
|
221
|
-
`extra-${
|
|
224
|
+
`extra-${o.rewardToken}-${o.apy}`
|
|
222
225
|
);
|
|
223
226
|
}),
|
|
224
|
-
|
|
225
|
-
const c =
|
|
226
|
-
return /* @__PURE__ */
|
|
227
|
+
I.map((o, p) => {
|
|
228
|
+
const c = p + x, f = c === l - 1;
|
|
229
|
+
return /* @__PURE__ */ i(
|
|
227
230
|
"span",
|
|
228
231
|
{
|
|
229
232
|
style: {
|
|
230
233
|
zIndex: l - c,
|
|
231
234
|
marginRight: f ? 0 : -7
|
|
232
235
|
},
|
|
233
|
-
children: /* @__PURE__ */
|
|
234
|
-
|
|
236
|
+
children: /* @__PURE__ */ i(
|
|
237
|
+
j,
|
|
235
238
|
{
|
|
236
239
|
reward: {
|
|
237
|
-
name:
|
|
238
|
-
type:
|
|
240
|
+
name: o.reward?.name || o.name,
|
|
241
|
+
type: o.reward?.type || o.name.toLowerCase()
|
|
239
242
|
},
|
|
240
243
|
size: 14
|
|
241
244
|
}
|
|
242
245
|
)
|
|
243
246
|
},
|
|
244
|
-
`points-${
|
|
247
|
+
`points-${o.name}-${p}`
|
|
245
248
|
);
|
|
246
249
|
})
|
|
247
250
|
] })
|
|
248
251
|
] });
|
|
249
|
-
},
|
|
250
|
-
if (
|
|
252
|
+
}, S = y.useMemo(() => {
|
|
253
|
+
if (t)
|
|
251
254
|
return {
|
|
252
|
-
totalValue:
|
|
253
|
-
apy:
|
|
254
|
-
name:
|
|
255
|
-
tooltip:
|
|
255
|
+
totalValue: t.totalValue,
|
|
256
|
+
apy: t.value ?? t.apy ?? 0,
|
|
257
|
+
name: t.name,
|
|
258
|
+
tooltip: t.tooltip
|
|
256
259
|
};
|
|
257
|
-
}, [
|
|
258
|
-
return
|
|
259
|
-
|
|
260
|
+
}, [t]);
|
|
261
|
+
return w ? /* @__PURE__ */ i(
|
|
262
|
+
C,
|
|
260
263
|
{
|
|
261
|
-
baseAPY:
|
|
264
|
+
baseAPY: n,
|
|
262
265
|
extraAPY: s,
|
|
263
|
-
totalAPY:
|
|
264
|
-
externalAPY:
|
|
265
|
-
points:
|
|
266
|
-
apy7DAgo:
|
|
266
|
+
totalAPY: r,
|
|
267
|
+
externalAPY: S,
|
|
268
|
+
points: e,
|
|
269
|
+
apy7DAgo: z,
|
|
267
270
|
tokensList: g,
|
|
268
|
-
children:
|
|
271
|
+
children: v()
|
|
269
272
|
}
|
|
270
|
-
) :
|
|
273
|
+
) : v();
|
|
271
274
|
}
|
|
272
275
|
export {
|
|
273
|
-
|
|
274
|
-
|
|
276
|
+
Fr as CompoundAPY,
|
|
277
|
+
O as getRewardTokenSymbol
|
|
275
278
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { useState as s, useRef as
|
|
1
|
+
import { jsx as I } from "react/jsx-runtime";
|
|
2
|
+
import * as L from "react";
|
|
3
|
+
import { useState as s, useRef as j, useEffect as E } from "react";
|
|
4
4
|
import "@gearbox-protocol/sdk";
|
|
5
5
|
import { cn as k } from "../../utils/cn.js";
|
|
6
6
|
import "sonner";
|
|
@@ -8,40 +8,40 @@ import "@gearbox-protocol/sdk/common-utils";
|
|
|
8
8
|
import { getStatic as w } from "../../utils/static.js";
|
|
9
9
|
import "luxon";
|
|
10
10
|
import "../../utils/z-index.js";
|
|
11
|
-
const
|
|
12
|
-
function
|
|
13
|
-
return i.get(e) ?
|
|
11
|
+
const d = w("/tokens/default.svg"), i = /* @__PURE__ */ new Map();
|
|
12
|
+
function c(e) {
|
|
13
|
+
return i.get(e) ? d : e;
|
|
14
14
|
}
|
|
15
|
-
const N =
|
|
15
|
+
const N = L.forwardRef(
|
|
16
16
|
({
|
|
17
17
|
className: e,
|
|
18
18
|
size: o,
|
|
19
19
|
rounded: f = !0,
|
|
20
20
|
style: l,
|
|
21
21
|
src: r,
|
|
22
|
-
defaultIcon: m =
|
|
22
|
+
defaultIcon: m = d,
|
|
23
23
|
fit: u = "cover",
|
|
24
24
|
...g
|
|
25
25
|
}, p) => {
|
|
26
|
-
const [h, a] = s(void 0), [v, n] = s(!1), t =
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const [h, a] = s(void 0), [v, n] = s(!1), t = j(!1);
|
|
27
|
+
E(() => {
|
|
28
|
+
c(r), a(void 0), n(!1), t.current = !1;
|
|
29
29
|
}, [r]);
|
|
30
|
-
const y = (
|
|
31
|
-
t.current || (t.current = !0, i.set(
|
|
30
|
+
const y = (b) => {
|
|
31
|
+
t.current || (t.current = !0, i.set(b.currentTarget.src, !0), a(m));
|
|
32
32
|
}, R = () => {
|
|
33
33
|
n(!0);
|
|
34
34
|
};
|
|
35
35
|
return (
|
|
36
36
|
// biome-ignore lint/performance/noImgElement: Universal component that works outside Next.js
|
|
37
|
-
/* @__PURE__ */
|
|
37
|
+
/* @__PURE__ */ I(
|
|
38
38
|
"img",
|
|
39
39
|
{
|
|
40
40
|
ref: p,
|
|
41
|
-
src: h ||
|
|
41
|
+
src: h || c(r),
|
|
42
42
|
alt: "",
|
|
43
43
|
className: k(
|
|
44
|
-
u === "cover" ? "object-cover" : "object-contain",
|
|
44
|
+
u === "cover" ? "object-cover" : "object-contain object-center",
|
|
45
45
|
f && "rounded-full",
|
|
46
46
|
!v && "bg-gray-90 dark:bg-gray-110 rounded-full",
|
|
47
47
|
e
|
|
@@ -1,53 +1,143 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsx as r, jsxs as S, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
+
import w from "react";
|
|
3
|
+
import "@gearbox-protocol/sdk";
|
|
4
|
+
import { cn as I } from "../../utils/cn.js";
|
|
5
|
+
import "sonner";
|
|
6
|
+
import "@gearbox-protocol/sdk/common-utils";
|
|
7
|
+
import { getStatic as d } from "../../utils/static.js";
|
|
8
|
+
import "luxon";
|
|
9
|
+
import "../../utils/z-index.js";
|
|
10
|
+
import { RoundedImage as l } from "../rounded-image/rounded-image.js";
|
|
11
|
+
const s = d("/tokens/default.svg");
|
|
12
|
+
function T(t) {
|
|
13
|
+
return t.replace("/", "").replace(" ", "").replace("-f", "").replace("-", "_").toLowerCase();
|
|
8
14
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
if (typeof e == "object" && e !== null && "icon" in e)
|
|
12
|
-
return e.icon;
|
|
13
|
-
const n = d(e);
|
|
14
|
-
return n ? c(`/tokens/${n}.svg`) : r;
|
|
15
|
+
function j(t) {
|
|
16
|
+
return typeof t == "object" && t !== null && "icon" in t && !("kind" in t);
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return
|
|
27
|
-
|
|
18
|
+
function k(t) {
|
|
19
|
+
return typeof t == "object" && t !== null && "kind" in t && t.kind === "composite";
|
|
20
|
+
}
|
|
21
|
+
function u(t) {
|
|
22
|
+
if (t.type === "url") return t.url;
|
|
23
|
+
const o = T(t.symbol);
|
|
24
|
+
return o ? d(`/tokens/${o}.svg`) : s;
|
|
25
|
+
}
|
|
26
|
+
function y(t) {
|
|
27
|
+
if (!t || k(t))
|
|
28
|
+
return s;
|
|
29
|
+
if (j(t))
|
|
30
|
+
return t.icon;
|
|
31
|
+
const o = T(t);
|
|
32
|
+
return o ? d(`/tokens/${o}.svg`) : s;
|
|
33
|
+
}
|
|
34
|
+
function F(t) {
|
|
35
|
+
return t ? k(t) ? t.layers.map(u) : [y(t)] : [s];
|
|
36
|
+
}
|
|
37
|
+
const b = 0.65, L = w.forwardRef(function({ symbol: o, size: e = 48, fit: n = "contain", rounded: c = !1, className: a, ...f }, i) {
|
|
38
|
+
if (k(o))
|
|
39
|
+
return /* @__PURE__ */ r(
|
|
40
|
+
N,
|
|
28
41
|
{
|
|
29
|
-
ref:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
rounded:
|
|
34
|
-
|
|
35
|
-
width: n,
|
|
36
|
-
height: n,
|
|
37
|
-
size: n,
|
|
38
|
-
...i
|
|
42
|
+
ref: i,
|
|
43
|
+
composite: o,
|
|
44
|
+
size: e,
|
|
45
|
+
fit: n,
|
|
46
|
+
rounded: c,
|
|
47
|
+
className: a
|
|
39
48
|
}
|
|
40
49
|
);
|
|
50
|
+
const p = y(o);
|
|
51
|
+
return /* @__PURE__ */ r(
|
|
52
|
+
l,
|
|
53
|
+
{
|
|
54
|
+
ref: i,
|
|
55
|
+
className: a,
|
|
56
|
+
src: p,
|
|
57
|
+
alt: "",
|
|
58
|
+
rounded: c,
|
|
59
|
+
fit: n,
|
|
60
|
+
width: e,
|
|
61
|
+
height: e,
|
|
62
|
+
size: e,
|
|
63
|
+
...f
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}), N = w.forwardRef(function({ composite: o, size: e, fit: n, rounded: c, className: a }, f) {
|
|
67
|
+
const { preset: i, layers: p, scaleFactor: U = b } = o, [C, x] = p, g = u(C), R = u(x), m = Math.round(e * U);
|
|
68
|
+
let h;
|
|
69
|
+
switch (i) {
|
|
70
|
+
case "centered_foreground":
|
|
71
|
+
h = /* @__PURE__ */ S(_, { children: [
|
|
72
|
+
/* @__PURE__ */ r(
|
|
73
|
+
l,
|
|
74
|
+
{
|
|
75
|
+
className: "absolute inset-0",
|
|
76
|
+
style: { zIndex: 0 },
|
|
77
|
+
src: g,
|
|
78
|
+
alt: "background",
|
|
79
|
+
rounded: c,
|
|
80
|
+
fit: n,
|
|
81
|
+
size: e
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
/* @__PURE__ */ r(
|
|
85
|
+
"div",
|
|
86
|
+
{
|
|
87
|
+
className: I(
|
|
88
|
+
"absolute left-1/2 top-1/2 z-[1] -translate-x-1/2 -translate-y-1/2",
|
|
89
|
+
"flex items-center justify-center"
|
|
90
|
+
),
|
|
91
|
+
style: {
|
|
92
|
+
width: m,
|
|
93
|
+
height: m
|
|
94
|
+
},
|
|
95
|
+
children: /* @__PURE__ */ r(
|
|
96
|
+
l,
|
|
97
|
+
{
|
|
98
|
+
src: R,
|
|
99
|
+
alt: "foreground",
|
|
100
|
+
rounded: c,
|
|
101
|
+
fit: n,
|
|
102
|
+
size: m
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
] });
|
|
108
|
+
break;
|
|
109
|
+
default:
|
|
110
|
+
return console.error("Unknown TokenIcon composite preset", i), /* @__PURE__ */ r(
|
|
111
|
+
l,
|
|
112
|
+
{
|
|
113
|
+
src: g,
|
|
114
|
+
alt: "error",
|
|
115
|
+
rounded: c,
|
|
116
|
+
fit: n,
|
|
117
|
+
size: e
|
|
118
|
+
}
|
|
119
|
+
);
|
|
41
120
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
121
|
+
return /* @__PURE__ */ r(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
ref: f,
|
|
125
|
+
className: I("relative inline-block shrink-0", a),
|
|
126
|
+
style: { width: e, height: e },
|
|
127
|
+
children: h
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
});
|
|
131
|
+
N.displayName = "TokenIconComposite";
|
|
132
|
+
L.displayName = "TokenIcon";
|
|
133
|
+
function B(t) {
|
|
134
|
+
for (const o of t)
|
|
135
|
+
for (const e of F(o)) {
|
|
136
|
+
const n = new window.Image();
|
|
137
|
+
n.src = e;
|
|
138
|
+
}
|
|
49
139
|
}
|
|
50
140
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
141
|
+
L as TokenIcon,
|
|
142
|
+
B as preloadTokenIcons
|
|
53
143
|
};
|