@gearbox-protocol/permissionless-ui 1.22.0-next.57 → 1.22.0-next.59

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 r=require("react/jsx-runtime"),h=require("@radix-ui/react-dropdown-menu");require("react");require("@gearbox-protocol/sdk");const a=require("../../utils/cn.cjs");require("sonner");require("luxon");function j(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const i=j(h);function s({children:e,title:o,placement:t="bottom",align:n="start",sideOffset:d=4,maxWidth:l,minWidth:c,open:u,onOpenChange:p,modal:m=!1,className:f,triggerClassName:b}){const g=a.cn("z-50 min-w-32 overflow-hidden rounded-lg border border-border bg-gray-40 p-1 text-popover-foreground shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",f);return r.jsxs(i.Root,{open:u,onOpenChange:p,modal:m,children:[r.jsx(i.Trigger,{asChild:!0,children:r.jsx("button",{type:"button",className:a.cn("inline-flex appearance-none border-0 bg-transparent p-0 text-inherit font-inherit cursor-pointer",b),children:o})}),r.jsx(i.Portal,{children:r.jsx(i.Content,{side:t,align:n,sideOffset:d,className:g,style:{maxWidth:l,minWidth:c},children:e})})]})}s.displayName="SimpleDropdown";exports.SimpleDropdown=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),w=require("@radix-ui/react-dropdown-menu");require("react");require("@gearbox-protocol/sdk");const a=require("../../utils/cn.cjs");require("sonner");require("luxon");function h(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const i=h(w);function s({children:e,title:o,asChild:t=!1,placement:r="bottom",align:d="start",sideOffset:l=4,maxWidth:c,minWidth:u,open:p,onOpenChange:m,modal:f=!1,className:b,triggerClassName:g}){const j=a.cn("z-50 min-w-32 overflow-hidden rounded-lg border border-border bg-gray-40 p-1 text-popover-foreground shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",b);return n.jsxs(i.Root,{open:p,onOpenChange:m,modal:f,children:[n.jsx(i.Trigger,{asChild:t,className:t?void 0:a.cn("inline-flex appearance-none border-0 bg-transparent p-0 text-inherit font-inherit cursor-pointer",g),children:o}),n.jsx(i.Portal,{children:n.jsx(i.Content,{side:r,align:d,sideOffset:l,className:j,style:{maxWidth:c,minWidth:u},children:e})})]})}s.displayName="SimpleDropdown";exports.SimpleDropdown=s;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),K=require("@radix-ui/react-slider"),u=require("react");require("@gearbox-protocol/sdk");const N=require("../../utils/cn.cjs");require("sonner");require("luxon");function C(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const c=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(i,r,c.get?c:{enumerable:!0,get:()=>t[r]})}}return i.default=t,Object.freeze(i)}const a=C(K),E=C(u);function $(t){return{start:t.start??t.from??0,end:t.end??t.to??0}}function G(t,i){if(i)for(const r of i){const{start:c,end:d}=$(r);if(t>=c&&t<=d)return r.color}}const q=E.forwardRef(({className:t,variant:i="default",value:r,onValueChange:c,min:d,max:M,step:S,from:_,to:O,colorIntervals:v,precision:f,markerStep:m,onChangeValue:y,onSubmitValue:p,...R},k)=>{const n=d??_??0,l=M??O??100,j=Array.isArray(f)?f[0]:f,A=S??(j?10**-j:1),b=u.useMemo(()=>{if(Array.isArray(r))return r;if(typeof r=="number")return[r]},[r]),P=e=>{c?.(e),y&&e.length>0&&y(e[0])},T=e=>{p&&e.length>0&&p(e[0])},V=b?.[0]??0,D=G(V,v),x=(b??[0]).length,z=u.useMemo(()=>Array.from({length:x},(e,o)=>`thumb-${o}`),[x]),g=u.useMemo(()=>{if(!m)return;const e=[];for(let o=n;o<=l;o+=m)e.push(o);return e},[n,l,m]);return s.jsxs("div",{className:"relative w-full",children:[s.jsxs(a.Root,{ref:k,className:N.cn("relative flex w-full touch-none select-none items-center",t),min:n,max:l,step:A,value:b,onValueChange:P,onValueCommit:T,...R,children:[s.jsxs(a.Track,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:[v?.map((e,o)=>{const{start:h,end:w}=$(e),B=(h-n)/(l-n)*100,F=(w-h)/(l-n)*100;return s.jsx("div",{className:"absolute h-full",style:{left:`${B}%`,width:`${F}%`,backgroundColor:e.color??"var(--primary)",opacity:.3}},`interval-${o}-${h}-${w}`)}),s.jsx(a.Range,{className:N.cn("absolute h-full"),style:{backgroundColor:D??void 0}})]}),z.map(e=>s.jsx(a.Thumb,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background shadow-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 cursor-grab active:cursor-grabbing hover:bg-accent"},e))]}),g&&g.length>0&&s.jsx("div",{className:"relative w-full h-2 mt-1",children:g.map(e=>{const o=(e-n)/(l-n)*100;return s.jsx("div",{className:"absolute w-0.5 h-1 bg-muted-foreground/50",style:{left:`${o}%`}},`mark-${e}`)})})]})});q.displayName="Slider";exports.Slider=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),Q=require("@radix-ui/react-slider"),m=require("react");require("@gearbox-protocol/sdk");const k=require("../../utils/cn.cjs");require("sonner");require("luxon");function L(t){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const u=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(c,r,u.get?u:{enumerable:!0,get:()=>t[r]})}}return c.default=t,Object.freeze(c)}const M=L(Q),Y=L(m),I={additionalSuccess:"hsl(var(--success))",additionalSuccessLight:"#88c497",additionalWarning:"hsl(var(--warning))",additionalAlert:"hsl(var(--destructive))",additionalLiquidation:"hsl(var(--liquidation))",mainPrimary:"hsl(var(--primary))",mainAccent:"hsl(var(--accent))",textPrimary:"hsl(var(--foreground))",textSecondary:"hsl(var(--secondary-foreground))",gray40:"hsl(var(--gray-40))",gray50:"hsl(var(--gray-50))",gray60:"hsl(var(--gray-60))"};function $(t){if(t)return I[t]??t}function p(t){return{start:t.start??0,end:t.end??0}}function ee(t,c){if(c)for(const r of c){const{start:u,end:g}=p(r);if(t>=u&&t<=g)return $(r.color)}}function te(t,c){if(c)for(const r of c){const{start:u,end:g}=p(r);if(t>=u&&t<=g)return $(r.color)??"hsl(var(--success))"}}const ne=18,D=ne/2;function _(t){return D-D*t/50}function E(t,c,r,u,g){let y=t,v=1/0;for(const b of c){const x=Math.abs(t-b);x<v&&(v=x,y=b)}return v<r?Math.max(u,Math.min(g,y)):t}const F=Y.forwardRef(({className:t,variant:c="default",value:r,onValueChange:u,min:g,max:y,step:v,from:b,to:x,colorIntervals:o,precision:C,markerStep:f,onChangeValue:T,onSubmitValue:q,colorIntervalLabel:A,epsilon:S=8,...U},z)=>{const s=g??b??0,i=y??x??100,V=Array.isArray(C)?C[0]:C,K=v??(V?1/V:void 0),N=m.useMemo(()=>{if(Array.isArray(r))return r;if(typeof r=="number")return[r]},[r]),j=m.useMemo(()=>{const e=new Set;if(o?.length)for(const n of o){const{start:a,end:d}=p(n);e.add(a),e.add(d)}if(f)for(let n=s;n<=i+f*.001;n+=f)e.add(Math.min(n,i));return[...e]},[o,f,s,i]),W=e=>{const n=e.map(a=>j.length>0?E(a,j,S,s,i):a);u?.(n),T&&n.length>0&&T(n[0])},X=e=>{const n=e.map(a=>j.length>0?E(a,j,S,s,i):a);q&&n.length>0&&q(n[0])},R=N?.[0]??0,B=ee(R,o)??{default:"hsl(var(--primary))",success:"hsl(var(--success))",warning:"hsl(var(--warning))",danger:"hsl(var(--destructive))"}[c],H=(N??[0]).length,Z=m.useMemo(()=>Array.from({length:H},(e,n)=>`thumb-${n}`),[H]),P=m.useMemo(()=>{if(!f)return;const e=[s];for(let n=s+f;n<i;n+=f)e.push(n);return e[e.length-1]!==i&&e.push(i),e},[s,i,f]),G=m.useMemo(()=>{if(!o?.length)return;const e=o[o.length-1],{start:n,end:a}=p(e),d=i-s;if(d<=0)return;const h=(n-s)/d*100,w=(a-s)/d*100,O=_(h),J=_(w);return{left:`calc(${(h+w)/2}% + ${(O+J)/2}px)`,transform:"translateX(-50%)"}},[o,s,i]);return l.jsxs("div",{className:"relative w-full px-[9px] pb-3",children:[l.jsx("div",{className:"relative",children:l.jsxs(M.Root,{ref:z,className:k.cn("relative flex w-full touch-none select-none items-center",t),min:s,max:i,step:K,value:N,onValueChange:W,onValueCommit:X,...U,children:[l.jsxs(M.Track,{className:"relative h-1 grow overflow-hidden rounded-full bg-gray-40 mx-[9px]",children:[o?.map((e,n)=>{const{start:a,end:d}=p(e),h=i-s;if(h<=0)return null;const w=(a-s)/h*100,O=(d-a)/h*100;return l.jsx("div",{className:"absolute h-full",style:{left:`${w}%`,width:`${O}%`,backgroundColor:$(e.color)??"hsl(var(--success))"}},`interval-${n}-${a}-${d}`)}),!o?.length&&l.jsx(M.Range,{className:"absolute h-full",style:{backgroundColor:B}})]}),P&&P.length>0&&l.jsx("div",{className:"absolute inset-0 pointer-events-none flex items-center",children:l.jsx("div",{className:"relative w-full",children:P.map(e=>{const n=i-s;if(n<=0)return null;const a=(e-s)/n*100,d=_(a),h=o?.length?te(e,o):e<=R?B:void 0;return l.jsx("div",{className:"absolute h-2.5 w-2.5 rounded-full -translate-x-1/2 -translate-y-1/2",style:{left:`calc(${a}% + ${d}px)`,top:"50%",backgroundColor:h??"hsl(var(--gray-40))"}},`mark-${e}`)})})}),Z.map(e=>l.jsx(M.Thumb,{className:k.cn("relative block h-[18px] w-[18px] rounded-full bg-foreground","cursor-grab active:cursor-grabbing","focus-visible:outline-none","disabled:pointer-events-none disabled:opacity-50","after:absolute after:h-1.5 after:w-1.5 after:rounded-full after:bg-accent","after:top-1/2 after:left-1/2 after:-translate-x-1/2 after:-translate-y-1/2")},e))]})}),A&&o&&o.length>0&&l.jsx("div",{className:"relative h-[14px] mt-2.5",children:l.jsx("div",{className:"absolute text-[11px] font-medium leading-[126%] text-success whitespace-nowrap",style:G,children:A})})]})});F.displayName="Slider";exports.Slider=F;
@@ -1 +1 @@
1
- "use strict";const e={"errors.networkError":"Network error. Can't fetch data","errors.incorrectAddressError":"Incorrect address. Please, check url","errors.noOpenedAccountsError":"You have no opened Credit Accounts. Perhaps, you have recently been liquidated? Check notification centre to see more.","errors.notFound":"Not found","errors.tooManyRequests":"Too many requests","errors.incorrectAddress":"Incorrect address","components.errorMessage.oops":"Oops...","components.alertModal.ok":"Ok","components.footer.privacy":"Privacy Notice","components.footer.terms":"Terms of Service","components.footer.disclosure":"Risk Disclosure Statement","components.footer.legalNotice":"Legal Notice","components.footer.legal":"Legal Info","components.footer.gearbox":"Copyright © Gearbox Foundation 2023-2026.","components.footer.built":"Built at ETHGlobal MarketMake hackathon.","components.footer.version":"Version {value}","components.liquidationPrice.check":"Check Area","components.loading.loading":"Loading","components.loading.wait":"Please wait...","components.smartNumberInput.balance":"Balance","components.smartNumberInput.inputTitle":"Token Amount","components.smartNumberInput.confirm.input":"Input","components.tipWindow.title":"Tip","components.healthFactor.low":"Extremely low! This HF may not cover possible oracle deviations.","components.headCell":"Sort by {value}","components.graphView.noData":"Can't get data for this graph","components.filterBlock.reset":"Reset All","components.APY.tip":"These APYs are derived from the underlying protocols’ APIs and may differ in reality. Check respective protocols for their methodology.","components.creditSessionDetailedLiquidation.graph.legend.point":"Current price","components.creditSessionDetailedLiquidation.graph.legend.area":"Liquidation Area","components.creditSessionDetailedLiquidation.graph.tip.hf":"Health Factor","components.creditSessionDetailedLiquidation.graph.tip.price":"Price","components.creditSessionDetailedLiquidation.table.seeGraph":"See graph","components.creditSessionDetailedLiquidation.table.asset":"Asset","components.creditSessionDetailedLiquidation.table.currentPrice":"Current price","components.creditSessionDetailedLiquidation.table.modelPrice":"Model price","components.apyParts.features.points":"Points","components.apyParts.features.incent":"Incent.","components.apyParts.supplyAPY":"Organic APY","components.apyParts.title":"APY type","components.apyParts.supplyAPY.tip":"Yield from lending funds","components.apyParts.tokenYield":"Intrinsic APY","components.apyParts.tokenYield.tip":"Yield from holding wstETH","components.apyParts.extraAPY":"{symbol} Incentive","components.apyParts.extraAPY.tip":"Calculated at the current rate","components.apyParts.totalAPY":"Overall APY","components.apyParts.points":"{symbol} Incentive","components.apyParts.points.condition.crossDeposit":"For cross-chain deposits made via Omni","components.openCopyButtons.copy":"Copy to clipboard"};module.exports=e;
1
+ "use strict";const e={"errors.networkError":"Network error. Can't fetch data","errors.incorrectAddressError":"Incorrect address. Please, check url","errors.noOpenedAccountsError":"You have no opened Credit Accounts. Perhaps, you have recently been liquidated? Check notification centre to see more.","errors.notFound":"Not found","errors.tooManyRequests":"Too many requests","errors.incorrectAddress":"Incorrect address","components.errorMessage.oops":"Oops...","components.alertModal.ok":"Ok","components.footer.privacy":"Privacy Notice","components.footer.terms":"Terms of Service","components.footer.disclosure":"Risk Disclosure Statement","components.footer.legalNotice":"Legal Notice","components.footer.legal":"Legal Info","components.footer.gearbox":"Copyright © Gearbox Foundation 2023-2026.","components.footer.built":"Built at ETHGlobal MarketMake hackathon.","components.footer.version":"Version {value}","components.liquidationPrice.check":"Check Area","components.loading.loading":"Loading","components.loading.wait":"Please wait...","components.smartNumberInput.balance":"Balance","components.smartNumberInput.inputTitle":"Token Amount","components.smartNumberInput.confirm.input":"Input","components.tipWindow.title":"Tip","components.healthFactor.low":"Extremely low! This HF may not cover possible oracle deviations.","components.headCell":"Sort by {value}","components.graphView.noData":"Can't get data for this graph","components.filterBlock.reset":"Reset All","components.APY.tip":"These APYs are derived from the underlying protocols’ APIs and may differ in reality. Check respective protocols for their methodology.","components.creditSessionDetailedLiquidation.graph.noData":"No data","components.creditSessionDetailedLiquidation.graph.legend.point":"Current price","components.creditSessionDetailedLiquidation.graph.legend.area":"Liquidation Area","components.creditSessionDetailedLiquidation.graph.tip.hf":"Health Factor","components.creditSessionDetailedLiquidation.graph.tip.price":"Price","components.creditSessionDetailedLiquidation.table.noData":"No data","components.creditSessionDetailedLiquidation.table.seeGraph":"See graph","components.creditSessionDetailedLiquidation.table.asset":"Asset","components.creditSessionDetailedLiquidation.table.currentPrice":"Current price","components.creditSessionDetailedLiquidation.table.modelPrice":"Model price","components.apyParts.features.points":"Points","components.apyParts.features.incent":"Incent.","components.apyParts.supplyAPY":"Organic APY","components.apyParts.title":"APY type","components.apyParts.supplyAPY.tip":"Yield from lending funds","components.apyParts.tokenYield":"Intrinsic APY","components.apyParts.tokenYield.tip":"Yield from holding wstETH","components.apyParts.extraAPY":"{symbol} Incentive","components.apyParts.extraAPY.tip":"Calculated at the current rate","components.apyParts.totalAPY":"Overall APY","components.apyParts.points":"{symbol} Incentive","components.apyParts.points.condition.crossDeposit":"For cross-chain deposits made via Omni","components.openCopyButtons.copy":"Copy to clipboard"};module.exports=e;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function a(t){return{from:t.from??t.start??0,to:t.to??t.end??0}}function u(t,n,c){return c.filter(o=>{const{from:e,to:r}=a(o),s=Math.max(t,e),m=Math.min(n,r);return s<m}).map(o=>{const{from:e,to:r}=a(o);return{from:Math.max(t,e),to:Math.min(n,r),start:Math.max(t,e),end:Math.min(n,r),color:o.color}})}exports.getAvailableRanges=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function s(n,r,o){return o.filter(t=>{const e=t.start??0,a=t.end??0;return Math.max(n,e)<Math.min(r,a)}).map(t=>{const e=t.start??0,a=t.end??0;return{start:Math.max(n,e),end:Math.min(r,a),color:t.color}})}exports.getAvailableRanges=s;
@@ -1,63 +1,64 @@
1
- import { jsxs as h, jsx as t } from "react/jsx-runtime";
2
- import * as e from "@radix-ui/react-dropdown-menu";
1
+ import { jsxs as h, jsx as e } from "react/jsx-runtime";
2
+ import * as t from "@radix-ui/react-dropdown-menu";
3
3
  import "react";
4
4
  import "@gearbox-protocol/sdk";
5
- import { cn as o } from "../../utils/cn.js";
5
+ import { cn as r } from "../../utils/cn.js";
6
6
  import "sonner";
7
7
  import "luxon";
8
- function g({
9
- children: r,
10
- title: a,
11
- placement: i = "bottom",
12
- align: n = "start",
13
- sideOffset: d = 4,
14
- maxWidth: s,
15
- minWidth: l,
16
- open: m,
17
- onOpenChange: p,
18
- modal: f = !1,
19
- className: c,
20
- triggerClassName: u
8
+ function w({
9
+ children: a,
10
+ title: i,
11
+ asChild: o = !1,
12
+ placement: n = "bottom",
13
+ align: d = "start",
14
+ sideOffset: s = 4,
15
+ maxWidth: m,
16
+ minWidth: p,
17
+ open: l,
18
+ onOpenChange: f,
19
+ modal: c = !1,
20
+ className: g,
21
+ triggerClassName: b
21
22
  }) {
22
- const b = o(
23
+ const u = r(
23
24
  "z-50 min-w-32 overflow-hidden rounded-lg border border-border bg-gray-40 p-1 text-popover-foreground shadow-lg",
24
25
  "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
25
- c
26
+ g
26
27
  );
27
28
  return /* @__PURE__ */ h(
28
- e.Root,
29
+ t.Root,
29
30
  {
30
- open: m,
31
- onOpenChange: p,
32
- modal: f,
31
+ open: l,
32
+ onOpenChange: f,
33
+ modal: c,
33
34
  children: [
34
- /* @__PURE__ */ t(e.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
35
- "button",
35
+ /* @__PURE__ */ e(
36
+ t.Trigger,
36
37
  {
37
- type: "button",
38
- className: o(
38
+ asChild: o,
39
+ className: o ? void 0 : r(
39
40
  "inline-flex appearance-none border-0 bg-transparent p-0 text-inherit font-inherit cursor-pointer",
40
- u
41
+ b
41
42
  ),
42
- children: a
43
+ children: i
43
44
  }
44
- ) }),
45
- /* @__PURE__ */ t(e.Portal, { children: /* @__PURE__ */ t(
46
- e.Content,
45
+ ),
46
+ /* @__PURE__ */ e(t.Portal, { children: /* @__PURE__ */ e(
47
+ t.Content,
47
48
  {
48
- side: i,
49
- align: n,
50
- sideOffset: d,
51
- className: b,
52
- style: { maxWidth: s, minWidth: l },
53
- children: r
49
+ side: n,
50
+ align: d,
51
+ sideOffset: s,
52
+ className: u,
53
+ style: { maxWidth: m, minWidth: p },
54
+ children: a
54
55
  }
55
56
  ) })
56
57
  ]
57
58
  }
58
59
  );
59
60
  }
60
- g.displayName = "SimpleDropdown";
61
+ w.displayName = "SimpleDropdown";
61
62
  export {
62
- g as SimpleDropdown
63
+ w as SimpleDropdown
63
64
  };
@@ -1,131 +1,224 @@
1
- import { jsxs as g, jsx as i } from "react/jsx-runtime";
2
- import * as l from "@radix-ui/react-slider";
3
- import * as D from "react";
1
+ import { jsxs as T, jsx as d } from "react/jsx-runtime";
2
+ import * as N from "@radix-ui/react-slider";
3
+ import * as J from "react";
4
4
  import { useMemo as v } from "react";
5
5
  import "@gearbox-protocol/sdk";
6
- import { cn as x } from "../../utils/cn.js";
6
+ import { cn as q } from "../../utils/cn.js";
7
7
  import "sonner";
8
8
  import "luxon";
9
- function A(e) {
9
+ const Q = {
10
+ additionalSuccess: "hsl(var(--success))",
11
+ additionalSuccessLight: "#88c497",
12
+ additionalWarning: "hsl(var(--warning))",
13
+ additionalAlert: "hsl(var(--destructive))",
14
+ additionalLiquidation: "hsl(var(--liquidation))",
15
+ mainPrimary: "hsl(var(--primary))",
16
+ mainAccent: "hsl(var(--accent))",
17
+ textPrimary: "hsl(var(--foreground))",
18
+ textSecondary: "hsl(var(--secondary-foreground))",
19
+ gray40: "hsl(var(--gray-40))",
20
+ gray50: "hsl(var(--gray-50))",
21
+ gray60: "hsl(var(--gray-60))"
22
+ };
23
+ function O(n) {
24
+ if (n)
25
+ return Q[n] ?? n;
26
+ }
27
+ function p(n) {
10
28
  return {
11
- start: e.start ?? e.from ?? 0,
12
- end: e.end ?? e.to ?? 0
29
+ start: n.start ?? 0,
30
+ end: n.end ?? 0
13
31
  };
14
32
  }
15
- function E(e, a) {
16
- if (a)
17
- for (const o of a) {
18
- const { start: c, end: f } = A(o);
19
- if (e >= c && e <= f)
20
- return o.color;
33
+ function Y(n, c) {
34
+ if (c)
35
+ for (const i of c) {
36
+ const { start: h, end: m } = p(i);
37
+ if (n >= h && n <= m)
38
+ return O(i.color);
39
+ }
40
+ }
41
+ function I(n, c) {
42
+ if (c)
43
+ for (const i of c) {
44
+ const { start: h, end: m } = p(i);
45
+ if (n >= h && n <= m)
46
+ return O(i.color) ?? "hsl(var(--success))";
21
47
  }
22
48
  }
23
- const G = D.forwardRef(
49
+ const tt = 18, F = tt / 2;
50
+ function V(n) {
51
+ return F - F * n / 50;
52
+ }
53
+ function S(n, c, i, h, m) {
54
+ let y = n, g = 1 / 0;
55
+ for (const b of c) {
56
+ const x = Math.abs(n - b);
57
+ x < g && (g = x, y = b);
58
+ }
59
+ return g < i ? Math.max(h, Math.min(m, y)) : n;
60
+ }
61
+ const et = J.forwardRef(
24
62
  ({
25
- className: e,
26
- variant: a = "default",
63
+ className: n,
64
+ variant: c = "default",
27
65
  // New API
28
- value: o,
29
- onValueChange: c,
30
- min: f,
31
- max: k,
32
- step: R,
66
+ value: i,
67
+ onValueChange: h,
68
+ min: m,
69
+ max: y,
70
+ step: g,
33
71
  // Legacy API
34
- from: M,
35
- to: V,
36
- colorIntervals: p,
37
- precision: u,
38
- markerStep: d,
39
- onChangeValue: y,
40
- onSubmitValue: w,
41
- ...j
42
- }, T) => {
43
- const n = f ?? M ?? 0, s = k ?? V ?? 100, N = Array.isArray(u) ? u[0] : u, B = R ?? (N ? 10 ** -N : 1), m = v(() => {
44
- if (Array.isArray(o)) return o;
45
- if (typeof o == "number") return [o];
46
- }, [o]), F = (r) => {
47
- c?.(r), y && r.length > 0 && y(r[0]);
48
- }, K = (r) => {
49
- w && r.length > 0 && w(r[0]);
50
- }, P = m?.[0] ?? 0, S = E(P, p), C = (m ?? [0]).length, _ = v(
51
- () => Array.from({ length: C }, (r, t) => `thumb-${t}`),
52
- [C]
53
- ), h = v(() => {
54
- if (!d) return;
55
- const r = [];
56
- for (let t = n; t <= s; t += d)
57
- r.push(t);
58
- return r;
59
- }, [n, s, d]);
60
- return /* @__PURE__ */ g("div", { className: "relative w-full", children: [
61
- /* @__PURE__ */ g(
62
- l.Root,
72
+ from: b,
73
+ to: x,
74
+ colorIntervals: a,
75
+ precision: M,
76
+ markerStep: f,
77
+ onChangeValue: R,
78
+ onSubmitValue: _,
79
+ colorIntervalLabel: B,
80
+ epsilon: H = 8,
81
+ ...U
82
+ }, D) => {
83
+ const r = m ?? b ?? 0, o = y ?? x ?? 100, E = Array.isArray(M) ? M[0] : M, K = g ?? (E ? 1 / E : void 0), $ = v(() => {
84
+ if (Array.isArray(i)) return i;
85
+ if (typeof i == "number") return [i];
86
+ }, [i]), w = v(() => {
87
+ const t = /* @__PURE__ */ new Set();
88
+ if (a?.length)
89
+ for (const e of a) {
90
+ const { start: s, end: l } = p(e);
91
+ t.add(s), t.add(l);
92
+ }
93
+ if (f)
94
+ for (let e = r; e <= o + f * 1e-3; e += f)
95
+ t.add(Math.min(e, o));
96
+ return [...t];
97
+ }, [a, f, r, o]), W = (t) => {
98
+ const e = t.map(
99
+ (s) => w.length > 0 ? S(s, w, H, r, o) : s
100
+ );
101
+ h?.(e), R && e.length > 0 && R(e[0]);
102
+ }, X = (t) => {
103
+ const e = t.map(
104
+ (s) => w.length > 0 ? S(s, w, H, r, o) : s
105
+ );
106
+ _ && e.length > 0 && _(e[0]);
107
+ }, L = $?.[0] ?? 0, j = Y(L, a) ?? {
108
+ default: "hsl(var(--primary))",
109
+ success: "hsl(var(--success))",
110
+ warning: "hsl(var(--warning))",
111
+ danger: "hsl(var(--destructive))"
112
+ }[c], k = ($ ?? [0]).length, Z = v(
113
+ () => Array.from({ length: k }, (t, e) => `thumb-${e}`),
114
+ [k]
115
+ ), A = v(() => {
116
+ if (!f) return;
117
+ const t = [r];
118
+ for (let e = r + f; e < o; e += f)
119
+ t.push(e);
120
+ return t[t.length - 1] !== o && t.push(o), t;
121
+ }, [r, o, f]), z = v(() => {
122
+ if (!a?.length) return;
123
+ const t = a[a.length - 1], { start: e, end: s } = p(t), l = o - r;
124
+ if (l <= 0) return;
125
+ const u = (e - r) / l * 100, C = (s - r) / l * 100, P = V(u), G = V(C);
126
+ return {
127
+ left: `calc(${(u + C) / 2}% + ${(P + G) / 2}px)`,
128
+ transform: "translateX(-50%)"
129
+ };
130
+ }, [a, r, o]);
131
+ return /* @__PURE__ */ T("div", { className: "relative w-full px-[9px] pb-3", children: [
132
+ /* @__PURE__ */ d("div", { className: "relative", children: /* @__PURE__ */ T(
133
+ N.Root,
63
134
  {
64
- ref: T,
65
- className: x(
135
+ ref: D,
136
+ className: q(
66
137
  "relative flex w-full touch-none select-none items-center",
67
- e
138
+ n
68
139
  ),
69
- min: n,
70
- max: s,
71
- step: B,
72
- value: m,
73
- onValueChange: F,
74
- onValueCommit: K,
75
- ...j,
140
+ min: r,
141
+ max: o,
142
+ step: K,
143
+ value: $,
144
+ onValueChange: W,
145
+ onValueCommit: X,
146
+ ...U,
76
147
  children: [
77
- /* @__PURE__ */ g(l.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-secondary", children: [
78
- p?.map((r, t) => {
79
- const { start: b, end: $ } = A(r), q = (b - n) / (s - n) * 100, z = ($ - b) / (s - n) * 100;
80
- return /* @__PURE__ */ i(
148
+ /* @__PURE__ */ T(N.Track, { className: "relative h-1 grow overflow-hidden rounded-full bg-gray-40 mx-[9px]", children: [
149
+ a?.map((t, e) => {
150
+ const { start: s, end: l } = p(t), u = o - r;
151
+ if (u <= 0) return null;
152
+ const C = (s - r) / u * 100, P = (l - s) / u * 100;
153
+ return /* @__PURE__ */ d(
81
154
  "div",
82
155
  {
83
156
  className: "absolute h-full",
84
157
  style: {
85
- left: `${q}%`,
86
- width: `${z}%`,
87
- backgroundColor: r.color ?? "var(--primary)",
88
- opacity: 0.3
158
+ left: `${C}%`,
159
+ width: `${P}%`,
160
+ backgroundColor: O(t.color) ?? "hsl(var(--success))"
89
161
  }
90
162
  },
91
- `interval-${t}-${b}-${$}`
163
+ `interval-${e}-${s}-${l}`
92
164
  );
93
165
  }),
94
- /* @__PURE__ */ i(
95
- l.Range,
166
+ !a?.length && /* @__PURE__ */ d(
167
+ N.Range,
96
168
  {
97
- className: x("absolute h-full"),
169
+ className: "absolute h-full",
98
170
  style: {
99
- backgroundColor: S ?? void 0
171
+ backgroundColor: j
100
172
  }
101
173
  }
102
174
  )
103
175
  ] }),
104
- _.map((r) => /* @__PURE__ */ i(
105
- l.Thumb,
176
+ A && A.length > 0 && /* @__PURE__ */ d("div", { className: "absolute inset-0 pointer-events-none flex items-center", children: /* @__PURE__ */ d("div", { className: "relative w-full", children: A.map((t) => {
177
+ const e = o - r;
178
+ if (e <= 0) return null;
179
+ const s = (t - r) / e * 100, l = V(s), u = a?.length ? I(t, a) : t <= L ? j : void 0;
180
+ return /* @__PURE__ */ d(
181
+ "div",
182
+ {
183
+ className: "absolute h-2.5 w-2.5 rounded-full -translate-x-1/2 -translate-y-1/2",
184
+ style: {
185
+ left: `calc(${s}% + ${l}px)`,
186
+ top: "50%",
187
+ backgroundColor: u ?? "hsl(var(--gray-40))"
188
+ }
189
+ },
190
+ `mark-${t}`
191
+ );
192
+ }) }) }),
193
+ Z.map((t) => /* @__PURE__ */ d(
194
+ N.Thumb,
106
195
  {
107
- className: "block h-5 w-5 rounded-full border-2 border-primary bg-background shadow-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 cursor-grab active:cursor-grabbing hover:bg-accent"
196
+ className: q(
197
+ "relative block h-[18px] w-[18px] rounded-full bg-foreground",
198
+ "cursor-grab active:cursor-grabbing",
199
+ "focus-visible:outline-none",
200
+ "disabled:pointer-events-none disabled:opacity-50",
201
+ "after:absolute after:h-1.5 after:w-1.5 after:rounded-full after:bg-accent",
202
+ "after:top-1/2 after:left-1/2 after:-translate-x-1/2 after:-translate-y-1/2"
203
+ )
108
204
  },
109
- r
205
+ t
110
206
  ))
111
207
  ]
112
208
  }
113
- ),
114
- h && h.length > 0 && /* @__PURE__ */ i("div", { className: "relative w-full h-2 mt-1", children: h.map((r) => {
115
- const t = (r - n) / (s - n) * 100;
116
- return /* @__PURE__ */ i(
117
- "div",
118
- {
119
- className: "absolute w-0.5 h-1 bg-muted-foreground/50",
120
- style: { left: `${t}%` }
121
- },
122
- `mark-${r}`
123
- );
124
- }) })
209
+ ) }),
210
+ B && a && a.length > 0 && /* @__PURE__ */ d("div", { className: "relative h-[14px] mt-2.5", children: /* @__PURE__ */ d(
211
+ "div",
212
+ {
213
+ className: "absolute text-[11px] font-medium leading-[126%] text-success whitespace-nowrap",
214
+ style: z,
215
+ children: B
216
+ }
217
+ ) })
125
218
  ] });
126
219
  }
127
220
  );
128
- G.displayName = "Slider";
221
+ et.displayName = "Slider";
129
222
  export {
130
- G as Slider
223
+ et as Slider
131
224
  };
@@ -27,10 +27,12 @@ const e = {
27
27
  "components.graphView.noData": "Can't get data for this graph",
28
28
  "components.filterBlock.reset": "Reset All",
29
29
  "components.APY.tip": "These APYs are derived from the underlying protocols’ APIs and may differ in reality. Check respective protocols for their methodology.",
30
+ "components.creditSessionDetailedLiquidation.graph.noData": "No data",
30
31
  "components.creditSessionDetailedLiquidation.graph.legend.point": "Current price",
31
32
  "components.creditSessionDetailedLiquidation.graph.legend.area": "Liquidation Area",
32
33
  "components.creditSessionDetailedLiquidation.graph.tip.hf": "Health Factor",
33
34
  "components.creditSessionDetailedLiquidation.graph.tip.price": "Price",
35
+ "components.creditSessionDetailedLiquidation.table.noData": "No data",
34
36
  "components.creditSessionDetailedLiquidation.table.seeGraph": "See graph",
35
37
  "components.creditSessionDetailedLiquidation.table.asset": "Asset",
36
38
  "components.creditSessionDetailedLiquidation.table.currentPrice": "Current price",
@@ -1,21 +1,13 @@
1
- function a(t) {
2
- return {
3
- from: t.from ?? t.start ?? 0,
4
- to: t.to ?? t.end ?? 0
5
- };
6
- }
7
- function s(t, e, c) {
8
- return c.filter((o) => {
9
- const { from: r, to: n } = a(o), m = Math.max(t, r), f = Math.min(e, n);
10
- return m < f;
11
- }).map((o) => {
12
- const { from: r, to: n } = a(o);
1
+ function s(a, e, o) {
2
+ return o.filter((t) => {
3
+ const n = t.start ?? 0, r = t.end ?? 0;
4
+ return Math.max(a, n) < Math.min(e, r);
5
+ }).map((t) => {
6
+ const n = t.start ?? 0, r = t.end ?? 0;
13
7
  return {
14
- from: Math.max(t, r),
15
- to: Math.min(e, n),
16
- start: Math.max(t, r),
17
- end: Math.min(e, n),
18
- color: o.color
8
+ start: Math.max(a, n),
9
+ end: Math.min(e, r),
10
+ color: t.color
19
11
  };
20
12
  });
21
13
  }