@cleen/ui 0.1.256 → 0.1.258

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{cn as je}from"@cleen/ui-core";import{forwardRef as Ze}from"react";import{renderToStaticMarkup as Ye}from"react-dom/server";import qe from"react-apexcharts";var J={chart:{toolbar:{show:!0,tools:{download:!0,selection:!0,zoom:!0,zoomin:!0,zoomout:!0,pan:!0,reset:!0}},animations:{enabled:!0}},dataLabels:{enabled:!1},stroke:{curve:"smooth",width:2},xaxis:{labels:{style:{fontSize:"12px"}}},yaxis:{labels:{style:{fontSize:"12px"}}},legend:{position:"top",horizontalAlign:"left"},tooltip:{enabled:!0,theme:"light"}};import{jsx as de}from"react/jsx-runtime";var Je="[&_.apexcharts-tooltip]:!cleen-bg-transparent [&_.apexcharts-tooltip]:!cleen-border-0 [&_.apexcharts-tooltip]:!cleen-shadow-none [&_.apexcharts-tooltip]:!cleen-p-0 [&_.apexcharts-tooltip]:!cleen-overflow-visible [&_.apexcharts-tooltip]:!cleen-whitespace-normal",ue=Ze(function({type:t="line",series:r,options:n={},width:m="100%",height:b=350,className:y,style:x,renderTooltip:u},S){let k=u?{...n.tooltip,custom:(d=>{let A=u({seriesIndex:d.seriesIndex,dataPointIndex:d.dataPointIndex,series:d.series,w:d.w});return A?Ye(A):""})}:n.tooltip,o={...J,...n,chart:{...J.chart,...n.chart,type:t},...k?{tooltip:k}:{}},T=!!o.tooltip?.custom;return de("div",{className:je("cleen",T&&Je,y),style:x,children:de(qe,{options:o,series:r,type:t,width:m,height:b,ref:S})})}),w=ue;import{applyDefaults as Qe}from"@cleen/ui-core";import{forwardRef as et}from"react";var me={chart:{type:"bar",zoom:{enabled:!1},toolbar:{show:!1},animations:{enabled:!1},fontFamily:"inherit",background:"transparent",parentHeightOffset:0},dataLabels:{enabled:!1},legend:{show:!1}};import{jsx as rt}from"react/jsx-runtime";var tt=et(function({options:t,...r},n){return rt(w,{type:"bar",ref:n,options:Qe(me,t??{}),...r})});import{applyDefaults as G}from"@cleen/ui-core";import{forwardRef as ot,useMemo as $}from"react";import{ColorHelpers as M}from"@cleen/ui-core";var fe={marker:{size:2,fillColor:"rgba(var(--cleen-gray-500))",strokeColor:"rgba(var(--cleen-gray-500))",offsetY:-16,shape:"triangle"},label:{borderWidth:0,offsetY:-20,style:{color:"rgba(var(--cleen-gray-500))",background:"transparent",fontSize:"11px"}}},he={label:{borderColor:"transparent",style:{color:"rgba(var(--cleen-white))",background:"rgba(var(--cleen-primary))"}},fillColor:"rgba(var(--cleen-primary))"},ge={label:{borderWidth:0,offsetY:-15,orientation:"horizontal",style:{color:"rgba(var(--cleen-primary))",background:"transparent",fontSize:"16px",fontWeight:700}},borderColor:"rgba(var(--cleen-primary))"},ye={marker:{size:8,fillColor:"rgba(var(--cleen-primary))",strokeColor:"rgba(var(--cleen-white))"}},xe={chart:{zoom:{enabled:!1},toolbar:{show:!1},animations:{enabled:!1}},stroke:{curve:"monotoneCubic",width:2.5},colors:[M.getComputedColor("var(--cleen-error)"),M.getComputedColor("var(--cleen-primary)"),M.getComputedColor("var(--cleen-success)")],fill:{type:"gradient",gradient:{shade:"light",type:"vertical",shadeIntensity:.6,gradientToColors:[M.getComputedColor("var(--cleen-error)")||"",M.getComputedColor("var(--cleen-primary)")||"",M.getComputedColor("var(--cleen-success)")||""],inverseColors:!1,opacityFrom:.95,opacityTo:.6}},yaxis:{show:!1},tooltip:{enabled:!0,x:{formatter:function(e){return`Score: ${typeof e=="string"?Number(e):e}`}},y:{formatter:function(e){return`${Number(e).toFixed(4)}`}}},grid:{show:!1},legend:{show:!1}};var be=(e,t)=>({middle:e,leftSigma:e-t,left2Sigma:e-2*t,left:e-3*t,rightSigma:e+2*t,right2Sigma:e+2*t,right:e+3*t}),Ce=(e,t,r,n)=>({middle:e,leftSigma:e-t,left2Sigma:e-2*t,left:r,rightSigma:e+t,right2Sigma:e+2*t,right:n}),Se=(e,t)=>{let r={};switch(e.type){case"range":r={x:t[e.x],x2:t[e.x2]};break;case"offset":r={x:e.x-e.offset,x2:e.x+e.offset};break;case"region":e.x>=t.left&&e.x<t.left2Sigma?r={x:t.left,x2:t.left2Sigma}:e.x>=t.left2Sigma&&e.x<t.leftSigma?r={x:t.left2Sigma,x2:t.leftSigma}:e.x>=t.leftSigma&&e.x<t.middle?r={x:t.leftSigma,x2:t.middle}:e.x>=t.middle&&e.x<t.rightSigma?r={x:t.middle,x2:t.rightSigma}:e.x>=t.rightSigma&&e.x<t.right2Sigma?r={x:t.rightSigma,x2:t.right2Sigma}:e.x>=t.right2Sigma&&e.x<t.right&&(r={x:t.right2Sigma,x2:t.right});break;default:r={x:e.x,x2:e.x2};break}return r};import{jsx as at}from"react/jsx-runtime";var nt=ot(function({serie:t,labels:r,sigma:n,pointAnnotations:m,rangeAnnotations:b,highlightAnnotations:y,options:x,height:u=360,...S},k){let o=$(()=>t.sort((i,s)=>i.x-s.x),[t]),T=$(()=>{let i=new Map;return t.forEach(s=>i.set(s.x,s.y)),i},[t]),d=o[Math.floor(o.length/2)],A=$(()=>{let{below:i,middle:s,above:l}=t.reduce((c,a)=>(a.x<d.x-2*n?c.below.push(a):a.x>=d.x+2*n?(a.x===d.x+2*n&&c.middle.push(a),c.above.push(a)):(a.x===d.x-2*n&&c.below.push(a),c.middle.push(a)),c),{below:[],middle:[],above:[]});return[{name:r?.below||"Below threshold",data:i},{name:r?.middle||"Middle grounds",data:s},{name:r?.above||"Above threshold",data:l}]},[n,t,r,d]),O=$(()=>{if(!m)return[];let i=be(d.x,n);return Object.entries(m).map(([s,l])=>{let c=i[s];return{x:c,y:T.get(c)||0,...G(fe,l)}})},[m,n,T]),R=$(()=>{if(!b)return[];let i=Ce(d.x,n,o[0].x,o[o.length-1].x);return b.map(s=>{let l=Se(s,i);return{...G(he,s),...l}})},[b,n,o]),{highlightPointAnnotations:N,highlightLineAnnotations:p}=$(()=>{if(!y)return{highlightLineAnnotations:[],highlightPointAnnotations:[]};let i=[],s=[],l=({x:a,line:f})=>{s.push(G(ge,{x:a,...f}))},c=({x:a,y:f,point:g})=>{i.push(G(ye,{x:a,y:f,...g}))};return y?.forEach(a=>{switch(a.show){case"line":l(a);break;case"point":c(a);break;case"both":l(a),c(a);break;default:break}}),{highlightPointAnnotations:i,highlightLineAnnotations:s}},[y]);return at(w,{series:A,options:{...G(xe,x),annotations:{...x?.annotations,points:[...O,...N,...x?.annotations?.points||[]],xaxis:[...R,...p,...x?.annotations?.xaxis||[]]}},height:u,ref:k,type:"area",...S})});import{applyDefaults as ke,cn as pt}from"@cleen/ui-core";import{forwardRef as ct,useId as dt,useMemo as te}from"react";var Q="rgba(var(--cleen-primary-300))",Te="rgba(var(--cleen-primary-500))";var ee="rgba(var(--cleen-primary-900))";var Ae={style:"slantedLines",width:12,height:12,strokeWidth:2},ve={chart:{type:"rangeBar",zoom:{enabled:!1},toolbar:{show:!1},animations:{enabled:!1},fontFamily:"inherit",background:"transparent",parentHeightOffset:0},plotOptions:{bar:{horizontal:!0,barHeight:"50%",rangeBarGroupRows:!0,borderRadius:2}},dataLabels:{enabled:!1},legend:{show:!1},states:{hover:{filter:{type:"none"}},active:{filter:{type:"none"}}},grid:{borderColor:"rgba(var(--cleen-gray-200))",xaxis:{lines:{show:!0}},yaxis:{lines:{show:!0}}},xaxis:{type:"numeric",tickAmount:8,axisBorder:{show:!1},axisTicks:{show:!1},labels:{style:{colors:"rgba(var(--cleen-gray-500))",fontSize:"12px"}}},yaxis:{labels:{style:{colors:"rgba(var(--cleen-gray-700))",fontSize:"12px"}}},tooltip:{enabled:!0,theme:"light"}};import{Fragment as Oe,jsx as L,jsxs as re}from"react/jsx-runtime";var ut=ct(function({series:t,highlightRange:r,classNames:n,styles:m,options:b,height:y=320,formatXValue:x,renderTooltip:u,...S},k){let o=te(()=>t.map(({category:i,from:s,to:l,point:c,pointSize:a,color:f})=>({name:i,data:[{x:i,y:[s,l],...c!=null?{goals:[{value:c,strokeHeight:0,strokeWidth:a??22,strokeLineCap:"round",strokeColor:f??Q}]}:{}}]})),[t]),T=te(()=>{let i=u??(s=>{let l=c=>c==null?"":x?.(c)??String(c);return re("div",{className:"cleen-p-2 cleen-bg-white cleen-border cleen-border-gray-200 cleen-rounded cleen-shadow",children:[L("strong",{className:"cleen-text-gray-900",children:s.category}),L("br",{}),L("p",{className:"cleen-text-gray-900",children:s.point!=null?l(s.point):`${l(s.from)} - ${l(s.to)}`})]})});return({seriesIndex:s})=>{let l=t[s];return l?i(l):null}},[t,u,x]),d=te(()=>{let i=t.map(l=>l.point!=null?"rgba(0, 0, 0, 0)":l.color??Q),s=t.map(l=>l.striped?"pattern":"solid");return{colors:i,fill:{type:s,opacity:1,pattern:Ae},xaxis:{labels:{formatter:x}},...r?{annotations:{xaxis:r.map(({from:l,to:c,color:a,opacity:f})=>({x:l,x2:c,fillColor:a??Te,opacity:f??.12,borderColor:"transparent"}))}}:{}}},[t,r,x]),O=`cleen-ff-${dt().replace(/[^a-zA-Z0-9]/g,"")}`,R=`${O}-stripes`,N=t.some(i=>i.striped),p=`.${O} .apexcharts-rangebar-area[fill^="url("]:hover{fill:url(#${R});stroke:${ee}}`;return re(Oe,{children:[N&&re(Oe,{children:[L("svg",{"aria-hidden":"true",focusable:"false",style:{position:"absolute",width:0,height:0,overflow:"hidden"},children:L("defs",{children:L("pattern",{id:R,width:12,height:12,patternUnits:"userSpaceOnUse",children:L("line",{x1:0,y1:0,x2:12,y2:12,strokeWidth:2,style:{stroke:ee}})})})}),L("style",{dangerouslySetInnerHTML:{__html:p}})]}),L(w,{type:"rangeBar",ref:k,series:o,options:ke(ke(ve,d),b??{}),height:y,className:pt(O,n?.container),style:m?.container,renderTooltip:T,...S})]})});import{applyDefaults as mt}from"@cleen/ui-core";import{forwardRef as ft}from"react";var Re={chart:{type:"radar",zoom:{enabled:!1},toolbar:{show:!1}},stroke:{width:2},fill:{opacity:.25},markers:{size:4,colors:"transparent",strokeColors:"transparent"},tooltip:{marker:{show:!1}},legend:{show:!1}};import{jsx as gt}from"react/jsx-runtime";var ht=ft(function({options:t,...r},n){return gt(w,{type:"radar",ref:n,options:mt(Re,t),...r})});import{applyDefaults as yt,cn as W}from"@cleen/ui-core";import{useId as xt,useMemo as X,useRef as bt,useState as Ct}from"react";import{Layer as Be,Tooltip as St,Rectangle as Ne,ResponsiveContainer as Tt,Sankey as At}from"recharts";var E={width:"100%",height:420,nodePadding:24,enableToolbar:!1,enableTooltip:!0,highlightOnHover:!0,dimOnHover:!0,dimOpacity:.2,edgeOpacity:.4,edgeGradientFill:!0,nodeWidth:20,nodeBorderWidth:0,nodeBorderColor:null,align:"justify",fontColor:"rgba(var(--cleen-neutral-800, 38, 38, 38))",tooltipBGColor:"rgba(var(--cleen-white))",tooltipBorderColor:"rgba(var(--cleen-gray-200))"};import{Fragment as Dt,jsx as v,jsxs as z}from"react/jsx-runtime";var vt=typeof E.height=="number"?E.height:420,Pe=40,we=60,Ie=8,kt=8,Ot="cleen-min-w-[220px] cleen-max-w-[min(360px,90vw)] cleen-flex cleen-flex-col cleen-gap-2",oe="cleen-m-0 cleen-text-xs cleen-leading-[18px] cleen-whitespace-pre-line cleen-break-words",Rt="cleen-font-semibold",Nt="cleen-font-medium cleen-text-[13px] cleen-mt-1 cleen-opacity-[0.72]",Pt="cleen-font-medium cleen-text-[13px] cleen-mt-[6px]";function wt(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){let t=e.trim();if(!t.endsWith("%")&&t!=="auto"){let r=Number.parseFloat(t);if(Number.isFinite(r))return r}}return vt}function Le(e){return typeof e=="object"&&e!==null&&"id"in e&&"title"in e}function It(e){return typeof e=="object"&&e!==null&&"id"in e&&"title"in e&&"index"in e&&"name"in e}var Ee=["rgba(var(--cleen-primary, 59, 130, 246))","rgba(var(--cleen-success, 34, 197, 94))","rgba(var(--cleen-warning, 245, 158, 11))","rgba(var(--cleen-error, 239, 68, 68))","rgba(var(--cleen-purple, 147, 51, 234))","rgba(var(--cleen-cyan, 6, 182, 212))","rgba(var(--cleen-orange, 249, 115, 22))","rgba(var(--cleen-pink, 236, 72, 153))","rgba(var(--cleen-teal, 20, 184, 166))","rgba(var(--cleen-indigo, 99, 102, 241))","rgba(var(--cleen-rose, 244, 63, 94))","rgba(var(--cleen-amber, 245, 158, 11))"];function Me(e){return e!=null}function Lt(e,t){return[e.source,e.target,e.type??"",e.label??"",e.value,t].join("-").replace(/\s+/g,"_")}function V(e,t){return typeof e=="object"&&e!==null?e.id:t}function _e(e,t){return typeof e=="object"&&e!==null?e.title:t}function ne(e){return typeof e=="object"&&e!==null&&"edgeKey"in e&&"sourceId"in e&&"targetId"in e}function ae(e){return typeof e=="object"&&e!==null&&"payload"in e}function $e(e){if(ae(e))return $e(e.payload);if(ne(e)||It(e))return e}function ie(...e){return e.map(t=>typeof t=="number"?String(t):t?.trim()??"").find(t=>t.length>0)}function He(e){let t=ie(e);if(t)return/[\p{L}\p{N}]/u.test(t)?t:void 0}function De(e){return e.replace(/[^a-zA-Z0-9_-]/g,"_")}function D(e){let t=e.match(/^rgba\((var\(.+\)),\s*([0-9]*\.?[0-9]+)\)$/i);if(t)return{color:`rgb(${t[1]})`,opacity:Number.parseFloat(t[2])};let r=e.match(/^rgba\((var\(.+\))\)$/i);if(r)return{color:`rgb(${r[1]})`,opacity:1};let n=e.match(/^rgba\(\s*(\d+\s*,\s*\d+\s*,\s*\d+)\s*,\s*([0-9]*\.?[0-9]+)\s*\)$/i);return n?{color:`rgb(${n[1]})`,opacity:Number.parseFloat(n[2])}:{color:e,opacity:1}}function le(e,t){return D(t??Ee[e%Ee.length])}function Fe(e){return e.length*kt}function Et(e){let t=new Set,r=new Set([e.id]);for(let n of[...e.sourceLinks??[],...e.targetLinks??[]])t.add(n.edgeKey),r.add(V(n.source,n.sourceId)),r.add(V(n.target,n.targetId));return{activeLinkKeys:t,activeNodeIds:r}}function _t(e){return{activeLinkKeys:new Set([e.edgeKey]),activeNodeIds:new Set([V(e.source,e.sourceId),V(e.target,e.targetId)])}}function Ht(e,t,r,n,m){return!e||e.activeNodeIds.has(t)?1:n?m??E.dimOpacity??.2:r?.55:1}function Ft(e,t,r,n,m,b){return e?e.activeLinkKeys.has(t)?n?Math.max(r,.9):r:m?b??E.dimOpacity??.2:n?Math.min(r,.3):r:r}var Bt=({dimOnHover:e,dimOpacity:t,fontColor:r,x:n,y:m,width:b,height:y,highlightOnHover:x,hoverState:u,index:S,outgoingEdgesById:k,payload:o,stroke:T,strokeWidth:d})=>{if(o===void 0||n===void 0||m===void 0||b===void 0||y===void 0||S===void 0)return null;let A=k?.get(o.id)??[],O=A.length>0,R=le(S,o.color),N=D(r),p=Ht(u,o.id,x,e,t),i=new Set(A.map(f=>f.color).filter(Me)),s=Array.from(i)[0],l=O&&A.length>1&&i.size>1&&i.size===A.length,c=l?A:[],a=c.reduce((f,g)=>f+(g.value??0),0);return z(Be,{children:[l&&a>0?c.map((f,g)=>{let h=c.slice(0,g).reduce((F,B)=>F+(B.value??0),0),C=m+h/a*y,P=(f.value??0)/a*y,I=D(f.color??R.color),_=g===0,H=g===c.length-1;return v(Ne,{x:n,y:C,width:b,height:P,fill:I.color,fillOpacity:I.opacity*p,stroke:T,strokeWidth:d,radius:[_?2:0,_?2:0,H?2:0,H?2:0]},`${f.source}-${f.target}-${g}`)}):v(Ne,{x:n,y:m,width:b,height:y,fill:O&&i.size===1?D(s??R.color).color:R.color,fillOpacity:(O&&i.size===1?D(s??R.color).opacity:R.opacity)*p,stroke:T,strokeWidth:d,radius:[2,2,2,2]}),v("text",{textAnchor:O?"end":"start",x:O?n-8:n+b+8,y:m+y/2,dy:"0.35em",fontSize:"14",fill:N.color,fillOpacity:N.opacity*p,fontWeight:600,children:o.name})]},`CustomNode${S}`)},Mt=({sourceX:e,targetX:t,sourceY:r,targetY:n,sourceControlX:m,targetControlX:b,linkWidth:y,index:x,payload:u,opacity:S,chartId:k,dimOnHover:o,dimOpacity:T,edgeGradientFill:d,highlightOnHover:A,hoverState:O})=>{if(u===void 0||e===void 0||t===void 0||r===void 0||n===void 0||m===void 0||b===void 0||y===void 0)return null;let R=S??E.edgeOpacity??.4,N=Ft(O,u.edgeKey,R,A,o,T),p=u.color?D(u.color):null,i=p??le(typeof u.source=="object"?u.source.index:0,typeof u.source=="object"?u.source.color:void 0),s=p??le(typeof u.target=="object"?u.target.index:1,typeof u.target=="object"?u.target.color:void 0),l=De(`linkGradient-${k}-${u.edgeKey}-${x??u.value}`),c=d!==!1&&p===null;return z(Be,{children:[c?v("defs",{children:z("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[v("stop",{offset:"0%",stopColor:i.color,stopOpacity:i.opacity*N}),v("stop",{offset:"100%",stopColor:s.color,stopOpacity:s.opacity*N})]})}):null,v("path",{d:`
1
+ import{cn as je}from"@cleen/ui-core";import{forwardRef as Ze}from"react";import{renderToStaticMarkup as Ye}from"react-dom/server";import qe from"react-apexcharts";var J={chart:{toolbar:{show:!0,tools:{download:!0,selection:!0,zoom:!0,zoomin:!0,zoomout:!0,pan:!0,reset:!0}},animations:{enabled:!0}},dataLabels:{enabled:!1},stroke:{curve:"smooth",width:2},xaxis:{labels:{style:{fontSize:"12px"}}},yaxis:{labels:{style:{fontSize:"12px"}}},legend:{position:"top",horizontalAlign:"left"},tooltip:{enabled:!0,theme:"light"}};import{jsx as de}from"react/jsx-runtime";var Je="[&_.apexcharts-tooltip]:!cleen-bg-transparent [&_.apexcharts-tooltip]:!cleen-border-0 [&_.apexcharts-tooltip]:!cleen-shadow-none [&_.apexcharts-tooltip]:!cleen-p-0 [&_.apexcharts-tooltip]:!cleen-overflow-visible [&_.apexcharts-tooltip]:!cleen-whitespace-normal",ue=Ze(function({type:t="line",series:r,options:n={},width:f="100%",height:b=350,className:y,style:x,renderTooltip:u},S){let k=u?{...n.tooltip,custom:(d=>{let A=u({seriesIndex:d.seriesIndex,dataPointIndex:d.dataPointIndex,series:d.series,w:d.w});return A?Ye(A):""})}:n.tooltip,o={...J,...n,chart:{...J.chart,...n.chart,type:t},...k?{tooltip:k}:{}},T=!!o.tooltip?.custom;return de("div",{className:je("cleen",T&&Je,y),style:x,children:de(qe,{options:o,series:r,type:t,width:f,height:b,ref:S})})}),w=ue;import{applyDefaults as Qe}from"@cleen/ui-core";import{forwardRef as et}from"react";var fe={chart:{type:"bar",zoom:{enabled:!1},toolbar:{show:!1},animations:{enabled:!1},fontFamily:"inherit",background:"transparent",parentHeightOffset:0},dataLabels:{enabled:!1},legend:{show:!1}};import{jsx as rt}from"react/jsx-runtime";var tt=et(function({options:t,...r},n){return rt(w,{type:"bar",ref:n,options:Qe(fe,t??{}),...r})});import{applyDefaults as G}from"@cleen/ui-core";import{forwardRef as ot,useMemo as $}from"react";import{ColorHelpers as M}from"@cleen/ui-core";var me={marker:{size:2,fillColor:"rgba(var(--cleen-neutral-500))",strokeColor:"rgba(var(--cleen-neutral-500))",offsetY:-16,shape:"triangle"},label:{borderWidth:0,offsetY:-20,style:{color:"rgba(var(--cleen-neutral-500))",background:"transparent",fontSize:"11px"}}},he={label:{borderColor:"transparent",style:{color:"rgba(var(--cleen-white))",background:"rgba(var(--cleen-primary))"}},fillColor:"rgba(var(--cleen-primary))"},ge={label:{borderWidth:0,offsetY:-15,orientation:"horizontal",style:{color:"rgba(var(--cleen-primary))",background:"transparent",fontSize:"16px",fontWeight:700}},borderColor:"rgba(var(--cleen-primary))"},ye={marker:{size:8,fillColor:"rgba(var(--cleen-primary))",strokeColor:"rgba(var(--cleen-white))"}},xe={chart:{zoom:{enabled:!1},toolbar:{show:!1},animations:{enabled:!1}},stroke:{curve:"monotoneCubic",width:2.5},colors:[M.getComputedColor("var(--cleen-error)"),M.getComputedColor("var(--cleen-primary)"),M.getComputedColor("var(--cleen-success)")],fill:{type:"gradient",gradient:{shade:"light",type:"vertical",shadeIntensity:.6,gradientToColors:[M.getComputedColor("var(--cleen-error)")||"",M.getComputedColor("var(--cleen-primary)")||"",M.getComputedColor("var(--cleen-success)")||""],inverseColors:!1,opacityFrom:.95,opacityTo:.6}},yaxis:{show:!1},tooltip:{enabled:!0,x:{formatter:function(e){return`Score: ${typeof e=="string"?Number(e):e}`}},y:{formatter:function(e){return`${Number(e).toFixed(4)}`}}},grid:{show:!1},legend:{show:!1}};var be=(e,t)=>({middle:e,leftSigma:e-t,left2Sigma:e-2*t,left:e-3*t,rightSigma:e+2*t,right2Sigma:e+2*t,right:e+3*t}),Ce=(e,t,r,n)=>({middle:e,leftSigma:e-t,left2Sigma:e-2*t,left:r,rightSigma:e+t,right2Sigma:e+2*t,right:n}),Se=(e,t)=>{let r={};switch(e.type){case"range":r={x:t[e.x],x2:t[e.x2]};break;case"offset":r={x:e.x-e.offset,x2:e.x+e.offset};break;case"region":e.x>=t.left&&e.x<t.left2Sigma?r={x:t.left,x2:t.left2Sigma}:e.x>=t.left2Sigma&&e.x<t.leftSigma?r={x:t.left2Sigma,x2:t.leftSigma}:e.x>=t.leftSigma&&e.x<t.middle?r={x:t.leftSigma,x2:t.middle}:e.x>=t.middle&&e.x<t.rightSigma?r={x:t.middle,x2:t.rightSigma}:e.x>=t.rightSigma&&e.x<t.right2Sigma?r={x:t.rightSigma,x2:t.right2Sigma}:e.x>=t.right2Sigma&&e.x<t.right&&(r={x:t.right2Sigma,x2:t.right});break;default:r={x:e.x,x2:e.x2};break}return r};import{jsx as at}from"react/jsx-runtime";var nt=ot(function({serie:t,labels:r,sigma:n,pointAnnotations:f,rangeAnnotations:b,highlightAnnotations:y,options:x,height:u=360,...S},k){let o=$(()=>t.sort((i,s)=>i.x-s.x),[t]),T=$(()=>{let i=new Map;return t.forEach(s=>i.set(s.x,s.y)),i},[t]),d=o[Math.floor(o.length/2)],A=$(()=>{let{below:i,middle:s,above:l}=t.reduce((c,a)=>(a.x<d.x-2*n?c.below.push(a):a.x>=d.x+2*n?(a.x===d.x+2*n&&c.middle.push(a),c.above.push(a)):(a.x===d.x-2*n&&c.below.push(a),c.middle.push(a)),c),{below:[],middle:[],above:[]});return[{name:r?.below||"Below threshold",data:i},{name:r?.middle||"Middle grounds",data:s},{name:r?.above||"Above threshold",data:l}]},[n,t,r,d]),O=$(()=>{if(!f)return[];let i=be(d.x,n);return Object.entries(f).map(([s,l])=>{let c=i[s];return{x:c,y:T.get(c)||0,...G(me,l)}})},[f,n,T]),R=$(()=>{if(!b)return[];let i=Ce(d.x,n,o[0].x,o[o.length-1].x);return b.map(s=>{let l=Se(s,i);return{...G(he,s),...l}})},[b,n,o]),{highlightPointAnnotations:N,highlightLineAnnotations:p}=$(()=>{if(!y)return{highlightLineAnnotations:[],highlightPointAnnotations:[]};let i=[],s=[],l=({x:a,line:m})=>{s.push(G(ge,{x:a,...m}))},c=({x:a,y:m,point:g})=>{i.push(G(ye,{x:a,y:m,...g}))};return y?.forEach(a=>{switch(a.show){case"line":l(a);break;case"point":c(a);break;case"both":l(a),c(a);break;default:break}}),{highlightPointAnnotations:i,highlightLineAnnotations:s}},[y]);return at(w,{series:A,options:{...G(xe,x),annotations:{...x?.annotations,points:[...O,...N,...x?.annotations?.points||[]],xaxis:[...R,...p,...x?.annotations?.xaxis||[]]}},height:u,ref:k,type:"area",...S})});import{applyDefaults as ke,cn as pt}from"@cleen/ui-core";import{forwardRef as ct,useId as dt,useMemo as te}from"react";var Q="rgba(var(--cleen-primary-300))",Te="rgba(var(--cleen-primary-500))";var ee="rgba(var(--cleen-primary-900))";var Ae={style:"slantedLines",width:12,height:12,strokeWidth:2},ve={chart:{type:"rangeBar",zoom:{enabled:!1},toolbar:{show:!1},animations:{enabled:!1},fontFamily:"inherit",background:"transparent",parentHeightOffset:0},plotOptions:{bar:{horizontal:!0,barHeight:"50%",rangeBarGroupRows:!0,borderRadius:2}},dataLabels:{enabled:!1},legend:{show:!1},states:{hover:{filter:{type:"none"}},active:{filter:{type:"none"}}},grid:{borderColor:"rgba(var(--cleen-neutral-200))",xaxis:{lines:{show:!0}},yaxis:{lines:{show:!0}}},xaxis:{type:"numeric",tickAmount:8,axisBorder:{show:!1},axisTicks:{show:!1},labels:{style:{colors:"rgba(var(--cleen-neutral-500))",fontSize:"12px"}}},yaxis:{labels:{style:{colors:"rgba(var(--cleen-neutral-700))",fontSize:"12px"}}},tooltip:{enabled:!0,theme:"light"}};import{Fragment as Oe,jsx as L,jsxs as re}from"react/jsx-runtime";var ut=ct(function({series:t,highlightRange:r,classNames:n,styles:f,options:b,height:y=320,formatXValue:x,renderTooltip:u,...S},k){let o=te(()=>t.map(({category:i,from:s,to:l,point:c,pointSize:a,color:m})=>({name:i,data:[{x:i,y:[s,l],...c!=null?{goals:[{value:c,strokeHeight:0,strokeWidth:a??22,strokeLineCap:"round",strokeColor:m??Q}]}:{}}]})),[t]),T=te(()=>{let i=u??(s=>{let l=c=>c==null?"":x?.(c)??String(c);return re("div",{className:"cleen-p-2 cleen-bg-surface cleen-border cleen-border-border cleen-rounded cleen-shadow",children:[L("strong",{className:"cleen-text-foreground",children:s.category}),L("br",{}),L("p",{className:"cleen-text-foreground",children:s.point!=null?l(s.point):`${l(s.from)} - ${l(s.to)}`})]})});return({seriesIndex:s})=>{let l=t[s];return l?i(l):null}},[t,u,x]),d=te(()=>{let i=t.map(l=>l.point!=null?"rgba(0, 0, 0, 0)":l.color??Q),s=t.map(l=>l.striped?"pattern":"solid");return{colors:i,fill:{type:s,opacity:1,pattern:Ae},xaxis:{labels:{formatter:x}},...r?{annotations:{xaxis:r.map(({from:l,to:c,color:a,opacity:m})=>({x:l,x2:c,fillColor:a??Te,opacity:m??.12,borderColor:"transparent"}))}}:{}}},[t,r,x]),O=`cleen-ff-${dt().replace(/[^a-zA-Z0-9]/g,"")}`,R=`${O}-stripes`,N=t.some(i=>i.striped),p=`.${O} .apexcharts-rangebar-area[fill^="url("]:hover{fill:url(#${R});stroke:${ee}}`;return re(Oe,{children:[N&&re(Oe,{children:[L("svg",{"aria-hidden":"true",focusable:"false",style:{position:"absolute",width:0,height:0,overflow:"hidden"},children:L("defs",{children:L("pattern",{id:R,width:12,height:12,patternUnits:"userSpaceOnUse",children:L("line",{x1:0,y1:0,x2:12,y2:12,strokeWidth:2,style:{stroke:ee}})})})}),L("style",{dangerouslySetInnerHTML:{__html:p}})]}),L(w,{type:"rangeBar",ref:k,series:o,options:ke(ke(ve,d),b??{}),height:y,className:pt(O,n?.container),style:f?.container,renderTooltip:T,...S})]})});import{applyDefaults as ft}from"@cleen/ui-core";import{forwardRef as mt}from"react";var Re={chart:{type:"radar",zoom:{enabled:!1},toolbar:{show:!1}},stroke:{width:2},fill:{opacity:.25},markers:{size:4,colors:"transparent",strokeColors:"transparent"},tooltip:{marker:{show:!1}},legend:{show:!1}};import{jsx as gt}from"react/jsx-runtime";var ht=mt(function({options:t,...r},n){return gt(w,{type:"radar",ref:n,options:ft(Re,t),...r})});import{applyDefaults as yt,cn as W}from"@cleen/ui-core";import{useId as xt,useMemo as X,useRef as bt,useState as Ct}from"react";import{Layer as Be,Tooltip as St,Rectangle as Ne,ResponsiveContainer as Tt,Sankey as At}from"recharts";var E={width:"100%",height:420,nodePadding:24,enableToolbar:!1,enableTooltip:!0,highlightOnHover:!0,dimOnHover:!0,dimOpacity:.2,edgeOpacity:.4,edgeGradientFill:!0,nodeWidth:20,nodeBorderWidth:0,nodeBorderColor:null,align:"justify",fontColor:"rgba(var(--cleen-neutral-800, 38, 38, 38))",tooltipBGColor:"rgba(var(--cleen-white))",tooltipBorderColor:"rgba(var(--cleen-neutral-200))"};import{Fragment as Dt,jsx as v,jsxs as z}from"react/jsx-runtime";var vt=typeof E.height=="number"?E.height:420,Pe=40,we=60,Ie=8,kt=8,Ot="cleen-min-w-[220px] cleen-max-w-[min(360px,90vw)] cleen-flex cleen-flex-col cleen-gap-2",oe="cleen-m-0 cleen-text-xs cleen-leading-[18px] cleen-whitespace-pre-line cleen-break-words",Rt="cleen-font-semibold",Nt="cleen-font-medium cleen-text-[13px] cleen-mt-1 cleen-opacity-[0.72]",Pt="cleen-font-medium cleen-text-[13px] cleen-mt-[6px]";function wt(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){let t=e.trim();if(!t.endsWith("%")&&t!=="auto"){let r=Number.parseFloat(t);if(Number.isFinite(r))return r}}return vt}function Le(e){return typeof e=="object"&&e!==null&&"id"in e&&"title"in e}function It(e){return typeof e=="object"&&e!==null&&"id"in e&&"title"in e&&"index"in e&&"name"in e}var Ee=["rgba(var(--cleen-primary, 59, 130, 246))","rgba(var(--cleen-success, 34, 197, 94))","rgba(var(--cleen-warning, 245, 158, 11))","rgba(var(--cleen-error, 239, 68, 68))","rgba(var(--cleen-purple, 147, 51, 234))","rgba(var(--cleen-cyan, 6, 182, 212))","rgba(var(--cleen-orange, 249, 115, 22))","rgba(var(--cleen-pink, 236, 72, 153))","rgba(var(--cleen-teal, 20, 184, 166))","rgba(var(--cleen-indigo, 99, 102, 241))","rgba(var(--cleen-rose, 244, 63, 94))","rgba(var(--cleen-amber, 245, 158, 11))"];function Me(e){return e!=null}function Lt(e,t){return[e.source,e.target,e.type??"",e.label??"",e.value,t].join("-").replace(/\s+/g,"_")}function V(e,t){return typeof e=="object"&&e!==null?e.id:t}function _e(e,t){return typeof e=="object"&&e!==null?e.title:t}function ne(e){return typeof e=="object"&&e!==null&&"edgeKey"in e&&"sourceId"in e&&"targetId"in e}function ae(e){return typeof e=="object"&&e!==null&&"payload"in e}function $e(e){if(ae(e))return $e(e.payload);if(ne(e)||It(e))return e}function ie(...e){return e.map(t=>typeof t=="number"?String(t):t?.trim()??"").find(t=>t.length>0)}function He(e){let t=ie(e);if(t)return/[\p{L}\p{N}]/u.test(t)?t:void 0}function De(e){return e.replace(/[^a-zA-Z0-9_-]/g,"_")}function D(e){let t=e.match(/^rgba\((var\(.+\)),\s*([0-9]*\.?[0-9]+)\)$/i);if(t)return{color:`rgb(${t[1]})`,opacity:Number.parseFloat(t[2])};let r=e.match(/^rgba\((var\(.+\))\)$/i);if(r)return{color:`rgb(${r[1]})`,opacity:1};let n=e.match(/^rgba\(\s*(\d+\s*,\s*\d+\s*,\s*\d+)\s*,\s*([0-9]*\.?[0-9]+)\s*\)$/i);return n?{color:`rgb(${n[1]})`,opacity:Number.parseFloat(n[2])}:{color:e,opacity:1}}function le(e,t){return D(t??Ee[e%Ee.length])}function Fe(e){return e.length*kt}function Et(e){let t=new Set,r=new Set([e.id]);for(let n of[...e.sourceLinks??[],...e.targetLinks??[]])t.add(n.edgeKey),r.add(V(n.source,n.sourceId)),r.add(V(n.target,n.targetId));return{activeLinkKeys:t,activeNodeIds:r}}function _t(e){return{activeLinkKeys:new Set([e.edgeKey]),activeNodeIds:new Set([V(e.source,e.sourceId),V(e.target,e.targetId)])}}function Ht(e,t,r,n,f){return!e||e.activeNodeIds.has(t)?1:n?f??E.dimOpacity??.2:r?.55:1}function Ft(e,t,r,n,f,b){return e?e.activeLinkKeys.has(t)?n?Math.max(r,.9):r:f?b??E.dimOpacity??.2:n?Math.min(r,.3):r:r}var Bt=({dimOnHover:e,dimOpacity:t,fontColor:r,x:n,y:f,width:b,height:y,highlightOnHover:x,hoverState:u,index:S,outgoingEdgesById:k,payload:o,stroke:T,strokeWidth:d})=>{if(o===void 0||n===void 0||f===void 0||b===void 0||y===void 0||S===void 0)return null;let A=k?.get(o.id)??[],O=A.length>0,R=le(S,o.color),N=D(r),p=Ht(u,o.id,x,e,t),i=new Set(A.map(m=>m.color).filter(Me)),s=Array.from(i)[0],l=O&&A.length>1&&i.size>1&&i.size===A.length,c=l?A:[],a=c.reduce((m,g)=>m+(g.value??0),0);return z(Be,{children:[l&&a>0?c.map((m,g)=>{let h=c.slice(0,g).reduce((F,B)=>F+(B.value??0),0),C=f+h/a*y,P=(m.value??0)/a*y,I=D(m.color??R.color),_=g===0,H=g===c.length-1;return v(Ne,{x:n,y:C,width:b,height:P,fill:I.color,fillOpacity:I.opacity*p,stroke:T,strokeWidth:d,radius:[_?2:0,_?2:0,H?2:0,H?2:0]},`${m.source}-${m.target}-${g}`)}):v(Ne,{x:n,y:f,width:b,height:y,fill:O&&i.size===1?D(s??R.color).color:R.color,fillOpacity:(O&&i.size===1?D(s??R.color).opacity:R.opacity)*p,stroke:T,strokeWidth:d,radius:[2,2,2,2]}),v("text",{textAnchor:O?"end":"start",x:O?n-8:n+b+8,y:f+y/2,dy:"0.35em",fontSize:"14",fill:N.color,fillOpacity:N.opacity*p,fontWeight:600,children:o.name})]},`CustomNode${S}`)},Mt=({sourceX:e,targetX:t,sourceY:r,targetY:n,sourceControlX:f,targetControlX:b,linkWidth:y,index:x,payload:u,opacity:S,chartId:k,dimOnHover:o,dimOpacity:T,edgeGradientFill:d,highlightOnHover:A,hoverState:O})=>{if(u===void 0||e===void 0||t===void 0||r===void 0||n===void 0||f===void 0||b===void 0||y===void 0)return null;let R=S??E.edgeOpacity??.4,N=Ft(O,u.edgeKey,R,A,o,T),p=u.color?D(u.color):null,i=p??le(typeof u.source=="object"?u.source.index:0,typeof u.source=="object"?u.source.color:void 0),s=p??le(typeof u.target=="object"?u.target.index:1,typeof u.target=="object"?u.target.color:void 0),l=De(`linkGradient-${k}-${u.edgeKey}-${x??u.value}`),c=d!==!1&&p===null;return z(Be,{children:[c?v("defs",{children:z("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[v("stop",{offset:"0%",stopColor:i.color,stopOpacity:i.opacity*N}),v("stop",{offset:"100%",stopColor:s.color,stopOpacity:s.opacity*N})]})}):null,v("path",{d:`
2
2
  M${e},${r}
3
- C${m},${r} ${b},${n} ${t},${n}
4
- `,stroke:c?`url(#${l})`:i.color,strokeWidth:Math.max(1,y),fill:"none",strokeOpacity:c?1:i.opacity*N,className:"cleen-transition-opacity cleen-duration-300 hover:cleen-opacity-100"})]},`CustomLink${u.edgeKey}`)};function $t({data:e,options:t,className:r,style:n,onNodeClick:m,renderTooltip:b}){let y=bt(null),[x,u]=Ct(null),S=xt(),k=De(S),o=yt(E,t),T=wt(o.height),d=o.highlightOnHover||o.dimOnHover,A=X(()=>{let a=e.nodes.map((g,h)=>({...g,index:h,name:g.title})),f=e.edges.map((g,h)=>{let C=e.nodes.findIndex(I=>I.id===g.source),P=e.nodes.findIndex(I=>I.id===g.target);return C<0||P<0?null:{...g,edgeKey:Lt(g,h),originalEdge:g,source:C,sourceId:g.source,target:P,targetId:g.target,value:g.value}}).filter(Me);return{nodes:a,links:f}},[e]),O=X(()=>{let a=new Map;for(let f of e.edges){let g=a.get(f.source)??[];g.push(f),a.set(f.source,g)}return a},[e]),R=X(()=>({backgroundColor:o.tooltipBGColor,border:`1px solid ${o.tooltipBorderColor}`,borderRadius:8,boxShadow:"0 12px 32px rgba(15, 23, 42, 0.12)",color:o.fontColor,padding:"10px 12px"}),[o.fontColor,o.tooltipBGColor,o.tooltipBorderColor]),N=X(()=>{let a=new Set(e.edges.map(C=>C.source)),f=new Set(e.edges.map(C=>C.target)),g=e.nodes.reduce((C,P)=>f.has(P.id)?C:Math.max(C,Fe(P.title)),0),h=e.nodes.reduce((C,P)=>a.has(P.id)?C:Math.max(C,Fe(P.title)),0);return{top:Pe,right:Math.max(we,h+Ie+16),bottom:Pe,left:Math.max(we,g+Ie+16)}},[e]),p=(a,f)=>{if(d){if(f==="node"&&Le(a.payload)){u(Et(a.payload));return}f==="link"&&ne(a.payload)&&u(_t(a.payload))}},i=()=>{d&&u(null)},s=()=>{if(typeof window>"u")return;let a=y.current?.querySelector("svg");if(!a)return;let f=new XMLSerializer().serializeToString(a),g=new Blob([f],{type:"image/svg+xml;charset=utf-8"}),h=URL.createObjectURL(g),C=document.createElement("a");C.href=h,C.download="sankey-chart.svg",C.click(),window.setTimeout(()=>URL.revokeObjectURL(h),0)},l=({active:a,payload:f})=>{if(!a||!f?.length)return null;let g=f[0]?.payload,h=$e(g);if(!h)return null;let C=ne(h),P=ae(g)?g.value:f[0]?.value,I=ae(g)?g.name:void 0,_=Number(h.value??P??0),H=o.valueFormatter?o.valueFormatter(Number(h.value??P??0),C?h.originalEdge:void 0):`${h.value??P??""}`,F=C?_e(h.source,h.sourceId):"",B=C?_e(h.target,h.targetId):"",Y=C?ie(h.title,h.label,h.name,h.originalEdge?.title,h.originalEdge?.label,h.originalEdge?.name,He(I),F&&B?`${F} \u2192 ${B}`:void 0):ie(h.title,He(I)),q=C?`${F} \u2192 ${B}`:"";if(b){let Ve=C?{type:"link",edge:h.originalEdge,sourceNodeId:h.sourceId,sourceNodeTitle:F,targetNodeId:h.targetId,targetNodeTitle:B,value:Number.isFinite(_)?_:0,payload:h.originalEdge}:{type:"node",node:h,value:Number.isFinite(_)?_:0,payload:h},ce=b(Ve);return ce?v(Dt,{children:ce}):null}return!Y&&!q&&!H?null:z("div",{className:W(Ot),style:R,children:[Y?v("p",{className:W(oe,Rt),style:{color:o.fontColor,overflowWrap:"anywhere"},children:Y}):null,q?v("p",{className:W(oe,Nt),style:{color:o.fontColor,overflowWrap:"anywhere"},children:q}):null,H?v("p",{className:W(oe,Pt),style:{color:o.fontColor},children:H}):null]})},c={display:"flex",flexDirection:"column",gap:o.enableToolbar?12:0,width:o.width??"100%",height:T,minHeight:T,...n};return z("div",{className:W("cleen cleen-w-full",r),ref:y,style:c,children:[o.enableToolbar?z("div",{className:"cleen-flex cleen-items-center cleen-justify-end cleen-gap-2",children:[v("button",{type:"button",onClick:()=>u(null),disabled:!x,style:{backgroundColor:"rgba(var(--cleen-white))",border:"1px solid rgba(var(--cleen-gray-200))",borderRadius:8,color:o.fontColor,cursor:x?"pointer":"not-allowed",fontSize:13,fontWeight:600,opacity:x?1:.5,padding:"6px 10px"},children:"Reset focus"}),v("button",{type:"button",onClick:s,style:{backgroundColor:"rgba(var(--cleen-white))",border:"1px solid rgba(var(--cleen-gray-200))",borderRadius:8,color:o.fontColor,cursor:"pointer",fontSize:13,fontWeight:600,padding:"6px 10px"},children:"Download SVG"})]}):null,v("div",{style:{flex:1,minHeight:0},children:v(Tt,{width:"100%",height:"100%",children:v(At,{data:A,align:o.align,margin:N,node:v(Bt,{dimOnHover:o.dimOnHover,dimOpacity:o.dimOpacity,fontColor:o.fontColor??E.fontColor??"rgba(var(--cleen-neutral-800, 38, 38, 38))",highlightOnHover:o.highlightOnHover,hoverState:x,outgoingEdgesById:O,stroke:o.nodeBorderColor??"transparent",strokeWidth:o.nodeBorderWidth}),nodePadding:o.nodePadding,nodeWidth:o.nodeWidth,link:v(Mt,{chartId:k,dimOnHover:o.dimOnHover,dimOpacity:o.dimOpacity,edgeGradientFill:o.edgeGradientFill,highlightOnHover:o.highlightOnHover,hoverState:x,opacity:o.edgeOpacity}),onClick:(a,f)=>{f==="node"&&m&&Le(a.payload)&&m(a.payload)},onMouseEnter:p,onMouseLeave:i,children:o.enableTooltip?v(St,{content:v(l,{}),cursor:!1,allowEscapeViewBox:{x:!1,y:!0},isAnimationActive:!1,wrapperStyle:{transition:"none"}}):null})})})]})}import{applyDefaults as zt,cn as Gt}from"@cleen/ui-core";import{forwardRef as Wt}from"react";var ze={chart:{type:"scatter",zoom:{enabled:!1},toolbar:{show:!1}},markers:{shape:"square",size:8,strokeWidth:0},grid:{strokeDashArray:8},legend:{show:!0,horizontalAlign:"right",position:"top",labels:{colors:"rgba(var(--cleen-gray-700))"}},yaxis:{axisBorder:{show:!0,color:"rgba(var(--cleen-gray-200))"},labels:{style:{colors:"rgba(var(--cleen-gray-700))"}}},xaxis:{axisBorder:{show:!0,color:"rgba(var(--cleen-gray-200))"},labels:{style:{colors:"rgba(var(--cleen-gray-700))"}}},title:{align:"left",floating:!0,style:{color:"rgba(var(--cleen-black))"}}},Ge={chart:{type:"scatter",zoom:{enabled:!1},toolbar:{show:!1}},stroke:{width:0},fill:{opacity:1},markers:{shape:"circle",size:14,strokeWidth:2,hover:{sizeOffset:0}},grid:{strokeDashArray:0,borderColor:"rgba(var(--cleen-gray-200))",padding:{left:0,right:12},xaxis:{lines:{show:!0}},yaxis:{lines:{show:!1}}},legend:{show:!1},xaxis:{min:0,max:210,tickAmount:4,axisBorder:{show:!1},axisTicks:{show:!1},decimalsInFloat:0,title:{text:"Estimated impact \u2192",style:{color:"rgba(var(--cleen-gray-700))",fontSize:"14px",fontWeight:400}},labels:{style:{colors:"rgba(var(--cleen-gray-700))",fontSize:"14px"},formatter(e){let t=Number(e);return Number.isNaN(t)?`${e}`:`$${Math.round(t)}k`}}},tooltip:{enabled:!0,theme:"light",x:{formatter(e){let t=Number(e);return Number.isNaN(t)?`${e}`:`$${Math.round(t)}k`}}}};import{jsx as U,jsxs as We}from"react/jsx-runtime";var Ut=Wt(function({options:t,variant:r="default",rows:n,className:m,style:b,...y},x){let S=zt(r==="matrix"?Ge:ze,t);if(r==="matrix"&&n?.length){let k=Math.min(...n.map(d=>d.y)),o=Math.max(...n.map(d=>d.y)),T=Array.isArray(S.yaxis)?{}:S.yaxis??{};return We("div",{className:Gt("cleen cleen-grid cleen-grid-cols-[156px_minmax(0,1fr)] cleen-items-stretch cleen-gap-3 cleen-w-full",m),style:b,children:[U("div",{className:"cleen-grid cleen-pt-[18px] cleen-pb-[54px]",style:{gridTemplateRows:`repeat(${n.length}, minmax(0, 1fr))`},children:n.map(d=>We("div",{className:"cleen-flex cleen-flex-col cleen-justify-center cleen-items-end cleen-gap-1 cleen-pr-2",children:[U("span",{className:"cleen-text-[18px] cleen-font-bold cleen-leading-[1.1] cleen-text-[rgba(var(--cleen-black))]",children:d.label}),d.gapsLabel?U("span",{className:"cleen-text-[14px] cleen-leading-[1.2] cleen-text-gray-700",children:d.gapsLabel}):null]},`${d.label}-${d.y}`))}),U(w,{type:"scatter",ref:x,className:"cleen-w-full cleen-h-full",options:{...S,yaxis:{...T,min:k-.5,max:o+.5,tickAmount:Math.max(o-k,1),axisBorder:{...T.axisBorder,show:!1},axisTicks:{...T.axisTicks,show:!1},labels:{...T.labels,show:!1}},annotations:{...S.annotations,yaxis:[...n.map(d=>({y:d.y,borderColor:d.lineColor||"rgba(var(--cleen-gray-200))",strokeDashArray:0})),...S.annotations?.yaxis||[]]}},...y})]})}return U(w,{type:"scatter",ref:x,className:m,style:b,options:S,...y})});import{applyDefaults as Kt}from"@cleen/ui-core";import{forwardRef as Xt,useEffect as Ke,useMemo as Xe,useRef as j,useState as Vt}from"react";var Ue={chart:{type:"treemap",zoom:{enabled:!1},toolbar:{show:!1}},legend:{show:!1},dataLabels:{enabled:!0,style:{fontSize:"12px",fontWeight:400}},plotOptions:{treemap:{enableShades:!0,distributed:!1}},title:{align:"left",style:{color:"rgba(var(--cleen-black))"}}};import{jsx as Z,jsxs as Zt}from"react/jsx-runtime";var se=(e,t)=>e.length!==t.length?!1:e.every((r,n)=>{let m=t[n];return Math.round(r.x)===Math.round(m.x)&&Math.round(r.y)===Math.round(m.y)&&Math.round(r.width)===Math.round(m.width)&&Math.round(r.height)===Math.round(m.height)}),jt=Xt(function({options:t,labelLayout:r="apex",renderTileLabel:n,className:m,style:b,...y},x){let u=j(null),[S,k]=Vt([]),o=r==="overlay"&&typeof n=="function",T=j(()=>null);T.current=()=>{let p=u.current;if(!p)return null;let i=p.getBoundingClientRect(),s=p.querySelectorAll(".apexcharts-treemap-rect");return s.length?Array.from(s).map((l,c)=>{let a=l.getBoundingClientRect();return{x:a.left-i.left,y:a.top-i.top,width:a.width,height:a.height,dataIndex:c}}):null};let d=j(0),A=j(()=>{});A.current=()=>{cancelAnimationFrame(d.current);let p=0,i=null,s=()=>{let l=T.current();if(l&&i&&se(i,l)){k(c=>se(c,l)?c:l);return}l&&(i=l),p<30?(p++,d.current=requestAnimationFrame(s)):l&&k(c=>se(c,l)?c:l)};d.current=requestAnimationFrame(s)};let O=Xe(()=>{let p=Kt(Ue,t??{});if(!o)return p;let i=p.chart?.events??{},s=l=>(...c)=>{A.current(),l?.(...c)};return{...p,dataLabels:{...p.dataLabels,enabled:!1},chart:{...p.chart,animations:{enabled:!1},events:{...i,mounted:s(i.mounted),updated:s(i.updated)}}}},[t,o]);Ke(()=>{if(o)return A.current(),()=>cancelAnimationFrame(d.current)},[o]),Ke(()=>{if(!o)return;let p=u.current;if(!p||typeof ResizeObserver>"u")return;let i=new ResizeObserver(()=>A.current());return i.observe(p),()=>i.disconnect()},[o]);let R=Xe(()=>{let p=y.series;return!Array.isArray(p)||p.length===0?[]:(p[0]??{}).data??[]},[y.series]);if(!o)return Z(w,{type:"treemap",ref:x,options:O,className:m,style:b,...y});let N={...b,position:"relative"};return Zt("div",{ref:u,className:m,style:N,children:[Z(w,{type:"treemap",ref:x,options:O,...y}),S.length>0&&Z("div",{style:{position:"absolute",inset:0,pointerEvents:"none",overflow:"hidden"},children:S.map(p=>Z("div",{style:{position:"absolute",left:p.x,top:p.y,width:p.width,height:p.height},children:n({point:R[p.dataIndex],width:p.width,height:p.height})},p.dataIndex))})]})});import"react";import{jsx as pe,jsxs as qt}from"react/jsx-runtime";var Yt=({width:e=240,height:t=80,data:r=[12,28,18,30,24,36],className:n="",style:m})=>{let b=Math.max(...r,1),y=r.map((x,u)=>`${u/(r.length-1)*e},${t-x/b*t}`).join(" ");return qt("svg",{width:e,height:t,viewBox:`0 0 ${e} ${t}`,className:n,style:m,role:"img","aria-label":"Simple line chart",children:[pe("rect",{width:"100%",height:"100%",fill:"transparent"}),pe("polyline",{fill:"none",stroke:"rgba(59,130,246,0.9)",strokeWidth:2,points:y,strokeLinecap:"round",strokeLinejoin:"round"}),pe("polygon",{points:`${y} ${e},${t} 0,${t}`,fill:"rgba(59,130,246,0.08)"})]})};export{tt as BarChart,nt as BellCurve,ue as Chart,ut as FootballFieldChart,ht as RadarChart,$t as SankeyChart,Ut as ScatterChart,Yt as SimpleChart,jt as TreemapChart};
3
+ C${f},${r} ${b},${n} ${t},${n}
4
+ `,stroke:c?`url(#${l})`:i.color,strokeWidth:Math.max(1,y),fill:"none",strokeOpacity:c?1:i.opacity*N,className:"cleen-transition-opacity cleen-duration-300 hover:cleen-opacity-100"})]},`CustomLink${u.edgeKey}`)};function $t({data:e,options:t,className:r,style:n,onNodeClick:f,renderTooltip:b}){let y=bt(null),[x,u]=Ct(null),S=xt(),k=De(S),o=yt(E,t),T=wt(o.height),d=o.highlightOnHover||o.dimOnHover,A=X(()=>{let a=e.nodes.map((g,h)=>({...g,index:h,name:g.title})),m=e.edges.map((g,h)=>{let C=e.nodes.findIndex(I=>I.id===g.source),P=e.nodes.findIndex(I=>I.id===g.target);return C<0||P<0?null:{...g,edgeKey:Lt(g,h),originalEdge:g,source:C,sourceId:g.source,target:P,targetId:g.target,value:g.value}}).filter(Me);return{nodes:a,links:m}},[e]),O=X(()=>{let a=new Map;for(let m of e.edges){let g=a.get(m.source)??[];g.push(m),a.set(m.source,g)}return a},[e]),R=X(()=>({backgroundColor:o.tooltipBGColor,border:`1px solid ${o.tooltipBorderColor}`,borderRadius:8,boxShadow:"0 12px 32px rgba(15, 23, 42, 0.12)",color:o.fontColor,padding:"10px 12px"}),[o.fontColor,o.tooltipBGColor,o.tooltipBorderColor]),N=X(()=>{let a=new Set(e.edges.map(C=>C.source)),m=new Set(e.edges.map(C=>C.target)),g=e.nodes.reduce((C,P)=>m.has(P.id)?C:Math.max(C,Fe(P.title)),0),h=e.nodes.reduce((C,P)=>a.has(P.id)?C:Math.max(C,Fe(P.title)),0);return{top:Pe,right:Math.max(we,h+Ie+16),bottom:Pe,left:Math.max(we,g+Ie+16)}},[e]),p=(a,m)=>{if(d){if(m==="node"&&Le(a.payload)){u(Et(a.payload));return}m==="link"&&ne(a.payload)&&u(_t(a.payload))}},i=()=>{d&&u(null)},s=()=>{if(typeof window>"u")return;let a=y.current?.querySelector("svg");if(!a)return;let m=new XMLSerializer().serializeToString(a),g=new Blob([m],{type:"image/svg+xml;charset=utf-8"}),h=URL.createObjectURL(g),C=document.createElement("a");C.href=h,C.download="sankey-chart.svg",C.click(),window.setTimeout(()=>URL.revokeObjectURL(h),0)},l=({active:a,payload:m})=>{if(!a||!m?.length)return null;let g=m[0]?.payload,h=$e(g);if(!h)return null;let C=ne(h),P=ae(g)?g.value:m[0]?.value,I=ae(g)?g.name:void 0,_=Number(h.value??P??0),H=o.valueFormatter?o.valueFormatter(Number(h.value??P??0),C?h.originalEdge:void 0):`${h.value??P??""}`,F=C?_e(h.source,h.sourceId):"",B=C?_e(h.target,h.targetId):"",Y=C?ie(h.title,h.label,h.name,h.originalEdge?.title,h.originalEdge?.label,h.originalEdge?.name,He(I),F&&B?`${F} \u2192 ${B}`:void 0):ie(h.title,He(I)),q=C?`${F} \u2192 ${B}`:"";if(b){let Ve=C?{type:"link",edge:h.originalEdge,sourceNodeId:h.sourceId,sourceNodeTitle:F,targetNodeId:h.targetId,targetNodeTitle:B,value:Number.isFinite(_)?_:0,payload:h.originalEdge}:{type:"node",node:h,value:Number.isFinite(_)?_:0,payload:h},ce=b(Ve);return ce?v(Dt,{children:ce}):null}return!Y&&!q&&!H?null:z("div",{className:W(Ot),style:R,children:[Y?v("p",{className:W(oe,Rt),style:{color:o.fontColor,overflowWrap:"anywhere"},children:Y}):null,q?v("p",{className:W(oe,Nt),style:{color:o.fontColor,overflowWrap:"anywhere"},children:q}):null,H?v("p",{className:W(oe,Pt),style:{color:o.fontColor},children:H}):null]})},c={display:"flex",flexDirection:"column",gap:o.enableToolbar?12:0,width:o.width??"100%",height:T,minHeight:T,...n};return z("div",{className:W("cleen cleen-w-full",r),ref:y,style:c,children:[o.enableToolbar?z("div",{className:"cleen-flex cleen-items-center cleen-justify-end cleen-gap-2",children:[v("button",{type:"button",onClick:()=>u(null),disabled:!x,style:{backgroundColor:"rgba(var(--cleen-white))",border:"1px solid rgba(var(--cleen-neutral-200))",borderRadius:8,color:o.fontColor,cursor:x?"pointer":"not-allowed",fontSize:13,fontWeight:600,opacity:x?1:.5,padding:"6px 10px"},children:"Reset focus"}),v("button",{type:"button",onClick:s,style:{backgroundColor:"rgba(var(--cleen-white))",border:"1px solid rgba(var(--cleen-neutral-200))",borderRadius:8,color:o.fontColor,cursor:"pointer",fontSize:13,fontWeight:600,padding:"6px 10px"},children:"Download SVG"})]}):null,v("div",{style:{flex:1,minHeight:0},children:v(Tt,{width:"100%",height:"100%",children:v(At,{data:A,align:o.align,margin:N,node:v(Bt,{dimOnHover:o.dimOnHover,dimOpacity:o.dimOpacity,fontColor:o.fontColor??E.fontColor??"rgba(var(--cleen-neutral-800, 38, 38, 38))",highlightOnHover:o.highlightOnHover,hoverState:x,outgoingEdgesById:O,stroke:o.nodeBorderColor??"transparent",strokeWidth:o.nodeBorderWidth}),nodePadding:o.nodePadding,nodeWidth:o.nodeWidth,link:v(Mt,{chartId:k,dimOnHover:o.dimOnHover,dimOpacity:o.dimOpacity,edgeGradientFill:o.edgeGradientFill,highlightOnHover:o.highlightOnHover,hoverState:x,opacity:o.edgeOpacity}),onClick:(a,m)=>{m==="node"&&f&&Le(a.payload)&&f(a.payload)},onMouseEnter:p,onMouseLeave:i,children:o.enableTooltip?v(St,{content:v(l,{}),cursor:!1,allowEscapeViewBox:{x:!1,y:!0},isAnimationActive:!1,wrapperStyle:{transition:"none"}}):null})})})]})}import{applyDefaults as zt,cn as Gt}from"@cleen/ui-core";import{forwardRef as Wt}from"react";var ze={chart:{type:"scatter",zoom:{enabled:!1},toolbar:{show:!1}},markers:{shape:"square",size:8,strokeWidth:0},grid:{strokeDashArray:8},legend:{show:!0,horizontalAlign:"right",position:"top",labels:{colors:"rgba(var(--cleen-neutral-700))"}},yaxis:{axisBorder:{show:!0,color:"rgba(var(--cleen-neutral-200))"},labels:{style:{colors:"rgba(var(--cleen-neutral-700))"}}},xaxis:{axisBorder:{show:!0,color:"rgba(var(--cleen-neutral-200))"},labels:{style:{colors:"rgba(var(--cleen-neutral-700))"}}},title:{align:"left",floating:!0,style:{color:"rgba(var(--cleen-foreground))"}}},Ge={chart:{type:"scatter",zoom:{enabled:!1},toolbar:{show:!1}},stroke:{width:0},fill:{opacity:1},markers:{shape:"circle",size:14,strokeWidth:2,hover:{sizeOffset:0}},grid:{strokeDashArray:0,borderColor:"rgba(var(--cleen-neutral-200))",padding:{left:0,right:12},xaxis:{lines:{show:!0}},yaxis:{lines:{show:!1}}},legend:{show:!1},xaxis:{min:0,max:210,tickAmount:4,axisBorder:{show:!1},axisTicks:{show:!1},decimalsInFloat:0,title:{text:"Estimated impact \u2192",style:{color:"rgba(var(--cleen-neutral-700))",fontSize:"14px",fontWeight:400}},labels:{style:{colors:"rgba(var(--cleen-neutral-700))",fontSize:"14px"},formatter(e){let t=Number(e);return Number.isNaN(t)?`${e}`:`$${Math.round(t)}k`}}},tooltip:{enabled:!0,theme:"light",x:{formatter(e){let t=Number(e);return Number.isNaN(t)?`${e}`:`$${Math.round(t)}k`}}}};import{jsx as U,jsxs as We}from"react/jsx-runtime";var Ut=Wt(function({options:t,variant:r="default",rows:n,className:f,style:b,...y},x){let S=zt(r==="matrix"?Ge:ze,t);if(r==="matrix"&&n?.length){let k=Math.min(...n.map(d=>d.y)),o=Math.max(...n.map(d=>d.y)),T=Array.isArray(S.yaxis)?{}:S.yaxis??{};return We("div",{className:Gt("cleen cleen-grid cleen-grid-cols-[156px_minmax(0,1fr)] cleen-items-stretch cleen-gap-3 cleen-w-full",f),style:b,children:[U("div",{className:"cleen-grid cleen-pt-[18px] cleen-pb-[54px]",style:{gridTemplateRows:`repeat(${n.length}, minmax(0, 1fr))`},children:n.map(d=>We("div",{className:"cleen-flex cleen-flex-col cleen-justify-center cleen-items-end cleen-gap-1 cleen-pr-2",children:[U("span",{className:"cleen-text-[18px] cleen-font-bold cleen-leading-[1.1] cleen-text-[rgba(var(--cleen-black))]",children:d.label}),d.gapsLabel?U("span",{className:"cleen-text-[14px] cleen-leading-[1.2] cleen-text-neutral-700",children:d.gapsLabel}):null]},`${d.label}-${d.y}`))}),U(w,{type:"scatter",ref:x,className:"cleen-w-full cleen-h-full",options:{...S,yaxis:{...T,min:k-.5,max:o+.5,tickAmount:Math.max(o-k,1),axisBorder:{...T.axisBorder,show:!1},axisTicks:{...T.axisTicks,show:!1},labels:{...T.labels,show:!1}},annotations:{...S.annotations,yaxis:[...n.map(d=>({y:d.y,borderColor:d.lineColor||"rgba(var(--cleen-neutral-200))",strokeDashArray:0})),...S.annotations?.yaxis||[]]}},...y})]})}return U(w,{type:"scatter",ref:x,className:f,style:b,options:S,...y})});import{applyDefaults as Kt}from"@cleen/ui-core";import{forwardRef as Xt,useEffect as Ke,useMemo as Xe,useRef as j,useState as Vt}from"react";var Ue={chart:{type:"treemap",zoom:{enabled:!1},toolbar:{show:!1}},legend:{show:!1},dataLabels:{enabled:!0,style:{fontSize:"12px",fontWeight:400}},plotOptions:{treemap:{enableShades:!0,distributed:!1}},title:{align:"left",style:{color:"rgba(var(--cleen-foreground))"}}};import{jsx as Z,jsxs as Zt}from"react/jsx-runtime";var se=(e,t)=>e.length!==t.length?!1:e.every((r,n)=>{let f=t[n];return Math.round(r.x)===Math.round(f.x)&&Math.round(r.y)===Math.round(f.y)&&Math.round(r.width)===Math.round(f.width)&&Math.round(r.height)===Math.round(f.height)}),jt=Xt(function({options:t,labelLayout:r="apex",renderTileLabel:n,className:f,style:b,...y},x){let u=j(null),[S,k]=Vt([]),o=r==="overlay"&&typeof n=="function",T=j(()=>null);T.current=()=>{let p=u.current;if(!p)return null;let i=p.getBoundingClientRect(),s=p.querySelectorAll(".apexcharts-treemap-rect");return s.length?Array.from(s).map((l,c)=>{let a=l.getBoundingClientRect();return{x:a.left-i.left,y:a.top-i.top,width:a.width,height:a.height,dataIndex:c}}):null};let d=j(0),A=j(()=>{});A.current=()=>{cancelAnimationFrame(d.current);let p=0,i=null,s=()=>{let l=T.current();if(l&&i&&se(i,l)){k(c=>se(c,l)?c:l);return}l&&(i=l),p<30?(p++,d.current=requestAnimationFrame(s)):l&&k(c=>se(c,l)?c:l)};d.current=requestAnimationFrame(s)};let O=Xe(()=>{let p=Kt(Ue,t??{});if(!o)return p;let i=p.chart?.events??{},s=l=>(...c)=>{A.current(),l?.(...c)};return{...p,dataLabels:{...p.dataLabels,enabled:!1},chart:{...p.chart,animations:{enabled:!1},events:{...i,mounted:s(i.mounted),updated:s(i.updated)}}}},[t,o]);Ke(()=>{if(o)return A.current(),()=>cancelAnimationFrame(d.current)},[o]),Ke(()=>{if(!o)return;let p=u.current;if(!p||typeof ResizeObserver>"u")return;let i=new ResizeObserver(()=>A.current());return i.observe(p),()=>i.disconnect()},[o]);let R=Xe(()=>{let p=y.series;return!Array.isArray(p)||p.length===0?[]:(p[0]??{}).data??[]},[y.series]);if(!o)return Z(w,{type:"treemap",ref:x,options:O,className:f,style:b,...y});let N={...b,position:"relative"};return Zt("div",{ref:u,className:f,style:N,children:[Z(w,{type:"treemap",ref:x,options:O,...y}),S.length>0&&Z("div",{style:{position:"absolute",inset:0,pointerEvents:"none",overflow:"hidden"},children:S.map(p=>Z("div",{style:{position:"absolute",left:p.x,top:p.y,width:p.width,height:p.height},children:n({point:R[p.dataIndex],width:p.width,height:p.height})},p.dataIndex))})]})});import"react";import{jsx as pe,jsxs as qt}from"react/jsx-runtime";var Yt=({width:e=240,height:t=80,data:r=[12,28,18,30,24,36],className:n="",style:f})=>{let b=Math.max(...r,1),y=r.map((x,u)=>`${u/(r.length-1)*e},${t-x/b*t}`).join(" ");return qt("svg",{width:e,height:t,viewBox:`0 0 ${e} ${t}`,className:n,style:f,role:"img","aria-label":"Simple line chart",children:[pe("rect",{width:"100%",height:"100%",fill:"transparent"}),pe("polyline",{fill:"none",stroke:"rgba(59,130,246,0.9)",strokeWidth:2,points:y,strokeLinecap:"round",strokeLinejoin:"round"}),pe("polygon",{points:`${y} ${e},${t} 0,${t}`,fill:"rgba(59,130,246,0.08)"})]})};export{tt as BarChart,nt as BellCurve,ue as Chart,ut as FootballFieldChart,ht as RadarChart,$t as SankeyChart,Ut as ScatterChart,Yt as SimpleChart,jt as TreemapChart};
package/dist/index.d.ts CHANGED
@@ -113,7 +113,7 @@ interface AdvancedProgressBarProps extends ComponentProps<'div'> {
113
113
  */
114
114
  declare const AdvancedProgressBar: react.ForwardRefExoticComponent<Omit<AdvancedProgressBarProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
115
115
 
116
- type ButtonVariant = 'borderless' | 'borderless-blue' | 'borderless-success' | 'borderless-error' | 'group' | 'secondary' | 'secondary-blue' | 'secondary-success' | 'secondary-error' | 'primary' | 'disable' | 'error' | 'success' | 'warning' | 'black' | 'purple' | 'indigo' | 'yellow';
116
+ type ButtonVariant = 'borderless' | 'borderless-blue' | 'borderless-success' | 'borderless-error' | 'secondary' | 'secondary-blue' | 'secondary-success' | 'secondary-error' | 'primary' | 'error' | 'success' | 'warning' | 'black' | 'purple' | 'indigo' | 'yellow';
117
117
 
118
118
  type ButtonProps = ComponentProps<'button'> & {
119
119
  variant?: ButtonVariant;