@gearbox-protocol/permissionless-ui 1.26.5 → 1.26.7
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/checkbox-item/checkbox-item.cjs +1 -1
- package/dist/cjs/components/dropdown-menu/dropdown-menu-checkbox-item.cjs +1 -1
- package/dist/cjs/components/dropdown-menu/dropdown-menu-item.cjs +1 -1
- package/dist/cjs/components/filter/filter-modal.cjs +1 -1
- package/dist/cjs/components/graph/formatters.cjs +1 -1
- package/dist/cjs/components/liquidation/liquidation-assets-table/liquidation-assets-table.cjs +1 -1
- package/dist/cjs/components/trading-view/trading-view.cjs +1 -1
- package/dist/cjs/components/typed-intl/index.cjs +1 -1
- package/dist/cjs/locale/en.json.cjs +1 -1
- package/dist/esm/components/checkbox-item/checkbox-item.js +1 -1
- package/dist/esm/components/dropdown-menu/dropdown-menu-checkbox-item.js +1 -1
- package/dist/esm/components/dropdown-menu/dropdown-menu-item.js +1 -1
- package/dist/esm/components/filter/filter-modal.js +132 -107
- package/dist/esm/components/graph/formatters.js +3 -3
- package/dist/esm/components/liquidation/liquidation-assets-table/liquidation-assets-table.js +1 -1
- package/dist/esm/components/trading-view/trading-view.js +122 -122
- package/dist/esm/components/typed-intl/index.js +12 -12
- package/dist/esm/locale/en.json.js +5 -0
- package/dist/globals.css +1 -1
- package/dist/types/components/typed-intl/index.d.ts +3 -1
- package/dist/types/locale/en.json.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),m=require("react"),p=require("@fortawesome/free-solid-svg-icons"),f=require("../icons/fa-icon.cjs");require("@gearbox-protocol/sdk");const s=require("../../utils/cn.cjs");require("sonner");require("luxon");require("../../utils/z-index.cjs");function d(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:()=>r[e]})}}return t.default=r,Object.freeze(t)}const b=d(m),i=b.forwardRef(({className:r,children:t,checked:e,onCheckedChange:n,disabled:c,...a},l)=>o.jsxs("label",{ref:l,className:s.cn("relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors","hover:bg-secondary",c&&"pointer-events-none opacity-50",r),...a,children:[o.jsx("input",{type:"checkbox",checked:e,onChange:u=>n?.(u.target.checked),disabled:c,className:"sr-only"}),o.jsx("span",{className:s.cn("absolute left-2 flex h-4 w-4 items-center justify-center rounded-[4px] border border-primary shadow transition-colors",e&&"bg-primary text-primary-foreground"),children:e&&o.jsx(f.FaIcon,{icon:p.faCheck,className:"size-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),m=require("react"),p=require("@fortawesome/free-solid-svg-icons"),f=require("../icons/fa-icon.cjs");require("@gearbox-protocol/sdk");const s=require("../../utils/cn.cjs");require("sonner");require("luxon");require("../../utils/z-index.cjs");function d(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:()=>r[e]})}}return t.default=r,Object.freeze(t)}const b=d(m),i=b.forwardRef(({className:r,children:t,checked:e,onCheckedChange:n,disabled:c,...a},l)=>o.jsxs("label",{ref:l,className:s.cn("relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors","hover:bg-secondary",c&&"pointer-events-none opacity-50",r),...a,children:[o.jsx("input",{type:"checkbox",checked:e,onChange:u=>n?.(u.target.checked),disabled:c,className:"sr-only"}),o.jsx("span",{className:s.cn("absolute left-2 flex h-4 w-4 items-center justify-center rounded-[4px] border border-primary shadow transition-colors",e&&"bg-primary text-primary-foreground"),children:e&&o.jsx(f.FaIcon,{icon:p.faCheck,className:"size-3!"})}),t]}));i.displayName="CheckboxItem";exports.CheckboxItem=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),d=require("@radix-ui/react-dropdown-menu"),f=require("react"),m=require("@fortawesome/free-solid-svg-icons"),p=require("../icons/fa-icon.cjs");require("@gearbox-protocol/sdk");const b=require("../../utils/cn.cjs");require("sonner");require("luxon");require("../../utils/z-index.cjs");function s(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 c=s(d),x=s(f),i=x.forwardRef(({className:e,children:o,checked:t,onCheckedChange:n,disabled:a,...u},l)=>r.jsxs(c.CheckboxItem,{ref:l,className:b.cn("relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors hover:text-foreground hover:bg-secondary focus-visible:outline-none focus:bg-secondary focus:text-foreground data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:t,onCheckedChange:n,disabled:a,...u,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(c.ItemIndicator,{children:r.jsx(p.FaIcon,{icon:m.faCheck,className:"size-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),d=require("@radix-ui/react-dropdown-menu"),f=require("react"),m=require("@fortawesome/free-solid-svg-icons"),p=require("../icons/fa-icon.cjs");require("@gearbox-protocol/sdk");const b=require("../../utils/cn.cjs");require("sonner");require("luxon");require("../../utils/z-index.cjs");function s(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 c=s(d),x=s(f),i=x.forwardRef(({className:e,children:o,checked:t,onCheckedChange:n,disabled:a,...u},l)=>r.jsxs(c.CheckboxItem,{ref:l,className:b.cn("relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors hover:text-foreground hover:bg-secondary focus-visible:outline-none focus:bg-secondary focus:text-foreground data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:t,onCheckedChange:n,disabled:a,...u,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(c.ItemIndicator,{children:r.jsx(p.FaIcon,{icon:m.faCheck,className:"size-3!"})})}),o]}));i.displayName=c.CheckboxItem.displayName;exports.DropdownMenuCheckboxItem=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),c=require("@radix-ui/react-dropdown-menu"),u=require("react");require("@gearbox-protocol/sdk");const d=require("../../utils/cn.cjs");require("sonner");require("luxon");require("../../utils/z-index.cjs");function n(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const i=n(c),l=n(u),s=l.forwardRef(({className:e,inset:r,...t},o)=>a.jsx(i.Item,{ref:o,className:d.cn("relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors hover:text-foreground hover:bg-secondary focus-visible:outline-none focus:bg-secondary focus:text-foreground data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),c=require("@radix-ui/react-dropdown-menu"),u=require("react");require("@gearbox-protocol/sdk");const d=require("../../utils/cn.cjs");require("sonner");require("luxon");require("../../utils/z-index.cjs");function n(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const i=n(c),l=n(u),s=l.forwardRef(({className:e,inset:r,...t},o)=>a.jsx(i.Item,{ref:o,className:d.cn("relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors hover:text-foreground hover:bg-secondary focus-visible:outline-none focus:bg-secondary focus:text-foreground data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-3! [&>svg]:shrink-0",r&&"pl-8",e),...t}));s.displayName=i.Item.displayName;exports.DropdownMenuItem=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),U=require("react");require("../buttons/back-button/back-button.cjs");const _=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("@gearbox-protocol/sdk");const A=require("../../utils/cn.cjs");require("sonner");const j=require("../../utils/react.cjs");require("luxon");require("../../utils/z-index.cjs");require("../buttons/tab-button/tab-button.cjs");const D=require("../checkbox-item/checkbox-item.cjs");require("../modal/modal.cjs");const W=require("../dialog/dialog.cjs");require("../dialog/dialog-container.cjs");const X=require("../dialog/dialog-content.cjs");require("../dialog/dialog-description.cjs");const Y=require("../dialog/dialog-footer.cjs"),Z=require("../dialog/dialog-header.cjs"),$=require("../dialog/dialog-title.cjs");require("../dialog/dialog-modal-container.cjs");require("../dialog/dialog-overlay.cjs");require("viem");require("../input/input.cjs");require("../label/label.cjs");const ee=require("../search-line/search-line.cjs"),M=require("../tabs/tabs.cjs"),te=require("../typed-intl/index.cjs");function re(n){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const a in n)if(a!=="default"){const x=Object.getOwnPropertyDescriptor(n,a);Object.defineProperty(r,a,x.get?x:{enumerable:!0,get:()=>n[a]})}}return r.default=n,Object.freeze(r)}const o=re(U);function m(n,r){return n?Array.isArray(n)?n.includes(r):n.has(r):!1}function se({title:n,state:r,modalShow:a,onOpen:x,onClose:b,onReset:T,options:p,tabbedOptions:c,onSelect:C,className:R,optionsClassName:F,resetLabel:z,applyLabel:P,showApplyButton:B=!1,showSearch:V=!1}){const{formatMessage:u}=te.useIntlTyped(),[d,N]=o.useState(""),H=z??u({messageId:"components.filterModal.reset",defaultMessage:"Reset"}),S=P??u({messageId:"components.filterModal.apply",defaultMessage:"Apply"}),[v,Q]=o.useState([]),[q,E]=o.useState([]),G=o.useCallback(()=>{T()},[T]),J=o.useCallback(()=>{b()},[b]),k=o.useMemo(()=>{if(!v)return[];if(!d.trim())return v;const e=d.toLowerCase().trim();return v.filter(s=>j.extractTextFromLabel(s.label).toLowerCase().includes(e))},[v,d]),f=o.useMemo(()=>{if(!q)return[];if(!d.trim())return q;const e=d.toLowerCase().trim();return q.map(s=>({...s,options:s.options.filter(l=>j.extractTextFromLabel(l.label).toLowerCase().includes(e))})).filter(s=>s.options.length>0)},[q,d]),I=o.useMemo(()=>f.length>0?f[0].tab:"",[f]),O=o.useRef(a);o.useEffect(()=>{const e=O.current,s=a;if(!e&&s){if(p){const l=[...p].sort((i,h)=>{const y=m(r,i.value),g=m(r,h.value);return y&&!g?-1:!y&&g?1:0});Q(l)}if(c){const l=c.map(i=>({...i,options:[...i.options].sort((h,y)=>{const g=m(r,h.value),w=m(r,y.value);return g&&!w?-1:!g&&w?1:0})}));E(l)}}else e&&!s&&N("");O.current=a},[a,r,p,c]);const L=o.useMemo(()=>c?c.reduce((e,s)=>e+s.options.length,0):p?.length??0,[p,c]),K=o.useMemo(()=>({value:d,handleInput:e=>{N(e.target.value)},handleSubmit:e=>{e.preventDefault()}}),[d]);return t.jsx(W.Dialog,{open:a,onOpenChange:e=>e?x():b(),children:t.jsxs(X.DialogContent,{className:A.cn("max-w-lg",R),children:[t.jsx(Z.DialogHeader,{children:t.jsx($.DialogTitle,{children:n})}),V&&t.jsx(ee.SearchLine,{searchState:K,placeholder:u({messageId:"components.filterModal.searchPlaceholder",defaultMessage:"Search options..."}),size:"full"}),t.jsx("div",{className:A.cn(c?"":"max-h-[60vh] overflow-y-auto",F),children:c?f.length===0?t.jsx("div",{className:"text-center text-sm text-muted-foreground",children:u(L===0?{messageId:"components.filterModal.noOptionsAvailable",defaultMessage:"No options available"}:{messageId:"components.filterModal.noOptionsMatchSearch",defaultMessage:"No options match your search"})}):t.jsxs(M.Tabs,{defaultValue:I,className:"w-full",children:[t.jsx(M.TabsList,{className:"w-full justify-start",children:f.map(e=>t.jsx(M.TabsTrigger,{value:e.tab,children:e.label},e.tab))}),f.map(e=>t.jsx(M.TabsContent,{value:e.tab,className:"mt-4 max-h-[60vh] overflow-y-auto",children:e.options.length===0?t.jsx("div",{className:"text-center text-sm text-muted-foreground",children:u({messageId:"components.filterModal.noOptionsAvailable",defaultMessage:"No options available"})}):t.jsx("div",{className:"space-y-1",children:e.options.map(s=>{const l=m(r,s.value),i=j.serializeValue(s.value);return t.jsx(D.CheckboxItem,{checked:l,onCheckedChange:h=>C(s.value,h),children:s.label},i)})})},e.tab))]},I):k.length===0?t.jsx("div",{className:"text-center text-sm text-muted-foreground",children:u(L===0?{messageId:"components.filterModal.noOptionsAvailable",defaultMessage:"No options available"}:{messageId:"components.filterModal.noOptionsMatchSearch",defaultMessage:"No options match your search"})}):t.jsx("div",{className:"space-y-1",children:k.map(e=>{const s=m(r,e.value),l=j.serializeValue(e.value);return t.jsx(D.CheckboxItem,{checked:s,onCheckedChange:i=>C(e.value,i),children:e.label},l)})})}),t.jsxs(Y.DialogFooter,{className:"flex-row justify-between gap-2 sm:justify-between",children:[t.jsx(_.Button,{type:"button",variant:"outline",onClick:G,disabled:!r||(Array.isArray(r)?r.length===0:r.size===0),children:H}),B?t.jsx(_.Button,{type:"button",onClick:J,children:S}):t.jsx(_.Button,{type:"button",variant:"default",onClick:b,children:S})]})]})})}exports.FilterModal=se;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("lightweight-charts"),D=require("luxon"),u=require("../../utils/format-number.cjs"),{MIN_DISPLAY_THRESHOLD:g,MAX_EXPONENTIAL_THRESHOLD:b}=u.FORMAT_CONSTANTS,O=(t,e,a="full")=>{if(u.isBelowDisplayThreshold(t))return e?`<${g}${e}`:`<${g}`;if(t===0)return e?`0${e}`:"0";const n=u.formatNumberWithSuffix(t,{maxExponentialThreshold:b,minimumFractionDigits:0,maximumFractionDigits:a==="short"?1:0,format:a,adaptiveDecimals:a==="short"});return e?`${n}${e}`:n},X=2,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("lightweight-charts"),D=require("luxon"),u=require("../../utils/format-number.cjs"),{MIN_DISPLAY_THRESHOLD:g,MAX_EXPONENTIAL_THRESHOLD:b}=u.FORMAT_CONSTANTS,O=(t,e,a="full")=>{if(u.isBelowDisplayThreshold(t))return e?`<${g}${e}`:`<${g}`;if(t===0)return e?`0${e}`:"0";const n=u.formatNumberWithSuffix(t,{maxExponentialThreshold:b,minimumFractionDigits:0,maximumFractionDigits:a==="short"?1:0,format:a,adaptiveDecimals:a==="short"});return e?`${n}${e}`:n},X=2,H=(t,e)=>{if(u.isBelowDisplayThreshold(t))return e?`<${g}${e}`:`<${g}`;if(t===0)return e?`0${e}`:"0";const a=u.toSignificantDigits(t,X);return e?`${a}${e}`:a},w=4,V=t=>{if(u.isBelowDisplayThreshold(t))return`<${g}`;if(t===0)return"0";const e=Math.round(t),a=Math.abs(t-e);return a>0&&a<.01?t.toFixed(12).replace(/0+$/,"").replace(/\.$/,""):u.toSignificantDigits(t,w)},G=(t,e)=>{if(u.isBelowDisplayThreshold(t))return e?`<${g} ${e}`:`<${g}`;if(t===0)return e?`0 ${e}`:"0";const a=Number.isInteger(t),n=Math.abs(t),c=a&&n>=1e3,s=Math.round(t),o=Math.abs(t-s);if(o>0&&o<.01&&!c){const $=t.toFixed(12).replace(/0+$/,"").replace(/\.$/,"");return e?`${$} ${e}`:$}const F=u.formatNumberWithSuffix(t,{maxExponentialThreshold:b,minimumFractionDigits:a?0:2,maximumFractionDigits:c?1:a?0:2,format:c?"short":"full",adaptiveDecimals:c});return e?`${F} ${e}`:F},N={"%":H,$:O,token:G,none:V},P=t=>N[t]||N.token;function U(t,e,a=4){if(t===0)return e?`0 ${e}`:"0";const n=e&&Math.abs(t)>=1e3?0:a,c=t.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:n});return e?`${c} ${e}`:c}function C(t,e,a){const n=a?.yScaleMin;let c=t.length>0?Math.min(...t):0,s=t.length>0?Math.max(...t):0,o=[];const d=()=>{const r=s-c,i=(c+s)/2;let f=1,m="";i>=1e9?(f=1e9,m="B"):i>=1e6?(f=1e6,m="M"):i>=1e3&&(f=1e3,m="K");const x=r/10/f;let l=1;if(x>0){const k=Math.floor(Math.log10(x));l=Math.max(1,-k),l=Math.min(l,4)}return{scale:f,suffix:m,decimals:l}},F=(r,i,f)=>{const m=i>1?r/i:r,h=Math.abs(m)>=1?1:4;return i>1?`${(r/i).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:h,useGrouping:!1})}${f}`:r.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:h,useGrouping:!1})},$=.02,L=r=>{if(n!==void 0&&r<n)return"";if(r===0)return"0";const{scale:i,suffix:f,decimals:m}=d(),h=s-c,S=h>0?o.filter(M=>Math.abs(M)>=h*$):o,l=(h>0?h/10:0)*.05,k=Math.abs(r)*1e-10||1e-10;if(S.some(M=>Math.abs(M-r)<k))return F(r,i,f);if(S.length>0&&l>0){const M=S.reduce((p,E)=>Math.abs(E-r)<Math.abs(p-r)?E:p);if(Math.abs(r-M)<l)return F(M,i,f)}const R=i>1?r/i:r,A=Math.abs(R)>=1?Math.min(1,m):m;return i>1?`${(r/i).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:A,useGrouping:!1})}${f}`:r.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:A,useGrouping:!1})};return{formatter:r=>L(r),tickmarksFormatter:r=>{const i=new Set;return r.map(f=>{const m=L(f);return!m||i.has(m)?"":(i.add(m),m)})},updateVisibleRange:r=>{r.length>0&&(c=Math.min(...r),s=Math.max(...r))},updateLastValues:r=>{o=[...r]}}}const I=t=>D.DateTime.fromSeconds(Number(t)).toFormat("dd/LL/yyyy HH:mm"),Y=t=>D.DateTime.fromSeconds(Number(t)).toFormat("HH:mm"),B=(t,e)=>H(Number(t),e),_={time:I,"%":B};function W(t){const e=new Map;return(a,n,c)=>{const s=D.DateTime.fromSeconds(Number(a));let o;if(t===0)o=s.toFormat("HH:mm");else switch(n){case T.TickMarkType.Year:o=s.toFormat("yyyy");break;case T.TickMarkType.Month:o=s.toFormat("MMM yy");break;case T.TickMarkType.DayOfMonth:o=t>365?s.toFormat("dd MMM yy"):s.toFormat("dd MMM");break;case T.TickMarkType.Time:case T.TickMarkType.TimeWithSeconds:o=s.toFormat("HH:mm");break;default:o=s.toFormat("dd MMM")}let d=e.get(n);return d||(d=new Set,e.set(n,d)),d.has(o)?" ":(d.add(o),o)}}const y=(t,e)=>{if(t==="time"&&e&&e.length>0){const n=D.DateTime.fromSeconds(Number(e[0].time)),c=D.DateTime.fromSeconds(Number(e[e.length-1].time)),s=n.hasSame(c,"day"),o=s?0:Math.ceil(c.diff(n,"days").days);return{timeFormatter:s?Y:I,tickMarkFormatter:W(o)}}const a=_[t]||_.time;return{timeFormatter:a,tickMarkFormatter:n=>a(n,void 0)}},q=(t,e)=>y(t,e).timeFormatter;exports.createAdaptiveYAxisFormatter=C;exports.formatExactValue=U;exports.getXFormatter=q;exports.getXFormatters=y;exports.getYFormatter=P;
|
package/dist/cjs/components/liquidation/liquidation-assets-table/liquidation-assets-table.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("@gearbox-protocol/sdk"),p=require("react"),b=require("../../token-symbol/token-symbol.cjs"),s=require("../../typed-intl/index.cjs"),j=require("../../../hooks/use-media-query.cjs"),o=require("../../../utils/cn.cjs");function y({tokensList:r,graphParams:l,data:a,prices:n,editedPrices:c}){const{fixedBalances:i}=l,u=p.useMemo(()=>m.AssetUtils.constructAssetRecord(i),[i]),x=j.useIsMobile();return!a||!a.length?e.jsx("div",{className:"w-full flex items-center justify-center py-8 text-sm text-muted-foreground",children:e.jsx(s.FormattedMessageTyped,{messageId:"components.creditSessionDetailedLiquidation.table.noData",defaultMessage:"No data"})}):e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:o.cn("grid w-full px-3 sm:px-4 gap-1 sm:gap-2 items-center","h-7 sm:h-8 md:h-[30px]","relative after:absolute after:bottom-0 after:left-2 sm:after:left-3 after:right-2 sm:after:right-3 after:h-px after:border-b after:border-border"),style:{gridTemplateColumns:"1fr 1fr 1fr"},children:[e.jsx("div",{className:"text-left text-xs sm:text-sm font-medium text-muted-foreground truncate",children:e.jsx(s.FormattedMessageTyped,{messageId:"components.creditSessionDetailedLiquidation.table.asset"})}),e.jsx("div",{className:"text-right text-xs sm:text-sm font-medium text-muted-foreground truncate",children:e.jsx(s.FormattedMessageTyped,{messageId:"components.creditSessionDetailedLiquidation.table.currentPrice"})}),e.jsx("div",{className:"text-right text-xs sm:text-sm font-medium text-muted-foreground truncate",children:e.jsx(s.FormattedMessageTyped,{messageId:"components.creditSessionDetailedLiquidation.table.modelPrice"})})]}),a.map((t,f,g)=>{const h=g.length-1===f;return e.jsxs("div",{className:o.cn("grid w-full px-3 sm:px-4 gap-1 sm:gap-2 items-center relative","h-12 sm:h-14 md:h-[51px]",!h&&"after:absolute after:bottom-0 after:left-2 sm:after:left-3 after:right-2 sm:after:right-3 after:h-px after:border-b after:border-border"),style:{gridTemplateColumns:"1fr 1fr 1fr"},children:[e.jsx("div",{className:"text-left min-w-0",children:e.jsx(b.TokenSymbol,{size:x?18:24,token:r[t.token],showSymbol:!0,maxLength:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("@gearbox-protocol/sdk"),p=require("react"),b=require("../../token-symbol/token-symbol.cjs"),s=require("../../typed-intl/index.cjs"),j=require("../../../hooks/use-media-query.cjs"),o=require("../../../utils/cn.cjs");function y({tokensList:r,graphParams:l,data:a,prices:n,editedPrices:c}){const{fixedBalances:i}=l,u=p.useMemo(()=>m.AssetUtils.constructAssetRecord(i),[i]),x=j.useIsMobile();return!a||!a.length?e.jsx("div",{className:"w-full flex items-center justify-center py-8 text-sm text-muted-foreground",children:e.jsx(s.FormattedMessageTyped,{messageId:"components.creditSessionDetailedLiquidation.table.noData",defaultMessage:"No data"})}):e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:o.cn("grid w-full px-3 sm:px-4 gap-1 sm:gap-2 items-center","h-7 sm:h-8 md:h-[30px]","relative after:absolute after:bottom-0 after:left-2 sm:after:left-3 after:right-2 sm:after:right-3 after:h-px after:border-b after:border-border"),style:{gridTemplateColumns:"1fr 1fr 1fr"},children:[e.jsx("div",{className:"text-left text-xs sm:text-sm font-medium text-muted-foreground truncate",children:e.jsx(s.FormattedMessageTyped,{messageId:"components.creditSessionDetailedLiquidation.table.asset"})}),e.jsx("div",{className:"text-right text-xs sm:text-sm font-medium text-muted-foreground truncate",children:e.jsx(s.FormattedMessageTyped,{messageId:"components.creditSessionDetailedLiquidation.table.currentPrice"})}),e.jsx("div",{className:"text-right text-xs sm:text-sm font-medium text-muted-foreground truncate",children:e.jsx(s.FormattedMessageTyped,{messageId:"components.creditSessionDetailedLiquidation.table.modelPrice"})})]}),a.map((t,f,g)=>{const h=g.length-1===f;return e.jsxs("div",{className:o.cn("grid w-full px-3 sm:px-4 gap-1 sm:gap-2 items-center relative","h-12 sm:h-14 md:h-[51px]",!h&&"after:absolute after:bottom-0 after:left-2 sm:after:left-3 after:right-2 sm:after:right-3 after:h-px after:border-b after:border-border"),style:{gridTemplateColumns:"1fr 1fr 1fr"},children:[e.jsx("div",{className:"text-left min-w-0",children:e.jsx(b.TokenSymbol,{size:x?18:24,token:r[t.token],showSymbol:!0,maxLength:12,className:"gap-1.5 sm:gap-2"})}),e.jsxs("div",{className:"text-right text-xs sm:text-sm md:text-base truncate",children:["$",d(n[t.token])]}),e.jsx("div",{className:"text-right min-w-0",children:u[t.token]?e.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground truncate",children:e.jsx(s.FormattedMessageTyped,{messageId:"components.creditSessionDetailedLiquidation.table.seeGraph"})}):e.jsxs("span",{className:"text-xs sm:text-sm md:text-base text-muted-foreground truncate",children:["$",d(c[t.token]||n[t.token])]})})]},t.token)})]})}function d(r){return(Number(r||0n)/Number(m.PRICE_DECIMALS)).toFixed(2)}exports.LiquidationModellingAssetsTable=y;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),x=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),x=require("react"),re=require("sonner"),ne=require("../../hooks/use-media-query.cjs");require("@gearbox-protocol/sdk");const oe=require("../../utils/cn.cjs");require("luxon");require("../../utils/z-index.cjs");const ie=require("../buttons/range-buttons/range-buttons.cjs"),j=require("../graph/graph.cjs"),se=require("../graph/graph-view.cjs"),le=require("./graph-dropdown.cjs"),ce=({size:e=16})=>o.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":"Expand fullscreen",children:[o.jsx("title",{children:"Expand fullscreen"}),o.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})]}),ue=({size:e=16})=>o.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":"Exit fullscreen",children:[o.jsx("title",{children:"Exit fullscreen"}),o.jsx("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"})]}),q="permissionless-ui:tradingview-series-colors:";function E(e){if(typeof window>"u"||!window.localStorage)return new Map;try{const t=window.localStorage.getItem(q+e);if(!t)return new Map;const c=JSON.parse(t);return c==null||typeof c!="object"?new Map:new Map(Object.entries(c).filter(([,r])=>typeof r=="number"&&r>=0&&r<j.DEFAULT_SERIES_COLORS.length))}catch{return new Map}}function ae(e,t){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(q+e,JSON.stringify(Object.fromEntries(t)))}catch{}}function k(e,t){if(t.size===0)return;const c=E(e);for(const[r,b]of t)c.set(r,b);ae(e,c)}function de({data:e,yMeasureUnit:t,height:c=306,defaultGraph:r,onGraphSelected:b,graphs:m,isMultipleSelect:N,range:T,rangeList:M,setRange:V,onGraphExpanded:y,isGraphExpanded:F,onUnselectSeries:B,graphsWithNoData:D,loadingGraphs:z,noDataMessage:I="No data available for this graph",currentValueDecimals:W,containerClassName:H,useSharedPriceScale:J,showCurrentValue:$,yScaleMin:Q,yScaleMinMultiple:X,seriesColorPersistenceKey:u,...Y}){const v=x.useMemo(()=>Array.isArray(e)?e:e?[e]:[],[e]),R=x.useMemo(()=>Array.isArray(e)&&e.length>1,[e]),C=ne.useIsMobile(),Z=x.useCallback((w,p)=>{re.toast.error(I)},[I]),U=x.useMemo(()=>{if(t)return Array.isArray(t)?t[0]:t},[t]),P=(!C&&y||M.length>0||b&&m&&r)&&o.jsxs("div",{className:"z-10 w-full flex flex-row flex-wrap sm:flex-nowrap items-center gap-2",children:[o.jsx("div",{children:b&&m&&r&&o.jsx(le.GraphDropdown,{onSelected:b,items:m,defaultItem:r,multiple:N,graphsWithNoData:D,loadingGraphs:z,onNoDataSelected:Z})}),o.jsxs("div",{className:"flex flex-row flex-nowrap justify-start sm:justify-end items-center flex-1",children:[o.jsx(ie.RangeButtons,{range:T,rangeList:M,setRange:V}),!C&&y&&o.jsx("button",{type:"button",className:"px-2.5 py-1.5 flex min-w-[44px] min-h-[26px] justify-center items-center text-xs leading-[14px] font-medium text-center rounded-md border cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring bg-muted border-muted text-muted-foreground hover:border-secondary ml-1.5",onClick:y,children:F?o.jsx(ue,{size:16}):o.jsx(ce,{size:16})})]})]}),s=x.useRef(new Map),f=x.useRef(0),L=x.useRef(!1);if(m&&m.length>0&&!L.current){L.current=!0;const w=u?E(u):new Map,p=String(m[0].value);s.current.set(p,0),f.current=1;for(let n=1;n<m.length;n++){const a=String(m[n].value);if(s.current.has(a))continue;const h=w.get(a)??n;s.current.set(a,h),f.current=Math.max(f.current,h+1)}u&&k(u,s.current)}const K=x.useMemo(()=>{const w=Array.isArray(t)?t:void 0;if(u){const n=E(u);for(const[a,g]of n)s.current.has(a)||(s.current.set(a,g),f.current=Math.max(f.current,g+1))}const p=v.map((n,a)=>{const g=n?.title||`Series ${a+1}`,h=r!=null?Array.isArray(r)?r[0]?.value??r[0]:typeof r=="object"&&"value"in r?r.value:r:null,A=v.length===1?h!=null?String(h):"single":n?.id||g;if(!s.current.has(A)){const i=new Set(Array.from(s.current.values()));let l=f.current;for(let d=0;d<j.DEFAULT_SERIES_COLORS.length;d++){const S=(f.current+d)%j.DEFAULT_SERIES_COLORS.length;if(!i.has(S)){l=S;break}}s.current.set(A,l),f.current=l+1}const ee=s.current.get(A)??0,_=j.getSeriesColorPalette(ee),te=[...n?.data||[]].sort((i,l)=>{const d=typeof i.time=="number"?i.time:Number(i.time),S=typeof l.time=="number"?l.time:Number(l.time);return d-S}).reduce((i,l)=>{const d=l.time;return i.length===0||i[i.length-1].time!==d?i.push({time:d,value:l.value}):i[i.length-1]={time:d,value:l.value},i},[]),O=n?.lineColor??n?.color??void 0;return{data:te,label:g,yMeasureUnit:w?.[a]??(Array.isArray(t)?void 0:t),...O!=null?{lineColor:O,...n?.topColor!=null&&{topColor:n.topColor},...n?.bottomColor!=null&&{bottomColor:n.bottomColor}}:{color:_.line,topColor:_.top,bottomColor:_.bottom}}});return u&&s.current.size>0&&k(u,s.current),p},[v,r,t,u]),G=R&&v.length>0?v.some(w=>!w):!e;return o.jsx("div",{style:{width:"100%",height:c?`${c}px`:void 0},className:"w-full",children:o.jsx(se.GraphViewWithData,{series:K,loading:G,toolbar:P,size:c?"full":"default",containerClassName:oe.cn("h-full",H),showLegend:R,onUnselectSeries:B,yMeasureUnit:U,currentValueDecimals:W,useSharedPriceScale:J,showCurrentValue:$,yScaleMin:Q,yScaleMinMultiple:X,...Y})})}exports.TradingView=de;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),n=require("react"),o=require("react-intl"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),n=require("react"),o=require("react-intl"),d=e=>r.jsx("strong",{children:e});function i({messageId:e,values:t,defaultMessage:s}){return r.jsx(o.FormattedMessage,{id:e,defaultMessage:s,values:{strong:d,...t}})}function l(){const e=o.useIntl(),t=n.useCallback(({messageId:a,defaultMessage:u},c)=>e.formatMessage({id:a,defaultMessage:u},c),[e]);return n.useMemo(()=>({formatMessage:t,intl:e}),[e,t])}exports.FormattedMessageTyped=i;exports.useIntlTyped=l;
|
|
@@ -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.loadingPercent":"Loading {percent}%","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
|
+
"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.loadingPercent":"Loading {percent}%","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.filterModal.searchPlaceholder":"Search options...","components.filterModal.noOptionsAvailable":"No options available","components.filterModal.noOptionsMatchSearch":"No options match your search","components.filterModal.reset":"Reset","components.filterModal.apply":"Apply","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;
|
|
@@ -37,7 +37,7 @@ const d = l.forwardRef(
|
|
|
37
37
|
"absolute left-2 flex h-4 w-4 items-center justify-center rounded-[4px] border border-primary shadow transition-colors",
|
|
38
38
|
e && "bg-primary text-primary-foreground"
|
|
39
39
|
),
|
|
40
|
-
children: e && /* @__PURE__ */ r(x, { icon: f, className: "size-
|
|
40
|
+
children: e && /* @__PURE__ */ r(x, { icon: f, className: "size-3!" })
|
|
41
41
|
}
|
|
42
42
|
),
|
|
43
43
|
s
|
|
@@ -22,7 +22,7 @@ const u = d.forwardRef(
|
|
|
22
22
|
disabled: s,
|
|
23
23
|
...a,
|
|
24
24
|
children: [
|
|
25
|
-
/* @__PURE__ */ e("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ e(o.ItemIndicator, { children: /* @__PURE__ */ e(p, { icon: l, className: "size-
|
|
25
|
+
/* @__PURE__ */ e("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ e(o.ItemIndicator, { children: /* @__PURE__ */ e(p, { icon: l, className: "size-3!" }) }) }),
|
|
26
26
|
t
|
|
27
27
|
]
|
|
28
28
|
}
|
|
@@ -11,7 +11,7 @@ const m = n.forwardRef(({ className: e, inset: r, ...t }, s) => /* @__PURE__ */
|
|
|
11
11
|
{
|
|
12
12
|
ref: s,
|
|
13
13
|
className: a(
|
|
14
|
-
"relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors hover:text-foreground hover:bg-secondary focus-visible:outline-none focus:bg-secondary focus:text-foreground data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-
|
|
14
|
+
"relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors hover:text-foreground hover:bg-secondary focus-visible:outline-none focus:bg-secondary focus:text-foreground data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-3! [&>svg]:shrink-0",
|
|
15
15
|
r && "pl-8",
|
|
16
16
|
e
|
|
17
17
|
),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r, jsxs as x } from "react/jsx-runtime";
|
|
2
2
|
import * as l from "react";
|
|
3
3
|
import "../buttons/back-button/back-button.js";
|
|
4
4
|
import { Button as N } from "../buttons/button/button.js";
|
|
@@ -7,94 +7,101 @@ import "../buttons/external-button/external-button.js";
|
|
|
7
7
|
import "../buttons/filter-button/filter-button.js";
|
|
8
8
|
import "../buttons/navigation-button/navigation-button.js";
|
|
9
9
|
import "@gearbox-protocol/sdk";
|
|
10
|
-
import { cn as
|
|
10
|
+
import { cn as D } from "../../utils/cn.js";
|
|
11
11
|
import "sonner";
|
|
12
|
-
import { extractTextFromLabel as
|
|
12
|
+
import { extractTextFromLabel as j, serializeValue as R } from "../../utils/react.js";
|
|
13
13
|
import "luxon";
|
|
14
14
|
import "../../utils/z-index.js";
|
|
15
15
|
import "../buttons/tab-button/tab-button.js";
|
|
16
|
-
import { CheckboxItem as
|
|
16
|
+
import { CheckboxItem as z } from "../checkbox-item/checkbox-item.js";
|
|
17
17
|
import "../modal/modal.js";
|
|
18
|
-
import { Dialog as
|
|
18
|
+
import { Dialog as X } from "../dialog/dialog.js";
|
|
19
19
|
import "../dialog/dialog-container.js";
|
|
20
|
-
import { DialogContent as
|
|
20
|
+
import { DialogContent as Y } from "../dialog/dialog-content.js";
|
|
21
21
|
import "../dialog/dialog-description.js";
|
|
22
|
-
import { DialogFooter as
|
|
23
|
-
import { DialogHeader as
|
|
24
|
-
import { DialogTitle as
|
|
22
|
+
import { DialogFooter as Z } from "../dialog/dialog-footer.js";
|
|
23
|
+
import { DialogHeader as _ } from "../dialog/dialog-header.js";
|
|
24
|
+
import { DialogTitle as $ } from "../dialog/dialog-title.js";
|
|
25
25
|
import "../dialog/dialog-modal-container.js";
|
|
26
26
|
import "../dialog/dialog-overlay.js";
|
|
27
27
|
import "viem";
|
|
28
28
|
import "../input/input.js";
|
|
29
29
|
import "../label/label.js";
|
|
30
|
-
import { SearchLine as
|
|
31
|
-
import { Tabs as
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
import { SearchLine as ee } from "../search-line/search-line.js";
|
|
31
|
+
import { Tabs as te, TabsList as re, TabsTrigger as oe, TabsContent as le } from "../tabs/tabs.js";
|
|
32
|
+
import { useIntlTyped as ae } from "../typed-intl/index.js";
|
|
33
|
+
function d(m, o) {
|
|
34
|
+
return m ? Array.isArray(m) ? m.includes(o) : m.has(o) : !1;
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
-
title:
|
|
36
|
+
function qe({
|
|
37
|
+
title: m,
|
|
37
38
|
state: o,
|
|
38
|
-
modalShow:
|
|
39
|
-
onOpen:
|
|
39
|
+
modalShow: f,
|
|
40
|
+
onOpen: F,
|
|
40
41
|
onClose: v,
|
|
41
|
-
onReset:
|
|
42
|
-
options:
|
|
43
|
-
tabbedOptions:
|
|
44
|
-
onSelect:
|
|
42
|
+
onReset: T,
|
|
43
|
+
options: p,
|
|
44
|
+
tabbedOptions: n,
|
|
45
|
+
onSelect: C,
|
|
45
46
|
className: q,
|
|
46
|
-
optionsClassName:
|
|
47
|
-
resetLabel:
|
|
48
|
-
applyLabel:
|
|
49
|
-
showApplyButton:
|
|
50
|
-
showSearch:
|
|
47
|
+
optionsClassName: Q,
|
|
48
|
+
resetLabel: V,
|
|
49
|
+
applyLabel: B,
|
|
50
|
+
showApplyButton: E = !1,
|
|
51
|
+
showSearch: H = !1
|
|
51
52
|
}) {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
const { formatMessage: i } = ae(), [c, S] = l.useState(""), P = V ?? i({
|
|
54
|
+
messageId: "components.filterModal.reset",
|
|
55
|
+
defaultMessage: "Reset"
|
|
56
|
+
}), k = B ?? i({
|
|
57
|
+
messageId: "components.filterModal.apply",
|
|
58
|
+
defaultMessage: "Apply"
|
|
59
|
+
}), [y, G] = l.useState([]), [M, J] = l.useState([]), K = l.useCallback(() => {
|
|
60
|
+
T();
|
|
61
|
+
}, [T]), U = l.useCallback(() => {
|
|
55
62
|
v();
|
|
56
|
-
}, [v]),
|
|
57
|
-
if (!
|
|
58
|
-
if (!
|
|
59
|
-
return
|
|
60
|
-
const e =
|
|
61
|
-
return
|
|
62
|
-
}, [
|
|
63
|
-
if (!
|
|
64
|
-
if (!
|
|
65
|
-
return
|
|
66
|
-
const e =
|
|
67
|
-
return
|
|
68
|
-
...
|
|
69
|
-
options:
|
|
70
|
-
})).filter((
|
|
71
|
-
}, [
|
|
63
|
+
}, [v]), A = l.useMemo(() => {
|
|
64
|
+
if (!y) return [];
|
|
65
|
+
if (!c.trim())
|
|
66
|
+
return y;
|
|
67
|
+
const e = c.toLowerCase().trim();
|
|
68
|
+
return y.filter((t) => j(t.label).toLowerCase().includes(e));
|
|
69
|
+
}, [y, c]), u = l.useMemo(() => {
|
|
70
|
+
if (!M) return [];
|
|
71
|
+
if (!c.trim())
|
|
72
|
+
return M;
|
|
73
|
+
const e = c.toLowerCase().trim();
|
|
74
|
+
return M.map((t) => ({
|
|
75
|
+
...t,
|
|
76
|
+
options: t.options.filter((a) => j(a.label).toLowerCase().includes(e))
|
|
77
|
+
})).filter((t) => t.options.length > 0);
|
|
78
|
+
}, [M, c]), I = l.useMemo(() => u.length > 0 ? u[0].tab : "", [u]), w = l.useRef(f);
|
|
72
79
|
l.useEffect(() => {
|
|
73
|
-
const e =
|
|
74
|
-
if (!e &&
|
|
75
|
-
if (
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
return
|
|
80
|
+
const e = w.current, t = f;
|
|
81
|
+
if (!e && t) {
|
|
82
|
+
if (p) {
|
|
83
|
+
const a = [...p].sort((s, h) => {
|
|
84
|
+
const b = d(o, s.value), g = d(o, h.value);
|
|
85
|
+
return b && !g ? -1 : !b && g ? 1 : 0;
|
|
79
86
|
});
|
|
80
|
-
|
|
87
|
+
G(a);
|
|
81
88
|
}
|
|
82
|
-
if (
|
|
83
|
-
const
|
|
84
|
-
...
|
|
85
|
-
options: [...
|
|
86
|
-
const
|
|
87
|
-
return
|
|
89
|
+
if (n) {
|
|
90
|
+
const a = n.map((s) => ({
|
|
91
|
+
...s,
|
|
92
|
+
options: [...s.options].sort((h, b) => {
|
|
93
|
+
const g = d(o, h.value), O = d(o, b.value);
|
|
94
|
+
return g && !O ? -1 : !g && O ? 1 : 0;
|
|
88
95
|
})
|
|
89
96
|
}));
|
|
90
|
-
|
|
97
|
+
J(a);
|
|
91
98
|
}
|
|
92
|
-
} else e && !
|
|
93
|
-
|
|
94
|
-
}, [
|
|
95
|
-
const
|
|
99
|
+
} else e && !t && S("");
|
|
100
|
+
w.current = f;
|
|
101
|
+
}, [f, o, p, n]);
|
|
102
|
+
const L = l.useMemo(() => n ? n.reduce((e, t) => e + t.options.length, 0) : p?.length ?? 0, [p, n]), W = l.useMemo(
|
|
96
103
|
() => ({
|
|
97
|
-
value:
|
|
104
|
+
value: c,
|
|
98
105
|
handleInput: (e) => {
|
|
99
106
|
S(e.target.value);
|
|
100
107
|
},
|
|
@@ -102,52 +109,64 @@ function Re({
|
|
|
102
109
|
e.preventDefault();
|
|
103
110
|
}
|
|
104
111
|
}),
|
|
105
|
-
[
|
|
112
|
+
[c]
|
|
106
113
|
);
|
|
107
|
-
return /* @__PURE__ */
|
|
108
|
-
|
|
114
|
+
return /* @__PURE__ */ r(
|
|
115
|
+
X,
|
|
109
116
|
{
|
|
110
|
-
open:
|
|
111
|
-
onOpenChange: (e) => e ?
|
|
112
|
-
children: /* @__PURE__ */
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
open: f,
|
|
118
|
+
onOpenChange: (e) => e ? F() : v(),
|
|
119
|
+
children: /* @__PURE__ */ x(Y, { className: D("max-w-lg", q), children: [
|
|
120
|
+
/* @__PURE__ */ r(_, { children: /* @__PURE__ */ r($, { children: m }) }),
|
|
121
|
+
H && /* @__PURE__ */ r(
|
|
122
|
+
ee,
|
|
116
123
|
{
|
|
117
|
-
searchState:
|
|
118
|
-
placeholder:
|
|
124
|
+
searchState: W,
|
|
125
|
+
placeholder: i({
|
|
126
|
+
messageId: "components.filterModal.searchPlaceholder",
|
|
127
|
+
defaultMessage: "Search options..."
|
|
128
|
+
}),
|
|
119
129
|
size: "full"
|
|
120
130
|
}
|
|
121
131
|
),
|
|
122
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ r(
|
|
123
133
|
"div",
|
|
124
134
|
{
|
|
125
|
-
className:
|
|
126
|
-
|
|
127
|
-
|
|
135
|
+
className: D(
|
|
136
|
+
n ? "" : "max-h-[60vh] overflow-y-auto",
|
|
137
|
+
Q
|
|
128
138
|
),
|
|
129
|
-
children:
|
|
130
|
-
|
|
139
|
+
children: n ? u.length === 0 ? /* @__PURE__ */ r("div", { className: "text-center text-sm text-muted-foreground", children: i(L === 0 ? {
|
|
140
|
+
messageId: "components.filterModal.noOptionsAvailable",
|
|
141
|
+
defaultMessage: "No options available"
|
|
142
|
+
} : {
|
|
143
|
+
messageId: "components.filterModal.noOptionsMatchSearch",
|
|
144
|
+
defaultMessage: "No options match your search"
|
|
145
|
+
}) }) : /* @__PURE__ */ x(
|
|
146
|
+
te,
|
|
131
147
|
{
|
|
132
|
-
defaultValue:
|
|
148
|
+
defaultValue: I,
|
|
133
149
|
className: "w-full",
|
|
134
150
|
children: [
|
|
135
|
-
/* @__PURE__ */
|
|
136
|
-
u.map((e) => /* @__PURE__ */
|
|
137
|
-
|
|
151
|
+
/* @__PURE__ */ r(re, { className: "w-full justify-start", children: u.map((e) => /* @__PURE__ */ r(oe, { value: e.tab, children: e.label }, e.tab)) }),
|
|
152
|
+
u.map((e) => /* @__PURE__ */ r(
|
|
153
|
+
le,
|
|
138
154
|
{
|
|
139
155
|
value: e.tab,
|
|
140
156
|
className: "mt-4 max-h-[60vh] overflow-y-auto",
|
|
141
|
-
children: e.options.length === 0 ? /* @__PURE__ */
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
157
|
+
children: e.options.length === 0 ? /* @__PURE__ */ r("div", { className: "text-center text-sm text-muted-foreground", children: i({
|
|
158
|
+
messageId: "components.filterModal.noOptionsAvailable",
|
|
159
|
+
defaultMessage: "No options available"
|
|
160
|
+
}) }) : /* @__PURE__ */ r("div", { className: "space-y-1", children: e.options.map((t) => {
|
|
161
|
+
const a = d(o, t.value), s = R(t.value);
|
|
162
|
+
return /* @__PURE__ */ r(
|
|
163
|
+
z,
|
|
145
164
|
{
|
|
146
|
-
checked:
|
|
147
|
-
onCheckedChange: (
|
|
148
|
-
children:
|
|
165
|
+
checked: a,
|
|
166
|
+
onCheckedChange: (h) => C(t.value, h),
|
|
167
|
+
children: t.label
|
|
149
168
|
},
|
|
150
|
-
|
|
169
|
+
s
|
|
151
170
|
);
|
|
152
171
|
}) })
|
|
153
172
|
},
|
|
@@ -155,38 +174,44 @@ function Re({
|
|
|
155
174
|
))
|
|
156
175
|
]
|
|
157
176
|
},
|
|
158
|
-
|
|
159
|
-
) :
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
177
|
+
I
|
|
178
|
+
) : A.length === 0 ? /* @__PURE__ */ r("div", { className: "text-center text-sm text-muted-foreground", children: i(L === 0 ? {
|
|
179
|
+
messageId: "components.filterModal.noOptionsAvailable",
|
|
180
|
+
defaultMessage: "No options available"
|
|
181
|
+
} : {
|
|
182
|
+
messageId: "components.filterModal.noOptionsMatchSearch",
|
|
183
|
+
defaultMessage: "No options match your search"
|
|
184
|
+
}) }) : /* @__PURE__ */ r("div", { className: "space-y-1", children: A.map((e) => {
|
|
185
|
+
const t = d(o, e.value), a = R(e.value);
|
|
186
|
+
return /* @__PURE__ */ r(
|
|
187
|
+
z,
|
|
163
188
|
{
|
|
164
|
-
checked:
|
|
165
|
-
onCheckedChange: (
|
|
189
|
+
checked: t,
|
|
190
|
+
onCheckedChange: (s) => C(e.value, s),
|
|
166
191
|
children: e.label
|
|
167
192
|
},
|
|
168
|
-
|
|
193
|
+
a
|
|
169
194
|
);
|
|
170
195
|
}) })
|
|
171
196
|
}
|
|
172
197
|
),
|
|
173
|
-
/* @__PURE__ */
|
|
174
|
-
/* @__PURE__ */
|
|
198
|
+
/* @__PURE__ */ x(Z, { className: "flex-row justify-between gap-2 sm:justify-between", children: [
|
|
199
|
+
/* @__PURE__ */ r(
|
|
175
200
|
N,
|
|
176
201
|
{
|
|
177
202
|
type: "button",
|
|
178
203
|
variant: "outline",
|
|
179
|
-
onClick:
|
|
204
|
+
onClick: K,
|
|
180
205
|
disabled: !o || (Array.isArray(o) ? o.length === 0 : o.size === 0),
|
|
181
|
-
children:
|
|
206
|
+
children: P
|
|
182
207
|
}
|
|
183
208
|
),
|
|
184
|
-
|
|
209
|
+
E ? /* @__PURE__ */ r(N, { type: "button", onClick: U, children: k }) : /* @__PURE__ */ r(N, { type: "button", variant: "default", onClick: v, children: k })
|
|
185
210
|
] })
|
|
186
211
|
] })
|
|
187
212
|
}
|
|
188
213
|
);
|
|
189
214
|
}
|
|
190
215
|
export {
|
|
191
|
-
|
|
216
|
+
qe as FilterModal
|
|
192
217
|
};
|
|
@@ -55,11 +55,11 @@ const { MIN_DISPLAY_THRESHOLD: g, MAX_EXPONENTIAL_THRESHOLD: R } = U, V = (t, e,
|
|
|
55
55
|
function et(t, e, n = 4) {
|
|
56
56
|
if (t === 0)
|
|
57
57
|
return e ? `0 ${e}` : "0";
|
|
58
|
-
const a = t.toLocaleString("en-US", {
|
|
58
|
+
const a = e && Math.abs(t) >= 1e3 ? 0 : n, c = t.toLocaleString("en-US", {
|
|
59
59
|
minimumFractionDigits: 0,
|
|
60
|
-
maximumFractionDigits:
|
|
60
|
+
maximumFractionDigits: a
|
|
61
61
|
});
|
|
62
|
-
return e ? `${
|
|
62
|
+
return e ? `${c} ${e}` : c;
|
|
63
63
|
}
|
|
64
64
|
function rt(t, e, n) {
|
|
65
65
|
const a = n?.yScaleMin;
|