@gearbox-protocol/permissionless-ui 1.26.4 → 1.26.6
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/default-config.cjs +1 -1
- package/dist/cjs/components/graph/graph.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/default-config.js +12 -9
- package/dist/esm/components/graph/graph.js +271 -281
- 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
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../../utils/colors.cjs"),e={topColor:"rgba(76, 175, 80, 0.56)",bottomColor:"rgba(76, 175, 80, 0.04)",lineColor:"#02c39a",lineWidth:2},o={showLabel:!0,color:"#02c39a",labelBackgroundColor:"#02c39a",width:2};function t(){const r=l.resolveCSSColor("hsl(var(--foreground))","rgb(0, 0, 0)");return{timeScale:{borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",visible:!0,fixLeftEdge:!0,fixRightEdge:!0,lockVisibleTimeRangeOnResize:!0},rightPriceScale:{visible:!0,autoScale:!0,alignLabels:!0,borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",entireTextOnly:!1,textColor:r},layout:{background:{color:"transparent"},textColor:r,fontSize:14},crosshair:{horzLine:{width:2,color:"rgba(224, 227, 235, 0.1)",style:0,labelVisible:!1},vertLine:{width:2,color:"rgba(224, 227, 235, 0.1)",style:0,labelVisible:!1}},grid:{vertLines:{visible:!1},horzLines:{visible:!1}}}}function i(){return{topColor:"rgba(76, 175, 80, 0.56)",bottomColor:"rgba(76, 175, 80, 0.04)",lineColor:e.lineColor,lineWidth:2}}function a(){return{showLabel:!0,color:e.lineColor,labelBackgroundColor:e.lineColor,width:2}}const s={timeScale:{borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",visible:!0,fixLeftEdge:!0,fixRightEdge:!0},rightPriceScale:{visible:!0,autoScale:!0,alignLabels:!0,borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",entireTextOnly:!1},layout:{background:{color:"transparent"},textColor:"rgb(0, 0, 0)",fontSize:14},crosshair:{horzLine:{width:2,color:"rgba(224, 227, 235, 0.1)",style:0,labelVisible:!1},vertLine:{width:2,color:"rgba(224, 227, 235, 0.1)",style:0,labelVisible:!1}},grid:{vertLines:{visible:!1},horzLines:{visible:!1}}};exports.DEFAULT_AREA_SERIES=e;exports.DEFAULT_OPTIONS=s;exports.DEFAULT_VERTICAL_LINE=o;exports.getDefaultOptions=t;exports.getDefaultSeries=i;exports.getDefaultVerticalLine=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),ue=require("lightweight-charts"),c=require("react"),Ae=require("../../hooks/use-media-query.cjs"),ge=require("../../utils/cn.cjs"),I=require("../../utils/colors.cjs"),X=require("./default-config.cjs"),D=require("./formatters.cjs"),Ie=require("./graph-current-value.cjs"),ye=require("./graph-tooltip.cjs"),Oe=require("./plugins/vertical-line.cjs");function ze(e){const m=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const f in e)if(f!=="default"){const y=Object.getOwnPropertyDescriptor(e,f);Object.defineProperty(m,f,y.get?y:{enumerable:!0,get:()=>e[f]})}}return m.default=e,Object.freeze(m)}const fe=ze(c);function Ve(e,m,f){const y=e.labelText??"",b=e.value,x=b===void 0?"":typeof b=="number"?m==="$"?`$${D.formatExactValue(b,void 0,f)}`:m==="%"?`${D.formatExactValue(b,void 0,f)}%`:D.formatExactValue(b,m!=="none"&&m!=="%"&&m!=="$"?m:void 0,f):String(b);return{labelText:y,valueStr:x}}const Z=[{line:"#02c39a",top:"rgba(2, 195, 154, 0.56)",bottom:"rgba(2, 195, 154, 0.04)"},{line:"#3b82f6",top:"rgba(59, 130, 246, 0.56)",bottom:"rgba(59, 130, 246, 0.04)"},{line:"#ef4444",top:"rgba(239, 68, 68, 0.56)",bottom:"rgba(239, 68, 68, 0.04)"},{line:"#f59e0b",top:"rgba(245, 158, 11, 0.56)",bottom:"rgba(245, 158, 11, 0.04)"},{line:"#8b5cf6",top:"rgba(139, 92, 246, 0.56)",bottom:"rgba(139, 92, 246, 0.04)"},{line:"#ec4899",top:"rgba(236, 72, 153, 0.56)",bottom:"rgba(236, 72, 153, 0.04)"},{line:"#06b6d4",top:"rgba(6, 182, 212, 0.56)",bottom:"rgba(6, 182, 212, 0.04)"},{line:"#ea580c",top:"rgba(234, 88, 12, 0.56)",bottom:"rgba(234, 88, 12, 0.04)"},{line:"#84cc16",top:"rgba(132, 204, 22, 0.56)",bottom:"rgba(132, 204, 22, 0.04)"},{line:"#d946ef",top:"rgba(217, 70, 239, 0.56)",bottom:"rgba(217, 70, 239, 0.04)"},{line:"#0ea5e9",top:"rgba(14, 165, 233, 0.56)",bottom:"rgba(14, 165, 233, 0.04)"},{line:"#14b8a6",top:"rgba(20, 184, 166, 0.56)",bottom:"rgba(20, 184, 166, 0.04)"},{line:"#eab308",top:"rgba(234, 179, 8, 0.56)",bottom:"rgba(234, 179, 8, 0.04)"},{line:"#f43f5e",top:"rgba(244, 63, 94, 0.56)",bottom:"rgba(244, 63, 94, 0.04)"},{line:"#6366f1",top:"rgba(99, 102, 241, 0.56)",bottom:"rgba(99, 102, 241, 0.04)"},{line:"#10b981",top:"rgba(16, 185, 129, 0.56)",bottom:"rgba(16, 185, 129, 0.04)"},{line:"#78716c",top:"rgba(120, 113, 108, 0.56)",bottom:"rgba(120, 113, 108, 0.04)"},{line:"#64748b",top:"rgba(100, 116, 139, 0.56)",bottom:"rgba(100, 116, 139, 0.04)"},{line:"#475569",top:"rgba(71, 85, 105, 0.56)",bottom:"rgba(71, 85, 105, 0.04)"}],qe=137.5;function de(e){if(e<Z.length)return Z[e];const f=(e-Z.length)*qe%360,y=I.hslToHex(f,70,50),{topColor:b,bottomColor:x}=I.generateColorsFromBase(y);return{line:y,top:b,bottom:x}}function De({series:e,className:m,showLegend:f=!1,onUnselectSeries:y,xMeasureUnit:b="time",yMeasureUnit:x="token",optionsOverrides:$,verticalLineOptions:S,currentValueDecimals:G,useSharedPriceScale:L=!1,showCurrentValue:ke=!0,graphTitle:K,yScaleMin:be,yScaleMinMultiple:me}){const j=c.useRef(null),V=c.useRef(new Map),Q=c.useRef(!1),J=c.useRef(new Set),he=c.useRef(0),pe=c.useRef(!0),U=c.useRef(null),je=c.useRef(null),_=c.useRef(null),ee=c.useRef(null),R=Ae.useIsMobile(),M=fe.useMemo(()=>e.flatMap(t=>t.data),[e]),Le=fe.useMemo(()=>{if(e.length>0){const t=e[e.length-1];if(t.data.length>0)return t.data[t.data.length-1]}},[e]),[Y,te]=c.useState(()=>{if(!Le)return;const t=new Map;for(const a of e)a.data.length>0&&t.set(a.label,a.data[a.data.length-1]);return t}),[oe,A]=c.useState(null),[Ce,ve]=c.useState([]);c.useEffect(()=>{const t=()=>{if(j.current&&_.current){const l=_.current.clientWidth,i=_.current.clientHeight;j.current.resize(l,i),j.current.timeScale().fitContent()}},a=_.current,n=a?new ResizeObserver(t):null;return a&&n?.observe(a),()=>{a&&n?.unobserve(a)}},[]),c.useEffect(()=>{if(!ee.current||Q.current)return;const t=X.getDefaultOptions(),a=I.resolveCSSColor("hsl(var(--foreground))","rgb(0, 0, 0)"),n=ue.createChart(ee.current,{...t,rightPriceScale:{...t.rightPriceScale||{},visible:!R,textColor:a},...R&&{crosshair:{...t.crosshair,mode:ue.CrosshairMode.Magnet}},...$});return j.current=n,Q.current=!0,()=>{n.remove(),j.current=null,Q.current=!1,V.current.clear()}},[R,$]),c.useEffect(()=>{const t=j.current;if(!t||e.length===0)return;const n=e.filter(o=>o.data.length>0).length<=1?be:me,l=b==="time"?D.getXFormatters(b,M):D.getXFormatters(b),i=M.map(o=>o.value),{formatter:g,tickmarksFormatter:d,updateVisibleRange:N,updateLastValues:h}=D.createAdaptiveYAxisFormatter(i,x,{yScaleMin:n});U.current=N,je.current=h;const P=e.filter(o=>o.data.length>0).map(o=>o.data[o.data.length-1].value);h(P);const T=X.getDefaultOptions();t.applyOptions({localization:{...T.localization||{},timeFormatter:o=>l.timeFormatter(parseFloat(o),void 0)},timeScale:{...T.timeScale||{},tickMarkFormatter:l.tickMarkFormatter,minBarSpacing:0}});const p=(M.length>0?Math.min(...M.map(o=>o.value)):0)<0,w=M.some(o=>o.value===0),C=!p&&w,v=e.length>1&&!L,F=e.length>1&&!L||R,E=I.resolveCSSColor("hsl(var(--foreground))","rgb(0, 0, 0)");t.applyOptions({rightPriceScale:{...T.rightPriceScale||{},visible:!F,textColor:E,...C&&{scaleMargins:{top:.3,bottom:0}}}});const ne=new Set(V.current.keys()),re=new Set(e.map(o=>o.label));for(const o of ne)if(!re.has(o)){const r=V.current.get(o);r&&(t.removeSeries(r),V.current.delete(o))}const Ne=X.getDefaultSeries(),ae=[];let H=0;for(let o=0;o<e.length;o++){const r=e[o],ie=de(o),W=r.lineColor??r.color??ie.line;let O,z;if(r.lineColor??r.color)if(r.topColor&&r.bottomColor)O=r.topColor,z=r.bottomColor;else if(r.topColor){const s=I.generateColorsFromBase(W);O=r.topColor,z=s.bottomColor}else if(r.bottomColor)O=I.generateColorsFromBase(W).topColor,z=r.bottomColor;else{const s=I.generateColorsFromBase(W);O=s.topColor,z=s.bottomColor}else O=r.topColor||ie.top,z=r.bottomColor||ie.bottom;if(r.data.length===0){const s=V.current.get(r.label);s&&(t.removeSeries(s),V.current.delete(r.label));continue}const Fe=(r.data.length>0?Math.min(...r.data.map(s=>s.value)):0)<0,Ee=r.data.some(s=>s.value===0),_e=!Fe&&Ee,Se=L||!v||H===0?"right":`scale-${H}`;v&&ae.push({priceScaleId:Se||"right",shouldPreventNegativeAxis:_e,seriesIndex:H});const Re=(L||!v)&&n!==void 0&&typeof n=="number",we={lineColor:W,topColor:O,bottomColor:z,priceScaleId:Se,priceFormat:{type:"custom",minMove:.01,formatter:Re&&typeof n=="number"?s=>g(s<n?n:s):g,tickmarksFormatter:d},autoscaleInfoProvider:s=>{if(!Re)return s();const ce=s();if(ce?.priceRange){const Me=n;ce.priceRange.minValue=Me}return ce}};let q=V.current.get(r.label);q?(q.applyOptions(we),q.setData(r.data.map(s=>({...s,time:s.time})))):(q=t.addSeries(ue.AreaSeries,{...Ne,...we}),q.setData(r.data.map(s=>({...s,time:s.time}))),V.current.set(r.label,q)),H++}if(v&&ae.length>0)for(const o of ae)try{const r=t.priceScale(o.priceScaleId);r&&r.applyOptions({visible:!1,autoScale:!0,scaleMargins:{top:.1,bottom:.1,...o.shouldPreventNegativeAxis&&{top:.3,bottom:0}},alignLabels:!0,borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",entireTextOnly:!1,textColor:E})}catch(r){console.warn(`Failed to configure price scale ${o.priceScaleId} for series ${o.seriesIndex}:`,r)}else if(!v)try{const o=t.priceScale("right");o&&o.applyOptions({visible:!R,autoScale:!0,scaleMargins:{top:.1,bottom:n!==void 0||C?0:.1,...C&&{top:.3}},alignLabels:!0,borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",entireTextOnly:!1,textColor:E})}catch{}n!==void 0&&!R&&(L||!v)&&t.applyOptions({handleScroll:{vertTouchDrag:!1}});const le=new Set(e.map(o=>o.label)),Pe=le.size!==J.current.size||[...le].some(o=>!J.current.has(o)),Te=M.length!==he.current;(pe.current||Pe||Te||R)&&(t.timeScale().fitContent(),pe.current=!1),J.current=le,he.current=M.length;const se=new Map;for(const o of e)o.data.length>0&&se.set(o.label,o.data[o.data.length-1]);te(se.size>0?se:void 0)},[e,M,b,x,R,L,be,me]),c.useEffect(()=>{const t=j.current;if(!t||e.length===0)return;const a=e.length===1;let n;for(const i of e)if(i.data.length>0){n=i.data[i.data.length-1].time;break}if(!n)return;const l=i=>{const{time:g=n,seriesData:d,point:N}=i||{},h=Array.from(V.current.values());if(!N||!g){const k=new Map;for(const p of e)p.data.length>0&&k.set(p.label,p.data[p.data.length-1]);if(te(k.size>0?k:void 0),a||L)A(null);else if(h[0]&&n){const w=t.timeScale().timeToCoordinate(n),C=e[0];if(C.data.length>0){const v=C.data[C.data.length-1].value,F=h[0].priceToCoordinate(v);w!==null&&F!==null&&A({x:w,y:F})}}return}const P=new Map;let T;for(let k=0;k<e.length;k++){const p=e[k],w=h[k];if(!w)continue;const C=d?.get(w),v=C&&"value"in C?C.value:void 0,F=p.data[p.data.length-1],E=v!==void 0?v:F?.value??0;k===0&&(T=E),P.set(p.label,{value:E,time:g})}if(te(P),T!==void 0&&h[0]){const p=t.timeScale().timeToCoordinate(g),w=h[0].priceToCoordinate(T);if(p!==null&&w!==null){const C=_.current;if(C){const v=C.querySelector(".LightweightChart");if(v){const F=v.getBoundingClientRect(),E=C.getBoundingClientRect(),ne=p+(F.left-E.left),re=w+(F.top-E.top);A({x:ne,y:re})}else A({x:p,y:w})}else A({x:p,y:w})}else A(null)}else A(null)};return t.subscribeCrosshairMove(l),R&&t.subscribeClick(l),!a&&!L&&requestAnimationFrame(()=>{const i=Array.from(V.current.values());if(i[0]&&n&&e[0]?.data.length>0){const d=t.timeScale().timeToCoordinate(n),N=e[0].data[e[0].data.length-1].value,h=i[0].priceToCoordinate(N);d!==null&&h!==null&&A({x:d,y:h})}}),()=>{t.unsubscribeCrosshairMove(l),R&&t.unsubscribeClick(l)}},[e,L,R]),c.useEffect(()=>{const t=j.current;if(!t||e.length===0)return;const a=t.timeScale(),n=()=>{if(!U.current)return;const l=a.getVisibleRange();if(!l)return;const i=Number(l.from),g=Number(l.to),d=[];for(const N of e)for(const h of N.data){const P=Number(h.time);P>=i&&P<=g&&d.push(h.value)}d.length>0&&U.current(d)};return a.subscribeVisibleLogicalRangeChange(n),()=>{a.unsubscribeVisibleLogicalRangeChange(n)}},[e]),c.useEffect(()=>{const t=j.current,a=Array.from(V.current.values()),n=[];if(t&&a.length>0&&S){const l=X.getDefaultVerticalLine(),i=a[0];for(const g of S){const d=new Oe.VertLine(t,i,g.xCoordinate,{...l,...g.options||{}});i.attachPrimitive(d),n.push(d)}}return()=>{if(a.length>0){const l=a[0];for(const i of n)l.detachPrimitive(i)}}},[S]),c.useEffect(()=>{const t=j.current;if(!t||!S?.length){ve([]);return}const a=()=>{const i=t.timeScale(),g=S.map(d=>i.timeToCoordinate(d.xCoordinate)??null);ve(g)};a();const n=t.timeScale(),l=()=>{a()};return n.subscribeVisibleLogicalRangeChange(l),()=>{n.unsubscribeVisibleLogicalRangeChange(l)}},[S]);const B=e.length===1,xe=fe.useMemo(()=>{if(B&&e.length>0){const t=e[0];if(t.data.length>0)return t.data[t.data.length-1]}},[B,e]);return u.jsxs("div",{ref:_,className:ge.cn("relative z-[1] w-full h-full overflow-hidden p-0",m),children:[K!=null&&K!==!1&&B?u.jsx("div",{className:"absolute top-2 left-2 right-2 z-[100] pointer-events-none",children:u.jsx("div",{className:"text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis",children:K})}):ke&&B&&xe&&u.jsx(Ie.GraphCurrentValue,{point:xe,xMeasureUnit:b,yMeasureUnit:x,decimals:G}),Y&&oe&&u.jsx(ye.GraphTooltip,{points:Y,xMeasureUnit:b,yMeasureUnit:x,series:e,position:oe,containerRef:_,decimals:G}),Y&&!oe&&!B&&R&&u.jsx(ye.GraphTooltip,{points:Y,xMeasureUnit:b,yMeasureUnit:x,series:e,containerRef:_,decimals:G,className:"top-2 left-2"}),f&&u.jsx($e,{series:e,onUnselect:y}),S&&S.length>0&&Ce.length===S.length&&u.jsx("div",{className:"absolute inset-0 z-[5] pointer-events-none","aria-hidden":!0,children:S.map((t,a)=>{const n=Ce[a],l=t.options??{},i=l.showLabel!==!1;if(n===null||!i)return null;const{labelText:g,valueStr:d}=Ve(l,x,G);if(!(g||d))return null;const h=l.labelBackgroundColor??l.color??"hsl(var(--background))",P=l.labelTextColor??"hsl(var(--foreground))",T=`${String(t.xCoordinate)}-${g}`;return u.jsxs("div",{className:"absolute top-2 px-2 py-1 rounded text-xs font-medium whitespace-nowrap shadow-sm border border-border",style:{left:n,transform:"translateX(-50%)",backgroundColor:h,color:P},children:[g&&u.jsx("span",{className:"block",children:g}),d&&u.jsx("span",{className:ge.cn("block",g&&"mt-0.5"),children:d})]},T)})}),u.jsx("div",{ref:ee,className:"LightweightChart w-full h-full overflow-hidden"})]})}function $e({series:e,onUnselect:m}){return u.jsx("div",{className:"absolute top-0 left-2 z-[10] flex flex-wrap gap-2",children:e.map((f,y)=>{const b=de(y),x=(f.lineColor??f.color)||b.line,$=f.data.length===0;return u.jsxs("div",{className:ge.cn("flex items-center gap-1.5 px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",$&&"opacity-50"),children:[u.jsx("div",{className:"w-3 h-3 rounded-sm",style:{backgroundColor:x}}),u.jsxs("span",{className:"text-[10px] sm:text-xs font-medium text-foreground",children:[f.label,$&&" (no data)"]}),m&&u.jsx("button",{type:"button",onClick:S=>{S.stopPropagation(),m(f.label)},className:"ml-1 flex items-center justify-center w-4 h-4 rounded-sm hover:bg-muted transition-colors cursor-pointer","aria-label":`Remove ${f.label}`,children:u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground hover:text-foreground","aria-hidden":"true",children:[u.jsx("title",{children:"Close"}),u.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),u.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},f.label)})})}exports.DEFAULT_SERIES_COLORS=Z;exports.Graph=De;exports.getSeriesColorPalette=de;exports.getVerticalLineTooltipContent=Ve;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),lt=require("lightweight-charts"),d=require("react"),Lt=require("../../hooks/use-media-query.cjs"),it=require("../../utils/cn.cjs"),I=require("../../utils/colors.cjs"),W=require("./default-config.cjs"),$=require("./formatters.cjs"),Tt=require("./graph-current-value.cjs"),Ft=require("./graph-tooltip.cjs"),Mt=require("./plugins/vertical-line.cjs");function Et(t){const m=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const c in t)if(c!=="default"){const R=Object.getOwnPropertyDescriptor(t,c);Object.defineProperty(m,c,R.get?R:{enumerable:!0,get:()=>t[c]})}}return m.default=t,Object.freeze(m)}const st=Et(d);function St(t,m,c){const R=t.labelText??"",b=t.value,w=b===void 0?"":typeof b=="number"?m==="$"?`$${$.formatExactValue(b,void 0,c)}`:m==="%"?`${$.formatExactValue(b,void 0,c)}%`:$.formatExactValue(b,m!=="none"&&m!=="%"&&m!=="$"?m:void 0,c):String(b);return{labelText:R,valueStr:w}}const X=[{line:"#02c39a",top:"rgba(2, 195, 154, 0.56)",bottom:"rgba(2, 195, 154, 0.04)"},{line:"#3b82f6",top:"rgba(59, 130, 246, 0.56)",bottom:"rgba(59, 130, 246, 0.04)"},{line:"#ef4444",top:"rgba(239, 68, 68, 0.56)",bottom:"rgba(239, 68, 68, 0.04)"},{line:"#f59e0b",top:"rgba(245, 158, 11, 0.56)",bottom:"rgba(245, 158, 11, 0.04)"},{line:"#8b5cf6",top:"rgba(139, 92, 246, 0.56)",bottom:"rgba(139, 92, 246, 0.04)"},{line:"#ec4899",top:"rgba(236, 72, 153, 0.56)",bottom:"rgba(236, 72, 153, 0.04)"},{line:"#06b6d4",top:"rgba(6, 182, 212, 0.56)",bottom:"rgba(6, 182, 212, 0.04)"},{line:"#ea580c",top:"rgba(234, 88, 12, 0.56)",bottom:"rgba(234, 88, 12, 0.04)"},{line:"#84cc16",top:"rgba(132, 204, 22, 0.56)",bottom:"rgba(132, 204, 22, 0.04)"},{line:"#d946ef",top:"rgba(217, 70, 239, 0.56)",bottom:"rgba(217, 70, 239, 0.04)"},{line:"#0ea5e9",top:"rgba(14, 165, 233, 0.56)",bottom:"rgba(14, 165, 233, 0.04)"},{line:"#14b8a6",top:"rgba(20, 184, 166, 0.56)",bottom:"rgba(20, 184, 166, 0.04)"},{line:"#eab308",top:"rgba(234, 179, 8, 0.56)",bottom:"rgba(234, 179, 8, 0.04)"},{line:"#f43f5e",top:"rgba(244, 63, 94, 0.56)",bottom:"rgba(244, 63, 94, 0.04)"},{line:"#6366f1",top:"rgba(99, 102, 241, 0.56)",bottom:"rgba(99, 102, 241, 0.04)"},{line:"#10b981",top:"rgba(16, 185, 129, 0.56)",bottom:"rgba(16, 185, 129, 0.04)"},{line:"#78716c",top:"rgba(120, 113, 108, 0.56)",bottom:"rgba(120, 113, 108, 0.04)"},{line:"#64748b",top:"rgba(100, 116, 139, 0.56)",bottom:"rgba(100, 116, 139, 0.04)"},{line:"#475569",top:"rgba(71, 85, 105, 0.56)",bottom:"rgba(71, 85, 105, 0.04)"}],_t=137.5;function ct(t){if(t<X.length)return X[t];const c=(t-X.length)*_t%360,R=I.hslToHex(c,70,50),{topColor:b,bottomColor:w}=I.generateColorsFromBase(R);return{line:R,top:b,bottom:w}}function At({series:t,className:m,showLegend:c=!1,onUnselectSeries:R,xMeasureUnit:b="time",yMeasureUnit:w="token",optionsOverrides:B,verticalLineOptions:x,currentValueDecimals:Z,useSharedPriceScale:j=!1,showCurrentValue:Rt=!0,graphTitle:K,yScaleMin:ut,yScaleMinMultiple:ft}){const N=d.useRef(null),y=d.useRef(new Map),Q=d.useRef(!1),gt=d.useRef(!0),J=d.useRef(null),wt=d.useRef(null),A=d.useRef(null),U=d.useRef(null),k=Lt.useIsMobile(),E=st.useMemo(()=>t.flatMap(e=>e.data),[t]),yt=st.useMemo(()=>{if(t.length>0){const e=t[t.length-1];if(e.data.length>0)return e.data[e.data.length-1]}},[t]),[dt,tt]=d.useState(()=>{if(!yt)return;const e=new Map;for(const a of t)a.data.length>0&&e.set(a.label,a.data[a.data.length-1]);return e}),[bt,_]=d.useState(null),[mt,ht]=d.useState([]);d.useEffect(()=>{const e=()=>{if(N.current&&A.current){const l=A.current.clientWidth,i=A.current.clientHeight;N.current.resize(l,i)}},a=A.current,r=a?new ResizeObserver(e):null;return a&&r?.observe(a),()=>{a&&r?.unobserve(a)}},[]),d.useEffect(()=>{if(!U.current||Q.current)return;const e=W.getDefaultOptions(),a=I.resolveCSSColor("hsl(var(--foreground))","rgb(0, 0, 0)"),r=lt.createChart(U.current,{...e,rightPriceScale:{...e.rightPriceScale||{},visible:!k,textColor:a},...k&&{crosshair:{...e.crosshair,mode:lt.CrosshairMode.Magnet}},...B});return N.current=r,Q.current=!0,()=>{r.remove(),N.current=null,Q.current=!1,y.current.clear()}},[k,B]),d.useEffect(()=>{const e=N.current;if(!e||t.length===0)return;const r=t.filter(o=>o.data.length>0).length<=1?ut:ft,l=b==="time"?$.getXFormatters(b,E):$.getXFormatters(b),i=E.map(o=>o.value),{formatter:u,tickmarksFormatter:g,updateVisibleRange:P,updateLastValues:h}=$.createAdaptiveYAxisFormatter(i,w,{yScaleMin:r});J.current=P,wt.current=h;const L=t.filter(o=>o.data.length>0).map(o=>o.data[o.data.length-1].value);h(L);const T=W.getDefaultOptions();e.applyOptions({localization:{...T.localization||{},timeFormatter:o=>l.timeFormatter(parseFloat(o),void 0)},timeScale:{...T.timeScale||{},tickMarkFormatter:l.tickMarkFormatter,minBarSpacing:0}});const p=(E.length>0?Math.min(...E.map(o=>o.value)):0)<0,S=E.some(o=>o.value===0),C=!p&&S,v=t.length>1&&!j,F=t.length>1&&!j||k,M=I.resolveCSSColor("hsl(var(--foreground))","rgb(0, 0, 0)");e.applyOptions({rightPriceScale:{...T.rightPriceScale||{},visible:!F,textColor:M,...C&&{scaleMargins:{top:.3,bottom:0}}}});const et=new Set(y.current.keys()),ot=new Set(t.map(o=>o.label));for(const o of et)if(!ot.has(o)){const n=y.current.get(o);n&&(e.removeSeries(n),y.current.delete(o))}const Vt=W.getDefaultSeries(),rt=[];let H=0;for(let o=0;o<t.length;o++){const n=t[o],G=ct(o),O=n.lineColor??n.color??G.line;let D,q;if(n.lineColor??n.color)if(n.topColor&&n.bottomColor)D=n.topColor,q=n.bottomColor;else if(n.topColor){const s=I.generateColorsFromBase(O);D=n.topColor,q=s.bottomColor}else if(n.bottomColor)D=I.generateColorsFromBase(O).topColor,q=n.bottomColor;else{const s=I.generateColorsFromBase(O);D=s.topColor,q=s.bottomColor}else D=n.topColor||G.top,q=n.bottomColor||G.bottom;if(n.data.length===0){const s=y.current.get(n.label);s&&(e.removeSeries(s),y.current.delete(n.label));continue}const kt=(n.data.length>0?Math.min(...n.data.map(s=>s.value)):0)<0,jt=n.data.some(s=>s.value===0),Nt=!kt&&jt,Ct=j||!v||H===0?"right":`scale-${H}`;v&&rt.push({priceScaleId:Ct||"right",shouldPreventNegativeAxis:Nt,seriesIndex:H});const vt=(j||!v)&&r!==void 0&&typeof r=="number",xt={lineColor:O,topColor:D,bottomColor:q,priceScaleId:Ct,priceFormat:{type:"custom",minMove:.01,formatter:vt&&typeof r=="number"?s=>u(s<r?r:s):u,tickmarksFormatter:g},autoscaleInfoProvider:s=>{if(!vt)return s();const at=s();if(at?.priceRange){const Pt=r;at.priceRange.minValue=Pt}return at}};let z=y.current.get(n.label);z?(z.applyOptions(xt),z.setData(n.data.map(s=>({...s,time:s.time})))):(z=e.addSeries(lt.AreaSeries,{...Vt,...xt}),z.setData(n.data.map(s=>({...s,time:s.time}))),y.current.set(n.label,z)),H++}if(v&&rt.length>0)for(const o of rt)try{const n=e.priceScale(o.priceScaleId);n&&n.applyOptions({visible:!1,autoScale:!0,scaleMargins:{top:.1,bottom:.1,...o.shouldPreventNegativeAxis&&{top:.3,bottom:0}},alignLabels:!0,borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",entireTextOnly:!1,textColor:M})}catch(n){console.warn(`Failed to configure price scale ${o.priceScaleId} for series ${o.seriesIndex}:`,n)}else if(!v)try{const o=e.priceScale("right");o&&o.applyOptions({visible:!k,autoScale:!0,scaleMargins:{top:.1,bottom:r!==void 0||C?0:.1,...C&&{top:.3}},alignLabels:!0,borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",entireTextOnly:!1,textColor:M})}catch{}if(r!==void 0&&!k&&(j||!v)&&e.applyOptions({handleScroll:{vertTouchDrag:!1}}),E.length>0){const o=E.map(O=>Number(O.time)),n=Math.min(...o),G=Math.max(...o);e.timeScale().setVisibleRange({from:n,to:G})}gt.current&&(gt.current=!1);const nt=new Map;for(const o of t)o.data.length>0&&nt.set(o.label,o.data[o.data.length-1]);tt(nt.size>0?nt:void 0)},[t,E,b,w,k,j,ut,ft]),d.useEffect(()=>{const e=N.current;if(!e||t.length===0)return;const a=t.length===1;let r;for(const i of t)if(i.data.length>0){r=i.data[i.data.length-1].time;break}if(!r)return;const l=i=>{const{time:u=r,seriesData:g,point:P}=i||{},h=Array.from(y.current.values());if(!P||!u){const V=new Map;for(const p of t)p.data.length>0&&V.set(p.label,p.data[p.data.length-1]);if(tt(V.size>0?V:void 0),a||j)_(null);else if(h[0]&&r){const S=e.timeScale().timeToCoordinate(r),C=t[0];if(C.data.length>0){const v=C.data[C.data.length-1].value,F=h[0].priceToCoordinate(v);S!==null&&F!==null&&_({x:S,y:F})}}return}const L=new Map;let T;for(let V=0;V<t.length;V++){const p=t[V],S=h[V];if(!S)continue;const C=g?.get(S),v=C&&"value"in C?C.value:void 0,F=p.data[p.data.length-1],M=v!==void 0?v:F?.value??0;V===0&&(T=M),L.set(p.label,{value:M,time:u})}if(tt(L),T!==void 0&&h[0]){const p=e.timeScale().timeToCoordinate(u),S=h[0].priceToCoordinate(T);if(p!==null&&S!==null){const C=A.current;if(C){const v=C.querySelector(".LightweightChart");if(v){const F=v.getBoundingClientRect(),M=C.getBoundingClientRect(),et=p+(F.left-M.left),ot=S+(F.top-M.top);_({x:et,y:ot})}else _({x:p,y:S})}else _({x:p,y:S})}else _(null)}else _(null)};return e.subscribeCrosshairMove(l),k&&e.subscribeClick(l),!a&&!j&&requestAnimationFrame(()=>{const i=Array.from(y.current.values());if(i[0]&&r&&t[0]?.data.length>0){const g=e.timeScale().timeToCoordinate(r),P=t[0].data[t[0].data.length-1].value,h=i[0].priceToCoordinate(P);g!==null&&h!==null&&_({x:g,y:h})}}),()=>{e.unsubscribeCrosshairMove(l),k&&e.unsubscribeClick(l)}},[t,j,k]),d.useEffect(()=>{const e=N.current;if(!e||t.length===0)return;const a=e.timeScale(),r=()=>{if(!J.current)return;const l=a.getVisibleRange();if(!l)return;const i=Number(l.from),u=Number(l.to),g=[];for(const P of t)for(const h of P.data){const L=Number(h.time);L>=i&&L<=u&&g.push(h.value)}g.length>0&&J.current(g)};return a.subscribeVisibleLogicalRangeChange(r),()=>{a.unsubscribeVisibleLogicalRangeChange(r)}},[t]),d.useEffect(()=>{const e=N.current,a=Array.from(y.current.values()),r=[];if(e&&a.length>0&&x){const l=W.getDefaultVerticalLine(),i=a[0];for(const u of x){const g=new Mt.VertLine(e,i,u.xCoordinate,{...l,...u.options||{}});i.attachPrimitive(g),r.push(g)}}return()=>{if(a.length>0){const l=a[0];for(const i of r)l.detachPrimitive(i)}}},[x]),d.useEffect(()=>{const e=N.current;if(!e||!x?.length){ht([]);return}const a=()=>{const i=e.timeScale(),u=x.map(g=>i.timeToCoordinate(g.xCoordinate)??null);ht(u)};a();const r=e.timeScale(),l=()=>{a()};return r.subscribeVisibleLogicalRangeChange(l),()=>{r.unsubscribeVisibleLogicalRangeChange(l)}},[x]);const Y=t.length===1,pt=st.useMemo(()=>{if(Y&&t.length>0){const e=t[0];if(e.data.length>0)return e.data[e.data.length-1]}},[Y,t]);return f.jsxs("div",{ref:A,className:it.cn("relative z-[1] w-full h-full overflow-hidden p-0",m),children:[K!=null&&K!==!1&&Y?f.jsx("div",{className:"absolute top-2 left-2 right-2 z-[100] pointer-events-none",children:f.jsx("div",{className:"text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis",children:K})}):Rt&&Y&&pt&&f.jsx(Tt.GraphCurrentValue,{point:pt,xMeasureUnit:b,yMeasureUnit:w,decimals:Z}),dt&&bt&&f.jsx(Ft.GraphTooltip,{points:dt,xMeasureUnit:b,yMeasureUnit:w,series:t,position:bt,containerRef:A,decimals:Z}),c&&f.jsx(It,{series:t,onUnselect:R}),x&&x.length>0&&mt.length===x.length&&f.jsx("div",{className:"absolute inset-0 z-[5] pointer-events-none","aria-hidden":!0,children:x.map((e,a)=>{const r=mt[a],l=e.options??{},i=l.showLabel!==!1;if(r===null||!i)return null;const{labelText:u,valueStr:g}=St(l,w,Z);if(!(u||g))return null;const h=l.labelBackgroundColor??l.color??"hsl(var(--background))",L=l.labelTextColor??"hsl(var(--foreground))",T=`${String(e.xCoordinate)}-${u}`;return f.jsxs("div",{className:"absolute top-2 px-2 py-1 rounded text-xs font-medium whitespace-nowrap shadow-sm border border-border",style:{left:r,transform:"translateX(-50%)",backgroundColor:h,color:L},children:[u&&f.jsx("span",{className:"block",children:u}),g&&f.jsx("span",{className:it.cn("block",u&&"mt-0.5"),children:g})]},T)})}),f.jsx("div",{ref:U,className:"LightweightChart w-full h-full overflow-hidden"})]})}function It({series:t,onUnselect:m}){return f.jsx("div",{className:"absolute top-0 left-2 z-[10] flex flex-wrap gap-2",children:t.map((c,R)=>{const b=ct(R),w=(c.lineColor??c.color)||b.line,B=c.data.length===0;return f.jsxs("div",{className:it.cn("flex items-center gap-1.5 px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",B&&"opacity-50"),children:[f.jsx("div",{className:"w-3 h-3 rounded-sm",style:{backgroundColor:w}}),f.jsxs("span",{className:"text-[10px] sm:text-xs font-medium text-foreground",children:[c.label,B&&" (no data)"]}),m&&f.jsx("button",{type:"button",onClick:x=>{x.stopPropagation(),m(c.label)},className:"ml-1 flex items-center justify-center w-4 h-4 rounded-sm hover:bg-muted transition-colors cursor-pointer","aria-label":`Remove ${c.label}`,children:f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground hover:text-foreground","aria-hidden":"true",children:[f.jsx("title",{children:"Close"}),f.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),f.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},c.label)})})}exports.DEFAULT_SERIES_COLORS=X;exports.Graph=At;exports.getSeriesColorPalette=ct;exports.getVerticalLineTooltipContent=St;
|
|
@@ -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
|
};
|
|
@@ -4,13 +4,13 @@ const e = {
|
|
|
4
4
|
bottomColor: "rgba(76, 175, 80, 0.04)",
|
|
5
5
|
lineColor: "#02c39a",
|
|
6
6
|
lineWidth: 2
|
|
7
|
-
},
|
|
7
|
+
}, i = {
|
|
8
8
|
showLabel: !0,
|
|
9
9
|
color: "#02c39a",
|
|
10
10
|
labelBackgroundColor: "#02c39a",
|
|
11
11
|
width: 2
|
|
12
12
|
};
|
|
13
|
-
function
|
|
13
|
+
function t() {
|
|
14
14
|
const r = o(
|
|
15
15
|
"hsl(var(--foreground))",
|
|
16
16
|
"rgb(0, 0, 0)"
|
|
@@ -21,7 +21,10 @@ function i() {
|
|
|
21
21
|
borderColor: "rgba(224, 227, 235, 0.1)",
|
|
22
22
|
visible: !0,
|
|
23
23
|
fixLeftEdge: !0,
|
|
24
|
-
fixRightEdge: !0
|
|
24
|
+
fixRightEdge: !0,
|
|
25
|
+
// Preserve visible time range on resize (e.g. when second series is added
|
|
26
|
+
// and legend appears). Avoids range shrinking to a few days.
|
|
27
|
+
lockVisibleTimeRangeOnResize: !0
|
|
25
28
|
},
|
|
26
29
|
rightPriceScale: {
|
|
27
30
|
visible: !0,
|
|
@@ -71,7 +74,7 @@ function a() {
|
|
|
71
74
|
lineWidth: 2
|
|
72
75
|
};
|
|
73
76
|
}
|
|
74
|
-
function
|
|
77
|
+
function s() {
|
|
75
78
|
return {
|
|
76
79
|
showLabel: !0,
|
|
77
80
|
color: e.lineColor,
|
|
@@ -79,7 +82,7 @@ function b() {
|
|
|
79
82
|
width: 2
|
|
80
83
|
};
|
|
81
84
|
}
|
|
82
|
-
const
|
|
85
|
+
const b = {
|
|
83
86
|
timeScale: {
|
|
84
87
|
borderVisible: !0,
|
|
85
88
|
borderColor: "rgba(224, 227, 235, 0.1)",
|
|
@@ -127,9 +130,9 @@ const s = {
|
|
|
127
130
|
};
|
|
128
131
|
export {
|
|
129
132
|
e as DEFAULT_AREA_SERIES,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
b as DEFAULT_OPTIONS,
|
|
134
|
+
i as DEFAULT_VERTICAL_LINE,
|
|
135
|
+
t as getDefaultOptions,
|
|
133
136
|
a as getDefaultSeries,
|
|
134
|
-
|
|
137
|
+
s as getDefaultVerticalLine
|
|
135
138
|
};
|