@synertech/ui 0.45.0 → 0.45.1
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/.claude/skills/use-synertech-ui/SKILL.md +1 -1
- package/dist/components/area-chart/AreaChart.cjs +1 -1
- package/dist/components/area-chart/AreaChart.js +1 -1
- package/dist/components/bar-chart/BarChart.cjs +1 -1
- package/dist/components/bar-chart/BarChart.js +1 -1
- package/dist/components/box-plot/BoxPlot.cjs +1 -1
- package/dist/components/box-plot/BoxPlot.js +1 -1
- package/dist/components/bullet-chart/BulletChart.cjs +1 -1
- package/dist/components/bullet-chart/BulletChart.js +1 -1
- package/dist/components/candlestick-chart/CandlestickChart.cjs +1 -1
- package/dist/components/candlestick-chart/CandlestickChart.js +1 -1
- package/dist/components/chart/ChartSync.cjs +1 -1
- package/dist/components/chart/ChartSync.js +1 -1
- package/dist/components/chart/utils/cartesian.cjs +1 -1
- package/dist/components/chart/utils/cartesian.js +1 -1
- package/dist/components/chart/utils/path.cjs +1 -1
- package/dist/components/chart/utils/path.js +1 -1
- package/dist/components/chart/utils/time.cjs +1 -1
- package/dist/components/chart/utils/time.js +1 -1
- package/dist/components/chart/utils/timestamp.cjs +1 -0
- package/dist/components/chart/utils/timestamp.js +1 -0
- package/dist/components/chart/utils/touch.cjs +1 -0
- package/dist/components/chart/utils/touch.js +1 -0
- package/dist/components/dumbbell-chart/DumbbellChart.cjs +1 -1
- package/dist/components/dumbbell-chart/DumbbellChart.js +1 -1
- package/dist/components/funnel-chart/FunnelChart.cjs +1 -1
- package/dist/components/funnel-chart/FunnelChart.js +1 -1
- package/dist/components/gantt-chart/GanttChart.cjs +1 -1
- package/dist/components/gantt-chart/GanttChart.js +1 -1
- package/dist/components/heat-map/Heatmap.cjs +1 -1
- package/dist/components/heat-map/Heatmap.js +1 -1
- package/dist/components/line-chart/LineChart.cjs +1 -1
- package/dist/components/line-chart/LineChart.js +1 -1
- package/dist/components/pie-chart/PieChart.cjs +1 -1
- package/dist/components/pie-chart/PieChart.js +1 -1
- package/dist/components/scatter-chart/ScatterChart.cjs +1 -1
- package/dist/components/scatter-chart/ScatterChart.js +1 -1
- package/dist/components/waterfall-chart/WaterfallChart.cjs +1 -1
- package/dist/components/waterfall-chart/WaterfallChart.js +1 -1
- package/dist/index.d.cts +16 -3
- package/dist/index.d.ts +16 -3
- package/dist/styles.css +27 -0
- package/package.json +13 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var Z=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var pe=Object.prototype.hasOwnProperty;var be=(l,o)=>{for(var r in o)Z(l,r,{get:o[r],enumerable:!0})},xe=(l,o,r,v)=>{if(o&&typeof o=="object"||typeof o=="function")for(let m of ye(o))!pe.call(l,m)&&m!==r&&Z(l,m,{get:()=>o[m],enumerable:!(v=ge(o,m))||v.enumerable});return l};var Ce=l=>xe(Z({},"__esModule",{value:!0}),l);var Re={};be(Re,{ScatterChart:()=>Ve,resetScatterWarnings:()=>Le});module.exports=Ce(Re);var g=require("react"),ee=require("../chart/ChartAxis.cjs"),ae=require("../chart/ChartContainer.cjs"),se=require("../chart/ChartGrid.cjs"),le=require("../chart/ChartLegend.cjs"),ce=require("../chart/ChartTableView.cjs"),U=require("../chart/ChartTooltip.cjs"),C=require("../chart/palette.cjs"),E=require("../chart/utils/cartesian.cjs"),M=require("../chart/utils/data.cjs"),q=require("../chart/utils/decimate.cjs"),te=require("../chart/utils/format.cjs"),ue=require("../chart/utils/scales.cjs"),re=require("../chart/utils/ticks.cjs"),me=require("../chart/utils/timestamp.cjs"),de=require("../chart/utils/touch.cjs"),n=require("react/jsx-runtime"),ve=4.5,Se=48,ne=!1,ke=(0,g.memo)(function({points:o}){return(0,n.jsx)("g",{children:o.map(r=>(0,n.jsx)("circle",{cx:r.cx,cy:r.cy,r:r.r,fill:r.color,fillOpacity:.85,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},`${r.seriesKey}-${r.index}`))})});function Pe({width:l,height:o,data:r,resolvedSeries:v,x:m,y:X,grid:V,size:N,bubble:y,trendLine:O,quadrants:$,pointRadius:H,overlay:I,maxPoints:R,margin:G,tooltip:T,onPointClick:z,plotLabel:F,formatValue:S,formatX:w}){let[t,B]=(0,g.useState)(null),e=(0,g.useMemo)(()=>{let a=v.filter(c=>!c.hidden),K=a.map(c=>c.key),s=(0,E.buildCartesianGeometry)({width:l,height:o,data:r,x:{...m,scale:m.scale==="time"?"time":"linear"},y:X,bounds:(0,re.extent)((0,M.collectAllValues)(r,K)),margin:G,formatValue:S,formatX:w}),k=y?(0,M.collectAllValues)(r,[y.key]):[],A=y?(0,re.extent)(k):null,[x,L]=y?.range??[4,14],W=c=>{if(!y||!A)return H;let d=(0,M.readNumber)(c,y.key);if(d===null)return x;let[p,b]=A,P=b===p?1:(d-p)/(b-p);return Math.sqrt(x*x+P*(L*L-x*x))},_=[],f=[];a.forEach(c=>{let d=[];r.forEach((p,b)=>{let P=(0,M.readNumber)(p,c.key),i=s.categoryPositions[b];P===null||!Number.isFinite(i)||d.push({seriesKey:c.key,seriesLabel:(0,C.getSeriesLabel)(c),color:c.color,index:b,cx:i,cy:s.valueScale(P),r:W(p),xValue:s.toCategoryNumber(s.xValues[b]),yValue:P})}),R||(0,q.warnPointBudget)("ScatterChart",d.length),f.push(...d),_.push(...R&&R>0?(0,q.sampleEvenly)(d,R):d)});let D=null;if(O&&f.length>1){let c=f.length,d=f.reduce((h,u)=>h+u.xValue,0),p=f.reduce((h,u)=>h+u.yValue,0),b=f.reduce((h,u)=>h+u.xValue*u.yValue,0),P=f.reduce((h,u)=>h+u.xValue*u.xValue,0),i=c*P-d*d;if(i!==0){let h=(c*b-d*p)/i,u=(p-h*d)/c,ie=f.map(Q=>Q.xValue),[he,fe]=[Math.min(...ie),Math.max(...ie)],oe=f.map(Q=>Q.cx);D={x1:Math.min(...oe),y1:s.valueScale(h*he+u),x2:Math.max(...oe),y2:s.valueScale(h*fe+u)}}}return{visible:a,points:_,plot:(0,E.createPlotContext)({geometry:s,width:l,height:o,data:r,series:a,formatValue:S,formatX:w}),trend:D,xTicks:s.categoryTicks,yTicks:s.valueTicks,valueScale:s.valueScale,positions:s.categoryPositions,innerWidth:s.innerWidth,innerHeight:s.innerHeight,margin:s.margin,xValues:s.xValues}},[r,v,m,X,l,o,G,y,O,H,R,S,w]),j=(0,g.useCallback)(a=>{if(T===!1||e.points.length===0)return;let K=a.currentTarget.getBoundingClientRect(),s=a.clientX-K.left-e.margin.left,k=a.clientY-K.top-e.margin.top,A=null,x=Se;for(let L of e.points){let W=Math.hypot(L.cx-s,L.cy-k);W<x&&(x=W,A=L)}B(A)},[T,e.points,e.margin]),J=(0,g.useCallback)(()=>{if(!z||!t)return;let a=r[t.index];a&&z({seriesKey:t.seriesKey,seriesLabel:t.seriesLabel,color:t.color,value:t.yValue,formattedValue:S(t.yValue),datum:a,index:t.index,x:e.xValues[t.index]})},[z,t,S,r,e.xValues]),Y=(0,E.splitOverlay)(I);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("svg",{width:l,height:o,role:"img","aria-label":F??e.visible.map(a=>(0,C.getSeriesLabel)(a)).join(", "),tabIndex:0,className:`${de.CHART_TOUCH} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500`,onPointerMove:j,onPointerLeave:()=>B(null),onBlur:()=>B(null),onClick:J,children:[(0,n.jsxs)("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[(0,n.jsx)(se.ChartGrid,{width:e.innerWidth,height:e.innerHeight,horizontal:V==="y"||V==="both"?e.yTicks.map(a=>a.offset):void 0,vertical:V==="x"||V==="both"?e.xTicks.map(a=>a.offset):void 0}),$?.y!==void 0?(0,n.jsx)("line",{x1:0,y1:e.valueScale($.y),x2:e.innerWidth,y2:e.valueScale($.y),stroke:"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:"4 4"}):null,Y.under?.(e.plot),e.trend?(0,n.jsx)("line",{x1:e.trend.x1,y1:e.trend.y1,x2:e.trend.x2,y2:e.trend.y2,stroke:"var(--color-chart-muted)",strokeWidth:1.5,strokeDasharray:"4 4"}):null,(0,n.jsx)(ke,{points:e.points}),Y.over?.(e.plot),t?(0,n.jsx)("circle",{cx:t.cx,cy:t.cy,r:t.r+3,fill:"none",stroke:t.color,strokeWidth:2,"aria-hidden":"true"}):null]}),(0,n.jsx)("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:m.hidden?null:(0,n.jsx)(ee.ChartAxis,{orientation:"bottom",ticks:e.xTicks,length:e.innerWidth,label:m.label,size:N})}),(0,n.jsx)("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:X?.hidden?null:(0,n.jsx)(ee.ChartAxis,{orientation:"left",ticks:e.yTicks,length:e.innerHeight,showLine:!1,label:X?.label,size:N})})]}),t&&r[t.index]&&T!==!1?(0,n.jsx)(U.ChartTooltip,{x:e.margin.left+t.cx,y:e.margin.top+t.cy,containerWidth:l,children:typeof T=="function"?T({x:e.xValues[t.index],xLabel:w(e.xValues[t.index],t.index),index:t.index,points:[{seriesKey:t.seriesKey,seriesLabel:t.seriesLabel,color:t.color,value:t.yValue,formattedValue:S(t.yValue),datum:r[t.index]}]}):(0,n.jsx)(U.ChartTooltipContent,{title:`${m.label??m.key} ${w(e.xValues[t.index],t.index)}`,points:[{seriesKey:t.seriesKey,seriesLabel:t.seriesLabel,color:t.color,value:t.yValue,formattedValue:S(t.yValue),datum:r[t.index]}]})}):null]})}function Ve({data:l,series:o,x:r,y:v,height:m=280,width:X,size:V="md",grid:N="both",legend:y,tooltip:O=!0,tableView:$=!1,emphasis:H,title:I,description:R,loading:G=!1,emptyState:T,error:z=!1,errorState:F,onRetry:S,actions:w,onPointClick:t,bubble:B,trendLine:e=!1,quadrants:j,pointRadius:J=ve,overlay:Y,legendToggle:a=!0,maxPoints:K,margin:s,locale:k,plotLabel:A,className:x,...L}){let[W,_]=(0,g.useState)(()=>new Set);o.length>C.CHART_ALL_PAIRS_LIMIT&&!ne&&(ne=!0,console.warn(`[@synertech/ui] A ScatterChart was given ${o.length} series. Any two marks can sit side by side here, and only the first ${C.CHART_ALL_PAIRS_LIMIT} palette slots stay tellable apart under that test: facet the chart instead.`));let f=(0,g.useMemo)(()=>o.map((i,h)=>({...i,hidden:i.hidden||W.has(i.key),color:(0,C.resolveSeriesColor)(i,h,H)})),[o,W,H]),D=(0,g.useMemo)(()=>v?.format??(i=>(0,te.formatAuto)(i,k)),[v?.format,k]),c=(0,g.useMemo)(()=>r.format??(i=>r.scale==="time"?(0,me.formatTimeValue)(i,k):(0,te.formatAuto)((0,ue.toNumber)(i),k)),[r.format,r.scale,k]),d=(0,g.useCallback)(i=>{_(h=>{let u=new Set(h);return u.has(i)?u.delete(i):u.add(i),u})},[]),p=y===void 0?o.length>=2:y!==!1,b=typeof y=="string"?y:"bottom",P=f.filter(i=>!i.hidden).length;return(0,n.jsx)(ae.ChartContainer,{title:I,description:R,height:m,width:X,size:V,loading:G,empty:l.length===0||P===0,emptyState:T,error:z,errorState:F,onRetry:S,actions:w,tableView:$,legendPosition:b,legend:p?(0,n.jsx)(le.ChartLegend,{items:(0,C.toLegendItems)(f,H),position:b,marker:"dot",size:V,onToggle:a?d:void 0}):void 0,table:$?(0,n.jsx)(ce.ChartTableView,{data:l,series:f,xKey:r.key,xLabel:r.label??r.key,formatX:c,formatValue:D,caption:typeof I=="string"?I:void 0}):void 0,className:x,...L,children:({width:i})=>(0,n.jsx)(Pe,{width:i,height:m,data:l,resolvedSeries:f,x:r,y:v,grid:N,size:V,bubble:B,trendLine:e,quadrants:j,pointRadius:J,overlay:Y,maxPoints:K,margin:s,tooltip:O,onPointClick:t,plotLabel:A,formatValue:D,formatX:c})})}function Le(){ne=!1}0&&(module.exports={ScatterChart,resetScatterWarnings});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{memo as
|
|
1
|
+
"use client";import{memo as ce,useCallback as F,useMemo as O,useState as ae}from"react";import{ChartAxis as Z}from"../chart/ChartAxis.js";import{ChartContainer as ue}from"../chart/ChartContainer.js";import{ChartGrid as me}from"../chart/ChartGrid.js";import{ChartLegend as de}from"../chart/ChartLegend.js";import{ChartTableView as he}from"../chart/ChartTableView.js";import{ChartTooltip as fe,ChartTooltipContent as ge}from"../chart/ChartTooltip.js";import{CHART_ALL_PAIRS_LIMIT as ee,getSeriesLabel as te,resolveSeriesColor as ye,toLegendItems as pe}from"../chart/palette.js";import{buildCartesianGeometry as be,createPlotContext as xe,splitOverlay as Ce}from"../chart/utils/cartesian.js";import{collectAllValues as re,readNumber as ne}from"../chart/utils/data.js";import{sampleEvenly as ve,warnPointBudget as Se}from"../chart/utils/decimate.js";import{formatAuto as ie}from"../chart/utils/format.js";import{toNumber as ke}from"../chart/utils/scales.js";import{extent as oe}from"../chart/utils/ticks.js";import{formatTimeValue as Pe}from"../chart/utils/timestamp.js";import{CHART_TOUCH as Ve}from"../chart/utils/touch.js";import{Fragment as Ae,jsx as l,jsxs as q}from"react/jsx-runtime";var Le=4.5,Re=48,j=!1,Te=ce(function({points:d}){return l("g",{children:d.map(r=>l("circle",{cx:r.cx,cy:r.cy,r:r.r,fill:r.color,fillOpacity:.85,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},`${r.seriesKey}-${r.index}`))})});function we({width:y,height:d,data:r,resolvedSeries:w,x:p,y:A,grid:S,size:I,bubble:h,trendLine:z,quadrants:W,pointRadius:X,overlay:H,maxPoints:P,margin:B,tooltip:V,onPointClick:K,plotLabel:G,formatValue:x,formatX:L}){let[t,M]=ae(null),e=O(()=>{let i=w.filter(a=>!a.hidden),$=i.map(a=>a.key),o=be({width:y,height:d,data:r,x:{...p,scale:p.scale==="time"?"time":"linear"},y:A,bounds:oe(re(r,$)),margin:B,formatValue:x,formatX:L}),C=h?re(r,[h.key]):[],R=h?oe(C):null,[b,k]=h?.range??[4,14],T=a=>{if(!h||!R)return X;let c=ne(a,h.key);if(c===null)return b;let[f,g]=R,v=g===f?1:(c-f)/(g-f);return Math.sqrt(b*b+v*(k*k-b*b))},N=[],m=[];i.forEach(a=>{let c=[];r.forEach((f,g)=>{let v=ne(f,a.key),n=o.categoryPositions[g];v===null||!Number.isFinite(n)||c.push({seriesKey:a.key,seriesLabel:te(a),color:a.color,index:g,cx:n,cy:o.valueScale(v),r:T(f),xValue:o.toCategoryNumber(o.xValues[g]),yValue:v})}),P||Se("ScatterChart",c.length),m.push(...c),N.push(...P&&P>0?ve(c,P):c)});let E=null;if(z&&m.length>1){let a=m.length,c=m.reduce((u,s)=>u+s.xValue,0),f=m.reduce((u,s)=>u+s.yValue,0),g=m.reduce((u,s)=>u+s.xValue*s.yValue,0),v=m.reduce((u,s)=>u+s.xValue*s.xValue,0),n=a*v-c*c;if(n!==0){let u=(a*g-c*f)/n,s=(f-u*c)/a,J=m.map(U=>U.xValue),[se,le]=[Math.min(...J),Math.max(...J)],Q=m.map(U=>U.cx);E={x1:Math.min(...Q),y1:o.valueScale(u*se+s),x2:Math.max(...Q),y2:o.valueScale(u*le+s)}}}return{visible:i,points:N,plot:xe({geometry:o,width:y,height:d,data:r,series:i,formatValue:x,formatX:L}),trend:E,xTicks:o.categoryTicks,yTicks:o.valueTicks,valueScale:o.valueScale,positions:o.categoryPositions,innerWidth:o.innerWidth,innerHeight:o.innerHeight,margin:o.margin,xValues:o.xValues}},[r,w,p,A,y,d,B,h,z,X,P,x,L]),Y=F(i=>{if(V===!1||e.points.length===0)return;let $=i.currentTarget.getBoundingClientRect(),o=i.clientX-$.left-e.margin.left,C=i.clientY-$.top-e.margin.top,R=null,b=Re;for(let k of e.points){let T=Math.hypot(k.cx-o,k.cy-C);T<b&&(b=T,R=k)}M(R)},[V,e.points,e.margin]),_=F(()=>{if(!K||!t)return;let i=r[t.index];i&&K({seriesKey:t.seriesKey,seriesLabel:t.seriesLabel,color:t.color,value:t.yValue,formattedValue:x(t.yValue),datum:i,index:t.index,x:e.xValues[t.index]})},[K,t,x,r,e.xValues]),D=Ce(H);return q(Ae,{children:[q("svg",{width:y,height:d,role:"img","aria-label":G??e.visible.map(i=>te(i)).join(", "),tabIndex:0,className:`${Ve} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500`,onPointerMove:Y,onPointerLeave:()=>M(null),onBlur:()=>M(null),onClick:_,children:[q("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[l(me,{width:e.innerWidth,height:e.innerHeight,horizontal:S==="y"||S==="both"?e.yTicks.map(i=>i.offset):void 0,vertical:S==="x"||S==="both"?e.xTicks.map(i=>i.offset):void 0}),W?.y!==void 0?l("line",{x1:0,y1:e.valueScale(W.y),x2:e.innerWidth,y2:e.valueScale(W.y),stroke:"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:"4 4"}):null,D.under?.(e.plot),e.trend?l("line",{x1:e.trend.x1,y1:e.trend.y1,x2:e.trend.x2,y2:e.trend.y2,stroke:"var(--color-chart-muted)",strokeWidth:1.5,strokeDasharray:"4 4"}):null,l(Te,{points:e.points}),D.over?.(e.plot),t?l("circle",{cx:t.cx,cy:t.cy,r:t.r+3,fill:"none",stroke:t.color,strokeWidth:2,"aria-hidden":"true"}):null]}),l("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:p.hidden?null:l(Z,{orientation:"bottom",ticks:e.xTicks,length:e.innerWidth,label:p.label,size:I})}),l("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:A?.hidden?null:l(Z,{orientation:"left",ticks:e.yTicks,length:e.innerHeight,showLine:!1,label:A?.label,size:I})})]}),t&&r[t.index]&&V!==!1?l(fe,{x:e.margin.left+t.cx,y:e.margin.top+t.cy,containerWidth:y,children:typeof V=="function"?V({x:e.xValues[t.index],xLabel:L(e.xValues[t.index],t.index),index:t.index,points:[{seriesKey:t.seriesKey,seriesLabel:t.seriesLabel,color:t.color,value:t.yValue,formattedValue:x(t.yValue),datum:r[t.index]}]}):l(ge,{title:`${p.label??p.key} ${L(e.xValues[t.index],t.index)}`,points:[{seriesKey:t.seriesKey,seriesLabel:t.seriesLabel,color:t.color,value:t.yValue,formattedValue:x(t.yValue),datum:r[t.index]}]})}):null]})}function Ue({data:y,series:d,x:r,y:w,height:p=280,width:A,size:S="md",grid:I="both",legend:h,tooltip:z=!0,tableView:W=!1,emphasis:X,title:H,description:P,loading:B=!1,emptyState:V,error:K=!1,errorState:G,onRetry:x,actions:L,onPointClick:t,bubble:M,trendLine:e=!1,quadrants:Y,pointRadius:_=Le,overlay:D,legendToggle:i=!0,maxPoints:$,margin:o,locale:C,plotLabel:R,className:b,...k}){let[T,N]=ae(()=>new Set);d.length>ee&&!j&&(j=!0,console.warn(`[@synertech/ui] A ScatterChart was given ${d.length} series. Any two marks can sit side by side here, and only the first ${ee} palette slots stay tellable apart under that test: facet the chart instead.`));let m=O(()=>d.map((n,u)=>({...n,hidden:n.hidden||T.has(n.key),color:ye(n,u,X)})),[d,T,X]),E=O(()=>w?.format??(n=>ie(n,C)),[w?.format,C]),a=O(()=>r.format??(n=>r.scale==="time"?Pe(n,C):ie(ke(n),C)),[r.format,r.scale,C]),c=F(n=>{N(u=>{let s=new Set(u);return s.has(n)?s.delete(n):s.add(n),s})},[]),f=h===void 0?d.length>=2:h!==!1,g=typeof h=="string"?h:"bottom",v=m.filter(n=>!n.hidden).length;return l(ue,{title:H,description:P,height:p,width:A,size:S,loading:B,empty:y.length===0||v===0,emptyState:V,error:K,errorState:G,onRetry:x,actions:L,tableView:W,legendPosition:g,legend:f?l(de,{items:pe(m,X),position:g,marker:"dot",size:S,onToggle:i?c:void 0}):void 0,table:W?l(he,{data:y,series:m,xKey:r.key,xLabel:r.label??r.key,formatX:a,formatValue:E,caption:typeof H=="string"?H:void 0}):void 0,className:b,...k,children:({width:n})=>l(we,{width:n,height:p,data:y,resolvedSeries:m,x:r,y:w,grid:I,size:S,bubble:M,trendLine:e,quadrants:Y,pointRadius:_,overlay:D,maxPoints:$,margin:o,tooltip:z,onPointClick:t,plotLabel:R,formatValue:E,formatX:a})})}function qe(){j=!1}export{Ue as ScatterChart,qe as resetScatterWarnings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var se=Object.defineProperty;var
|
|
1
|
+
"use strict";"use client";var se=Object.defineProperty;var xe=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames;var Se=Object.prototype.hasOwnProperty;var Ee=(c,a)=>{for(var l in a)se(c,l,{get:a[l],enumerable:!0})},Le=(c,a,l,r)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of Re(a))!Se.call(c,d)&&d!==l&&se(c,d,{get:()=>a[d],enumerable:!(r=xe(a,d))||r.enumerable});return c};var We=c=>Le(se({},"__esModule",{value:!0}),c);var Ie={};Ee(Ie,{WaterfallChart:()=>Me});module.exports=We(Ie);var u=require("react"),me=require("../../lib/i18n.cjs"),ce=require("../chart/ChartAxis.cjs"),ue=require("../chart/ChartContainer.cjs"),ge=require("../chart/ChartGrid.cjs"),fe=require("../chart/ChartLegend.cjs"),he=require("../chart/ChartTableView.cjs"),ye=require("../chart/ChartTooltip.cjs"),V=require("../chart/palette.cjs"),be=require("../chart/utils/cartesian.cjs"),ae=require("../chart/utils/data.cjs"),re=require("../chart/utils/format.cjs"),Ce=require("../chart/utils/path.cjs"),pe=require("../chart/utils/scales.cjs"),ke=require("../chart/utils/text.cjs"),ve=require("../chart/utils/touch.cjs"),t=require("react/jsx-runtime"),Pe=24,we=4,H=6,Ve=(0,V.rampColor)(V.CHART_DIVERGING_COLORS,1),Ae=(0,V.rampColor)(V.CHART_DIVERGING_COLORS,0),Te=(0,u.memo)(function({bars:a,connectors:l}){return(0,t.jsxs)("g",{children:[(0,t.jsx)("g",{className:"stroke-gray-300 dark:stroke-gray-600",strokeWidth:1,shapeRendering:"crispEdges","aria-hidden":"true",children:l.map(r=>(0,t.jsx)("line",{x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2},r.key))}),a.map(r=>(0,t.jsxs)("g",{children:[(0,t.jsx)("path",{d:r.d,fill:r.color}),r.label?(0,t.jsx)("text",{x:r.label.x,y:r.label.y,textAnchor:r.label.anchor,dominantBaseline:"middle",className:"fill-gray-600 text-[10px] [font-variant-numeric:tabular-nums] dark:fill-gray-300",children:r.label.text}):null]},r.key))]})});function Ne({width:c,height:a,steps:l,data:r,x:d,y:R,grid:M,size:q,orientation:O,connectors:F,showValues:A,barSize:K,palette:$,margin:I,tooltip:T,plotLabel:B,totalLabel:ne,formatValue:G,formatX:_,onStepClick:z}){let[U,D]=(0,u.useState)(null),g=U!==null&&U<l.length?U:null,e=(0,u.useMemo)(()=>{let n=O==="vertical",C=l.flatMap(o=>[o.start,o.end]),h=(0,be.buildCartesianGeometry)({width:c,height:a,data:r,x:d,y:R,bounds:C.length===0?null:[Math.min(...C),Math.max(...C)],margin:I,orientation:O,placement:"band",formatValue:G,formatX:_,defaultIncludeZero:!0}),{valueScale:p,bandwidth:v,categoryPositions:L,innerWidth:J,innerHeight:Q}=h,W=p(0),m=Math.min(K??Pe,v),P=[],S=[];return l.forEach((o,k)=>{let w=L[k]+(v-m)/2,ee=p(o.start),te=p(o.end),Z=Math.min(ee,te),i=Math.abs(te-ee),f=o.end>=o.start,N=n?f?"top":"bottom":f?"right":"left",X=n?{x:w,y:Z,width:m,height:i}:{x:Z,y:w,width:i,height:m},y=null;if(A&&o.value!==null){let x=o.kind==="total"?o.formattedEnd:o.formattedValue,E=(0,ke.estimateTextWidth)(x,10),b=p(f?Math.max(o.start,o.end):Math.min(o.start,o.end));if(n){let j=f?b-H:b+H;E<=v&&j>8&&j<Q-4&&(y={x:w+m/2,y:j,anchor:"middle",text:x})}else{let j=f?J-b-H:b-H;E<=j&&(y={x:f?b+H:b-H,y:w+m/2,anchor:f?"start":"end",text:x})}}P.push({key:`${k}`,color:$[o.kind],d:(0,Ce.buildBarPath)({...X,radius:we,round:N}),label:y});let de=l[k+1];if(F&&de){let x=p(o.end),E=L[k+1]+(v-m)/2;S.push(n?{key:`${k}`,x1:w+m,y1:x,x2:E,y2:x}:{key:`${k}`,x1:x,y1:w+m,x2:x,y2:E})}}),{vertical:n,bars:P,rules:S,baseline:W,bandwidth:v,categoryPositions:L,categoryCenters:h.categoryCenters,categoryTicks:h.categoryTicks,valueTicks:h.valueTicks,valueScale:p,innerWidth:J,innerHeight:Q,margin:h.margin}},[l,r,d,R,c,a,I,O,F,A,K,$,G,_]),le=(0,u.useCallback)(n=>{if(T===!1||l.length===0)return;let C=n.currentTarget.getBoundingClientRect(),h=e.vertical?n.clientX-C.left-e.margin.left:n.clientY-C.top-e.margin.top;D((0,pe.nearestIndex)(e.categoryCenters,h))},[T,l.length,e.vertical,e.margin,e.categoryCenters]),oe=(0,u.useCallback)(n=>{if(l.length===0)return;let C=l.length-1,h=g??0,p=e.vertical?"ArrowRight":"ArrowDown",v=e.vertical?"ArrowLeft":"ArrowUp",L=n.key===p?Math.min(C,h+1):n.key===v?Math.max(0,h-1):n.key==="Home"?0:n.key==="End"?C:n.key==="Escape"?null:void 0;L!==void 0&&(n.preventDefault(),D(L))},[l.length,g,e.vertical]),ie=(0,u.useCallback)(()=>{!z||g===null||z(l[g])},[z,g,l]),s=g===null?null:l[g],Y=g===null||s===void 0||s===null?null:e.vertical?{x:e.margin.left+e.categoryCenters[g],y:e.margin.top+Math.min(e.valueScale(s.start),e.valueScale(s.end))}:{x:e.margin.left+Math.max(e.valueScale(s.start),e.valueScale(s.end)),y:e.margin.top+e.categoryCenters[g]};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("svg",{width:c,height:a,role:"img","aria-label":B??l.map(n=>n.label).join(", "),tabIndex:0,className:`${ve.CHART_TOUCH} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500`,onPointerMove:le,onPointerLeave:()=>D(null),onKeyDown:oe,onBlur:()=>D(null),onClick:ie,children:[(0,t.jsxs)("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[(0,t.jsx)(ge.ChartGrid,{width:e.innerWidth,height:e.innerHeight,horizontal:e.vertical&&(M==="y"||M==="both")?e.valueTicks.map(n=>n.offset):void 0,vertical:!e.vertical&&(M==="y"||M==="both")?e.valueTicks.map(n=>n.offset):void 0}),g!==null?(0,t.jsx)("rect",{x:e.vertical?e.categoryPositions[g]:0,y:e.vertical?0:e.categoryPositions[g],width:e.vertical?e.bandwidth:e.innerWidth,height:e.vertical?e.innerHeight:e.bandwidth,className:"fill-gray-400 dark:fill-gray-500",opacity:.12,"aria-hidden":"true"}):null,(0,t.jsx)(Te,{bars:e.bars,connectors:e.rules}),(0,t.jsx)("line",{x1:e.vertical?0:e.baseline,y1:e.vertical?e.baseline:0,x2:e.vertical?e.innerWidth:e.baseline,y2:e.vertical?e.baseline:e.innerHeight,className:"stroke-gray-300 dark:stroke-gray-600",strokeWidth:1,shapeRendering:"crispEdges"})]}),(0,t.jsx)("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:(e.vertical?d.hidden:R?.hidden)?null:(0,t.jsx)(ce.ChartAxis,{orientation:"bottom",ticks:e.vertical?e.categoryTicks:e.valueTicks,length:e.innerWidth,label:e.vertical?d.label:R?.label,size:q})}),(0,t.jsx)("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:(e.vertical?R?.hidden:d.hidden)?null:(0,t.jsx)(ce.ChartAxis,{orientation:"left",ticks:e.vertical?e.valueTicks:e.categoryTicks,length:e.innerHeight,showLine:!1,label:e.vertical?R?.label:d.label,size:q})})]}),s&&Y&&T!==!1?(0,t.jsx)(ye.ChartTooltip,{x:Y.x,y:Y.y,containerWidth:c,children:typeof T=="function"?T(s):(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("div",{className:"font-medium text-gray-900 dark:text-gray-100",children:s.label}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"h-2.5 w-2.5 shrink-0 rounded-sm",style:{backgroundColor:$[s.kind]},"aria-hidden":"true"}),(0,t.jsx)("span",{className:"font-semibold text-gray-900 [font-variant-numeric:tabular-nums] dark:text-gray-100",children:s.kind==="total"?s.formattedEnd:s.formattedValue})]}),s.kind==="total"?null:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[(0,t.jsx)("span",{children:ne}),(0,t.jsx)("span",{className:"[font-variant-numeric:tabular-nums]",children:s.formattedEnd})]})]})}):null]})}function Me({data:c,x:a,y:l,value:r,total:d,start:R=0,orientation:M="vertical",connectors:q=!0,showValues:O=!0,barSize:F,colors:A,height:K=280,width:$,size:I="md",grid:T="y",legend:B,tooltip:ne=!0,tableView:G=!1,title:_,description:z,loading:U=!1,emptyState:D,error:g=!1,errorState:e,onRetry:le,actions:oe,margin:ie,locale:s,plotLabel:Y,valueLabel:n,totalLabel:C,increaseLabel:h,decreaseLabel:p,format:v,onStepClick:L,className:J,...Q}){let W=(0,me.useUILabels)(),m=(0,u.useMemo)(()=>v??(i=>(0,re.formatAuto)(i,s)),[v,s]),P=(0,u.useMemo)(()=>a.format??(i=>(0,re.formatXValue)(i,s)),[a.format,s]),S=(0,u.useMemo)(()=>{let i=R;return c.map((f,N)=>{let X=(0,ae.readXValue)(f,a.key,N),y=(0,ae.readNumber)(f,r);if(d?!!f[d]:!1){let b=y??i;return i=b,{index:N,x:X,label:P(X,N),value:b,start:0,end:b,kind:"total",formattedValue:m(b),formattedEnd:m(b),datum:f}}let x=i,E=y===null?i:i+y;return i=E,{index:N,x:X,label:P(X,N),value:y,start:x,end:E,kind:y!==null&&y<0?"decrease":"increase",formattedValue:y===null?"\u2014":`${y>0?"+":""}${m(y)}`,formattedEnd:m(E),datum:f}})},[c,a.key,r,d,R,m,P]),o=(0,u.useMemo)(()=>({increase:A?.increase??Ve,decrease:A?.decrease??Ae,total:A?.total??V.CHART_MUTED_COLOR}),[A]),k=C??W.chartRunningTotal,w=(0,u.useMemo)(()=>{let i=[{key:"increase",label:h??W.chartIncrease,color:o.increase,marker:"rect"},{key:"decrease",label:p??W.chartDecrease,color:o.decrease,marker:"rect"}];return S.some(f=>f.kind==="total")&&i.push({key:"total",label:k,color:o.total,marker:"rect"}),i},[o,S,h,p,k,W.chartIncrease,W.chartDecrease]),ee=(0,u.useMemo)(()=>S.map(i=>({[a.key]:i.x,[r]:i.kind==="total"?null:i.value,__running:i.end})),[S,a.key,r]),te=B===void 0?!0:B!==!1,Z=typeof B=="string"?B:"bottom";return(0,t.jsx)(ue.ChartContainer,{title:_,description:z,height:K,width:$,size:I,loading:U,empty:S.length===0,emptyState:D,error:g,errorState:e,onRetry:le,actions:oe,tableView:G,legendPosition:Z,legend:te?(0,t.jsx)(fe.ChartLegend,{items:w,position:Z,marker:"rect",size:I}):void 0,table:G?(0,t.jsx)(he.ChartTableView,{data:ee,series:[{key:r,label:n??W.chartValue},{key:"__running",label:k}],xKey:a.key,xLabel:a.label??a.key,formatX:P,formatValue:m,caption:typeof _=="string"?_:void 0}):void 0,className:J,...Q,children:({width:i})=>(0,t.jsx)(Ne,{width:i,height:K,steps:S,data:c,x:a,y:l,grid:T,size:I,orientation:M,connectors:q,showValues:O,barSize:F,palette:o,margin:ie,tooltip:ne,plotLabel:Y,totalLabel:k,formatValue:m,formatX:P,onStepClick:L})})}0&&(module.exports={WaterfallChart});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{memo as
|
|
1
|
+
"use client";import{memo as me,useCallback as oe,useMemo as N,useState as ue}from"react";import{useUILabels as ge}from"../../lib/i18n.js";import{ChartAxis as se}from"../chart/ChartAxis.js";import{ChartContainer as fe}from"../chart/ChartContainer.js";import{ChartGrid as he}from"../chart/ChartGrid.js";import{ChartLegend as ye}from"../chart/ChartLegend.js";import{ChartTableView as be}from"../chart/ChartTableView.js";import{ChartTooltip as Ce}from"../chart/ChartTooltip.js";import{CHART_DIVERGING_COLORS as ce,CHART_MUTED_COLOR as pe,rampColor as de}from"../chart/palette.js";import{buildCartesianGeometry as ke}from"../chart/utils/cartesian.js";import{readNumber as ve,readXValue as xe}from"../chart/utils/data.js";import{formatAuto as Re,formatXValue as Se}from"../chart/utils/format.js";import{buildBarPath as Ee}from"../chart/utils/path.js";import{nearestIndex as Le}from"../chart/utils/scales.js";import{estimateTextWidth as We}from"../chart/utils/text.js";import{CHART_TOUCH as Pe}from"../chart/utils/touch.js";import{Fragment as Ie,jsx as l,jsxs as w}from"react/jsx-runtime";var we=24,Ve=4,H=6,Ae=de(ce,1),Te=de(ce,0),Ne=me(function({bars:s,connectors:i}){return w("g",{children:[l("g",{className:"stroke-gray-300 dark:stroke-gray-600",strokeWidth:1,shapeRendering:"crispEdges","aria-hidden":"true",children:i.map(a=>l("line",{x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2},a.key))}),s.map(a=>w("g",{children:[l("path",{d:a.d,fill:a.color}),a.label?l("text",{x:a.label.x,y:a.label.y,textAnchor:a.label.anchor,dominantBaseline:"middle",className:"fill-gray-600 text-[10px] [font-variant-numeric:tabular-nums] dark:fill-gray-300",children:a.label.text}):null]},a.key))]})});function Me({width:v,height:s,steps:i,data:a,x:C,y:x,grid:M,size:q,orientation:O,connectors:F,showValues:V,barSize:K,palette:$,margin:I,tooltip:A,plotLabel:B,totalLabel:ae,formatValue:G,formatX:_,onStepClick:z}){let[U,D]=ue(null),d=U!==null&&U<i.length?U:null,e=N(()=>{let t=O==="vertical",h=i.flatMap(r=>[r.start,r.end]),u=ke({width:v,height:s,data:a,x:C,y:x,bounds:h.length===0?null:[Math.min(...h),Math.max(...h)],margin:I,orientation:O,placement:"band",formatValue:G,formatX:_,defaultIncludeZero:!0}),{valueScale:y,bandwidth:p,categoryPositions:E,innerWidth:J,innerHeight:Q}=u,L=y(0),c=Math.min(K??we,p),W=[],R=[];return i.forEach((r,b)=>{let P=E[b]+(p-c)/2,ee=y(r.start),te=y(r.end),Z=Math.min(ee,te),n=Math.abs(te-ee),m=r.end>=r.start,T=t?m?"top":"bottom":m?"right":"left",X=t?{x:P,y:Z,width:c,height:n}:{x:Z,y:P,width:n,height:c},g=null;if(V&&r.value!==null){let k=r.kind==="total"?r.formattedEnd:r.formattedValue,S=We(k,10),f=y(m?Math.max(r.start,r.end):Math.min(r.start,r.end));if(t){let j=m?f-H:f+H;S<=p&&j>8&&j<Q-4&&(g={x:P+c/2,y:j,anchor:"middle",text:k})}else{let j=m?J-f-H:f-H;S<=j&&(g={x:m?f+H:f-H,y:P+c/2,anchor:m?"start":"end",text:k})}}W.push({key:`${b}`,color:$[r.kind],d:Ee({...X,radius:Ve,round:T}),label:g});let ie=i[b+1];if(F&&ie){let k=y(r.end),S=E[b+1]+(p-c)/2;R.push(t?{key:`${b}`,x1:P+c,y1:k,x2:S,y2:k}:{key:`${b}`,x1:k,y1:P+c,x2:k,y2:S})}}),{vertical:t,bars:W,rules:R,baseline:L,bandwidth:p,categoryPositions:E,categoryCenters:u.categoryCenters,categoryTicks:u.categoryTicks,valueTicks:u.valueTicks,valueScale:y,innerWidth:J,innerHeight:Q,margin:u.margin}},[i,a,C,x,v,s,I,O,F,V,K,$,G,_]),re=oe(t=>{if(A===!1||i.length===0)return;let h=t.currentTarget.getBoundingClientRect(),u=e.vertical?t.clientX-h.left-e.margin.left:t.clientY-h.top-e.margin.top;D(Le(e.categoryCenters,u))},[A,i.length,e.vertical,e.margin,e.categoryCenters]),ne=oe(t=>{if(i.length===0)return;let h=i.length-1,u=d??0,y=e.vertical?"ArrowRight":"ArrowDown",p=e.vertical?"ArrowLeft":"ArrowUp",E=t.key===y?Math.min(h,u+1):t.key===p?Math.max(0,u-1):t.key==="Home"?0:t.key==="End"?h:t.key==="Escape"?null:void 0;E!==void 0&&(t.preventDefault(),D(E))},[i.length,d,e.vertical]),le=oe(()=>{!z||d===null||z(i[d])},[z,d,i]),o=d===null?null:i[d],Y=d===null||o===void 0||o===null?null:e.vertical?{x:e.margin.left+e.categoryCenters[d],y:e.margin.top+Math.min(e.valueScale(o.start),e.valueScale(o.end))}:{x:e.margin.left+Math.max(e.valueScale(o.start),e.valueScale(o.end)),y:e.margin.top+e.categoryCenters[d]};return w(Ie,{children:[w("svg",{width:v,height:s,role:"img","aria-label":B??i.map(t=>t.label).join(", "),tabIndex:0,className:`${Pe} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500`,onPointerMove:re,onPointerLeave:()=>D(null),onKeyDown:ne,onBlur:()=>D(null),onClick:le,children:[w("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[l(he,{width:e.innerWidth,height:e.innerHeight,horizontal:e.vertical&&(M==="y"||M==="both")?e.valueTicks.map(t=>t.offset):void 0,vertical:!e.vertical&&(M==="y"||M==="both")?e.valueTicks.map(t=>t.offset):void 0}),d!==null?l("rect",{x:e.vertical?e.categoryPositions[d]:0,y:e.vertical?0:e.categoryPositions[d],width:e.vertical?e.bandwidth:e.innerWidth,height:e.vertical?e.innerHeight:e.bandwidth,className:"fill-gray-400 dark:fill-gray-500",opacity:.12,"aria-hidden":"true"}):null,l(Ne,{bars:e.bars,connectors:e.rules}),l("line",{x1:e.vertical?0:e.baseline,y1:e.vertical?e.baseline:0,x2:e.vertical?e.innerWidth:e.baseline,y2:e.vertical?e.baseline:e.innerHeight,className:"stroke-gray-300 dark:stroke-gray-600",strokeWidth:1,shapeRendering:"crispEdges"})]}),l("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:(e.vertical?C.hidden:x?.hidden)?null:l(se,{orientation:"bottom",ticks:e.vertical?e.categoryTicks:e.valueTicks,length:e.innerWidth,label:e.vertical?C.label:x?.label,size:q})}),l("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:(e.vertical?x?.hidden:C.hidden)?null:l(se,{orientation:"left",ticks:e.vertical?e.valueTicks:e.categoryTicks,length:e.innerHeight,showLine:!1,label:e.vertical?x?.label:C.label,size:q})})]}),o&&Y&&A!==!1?l(Ce,{x:Y.x,y:Y.y,containerWidth:v,children:typeof A=="function"?A(o):w("div",{className:"flex flex-col gap-1",children:[l("div",{className:"font-medium text-gray-900 dark:text-gray-100",children:o.label}),w("div",{className:"flex items-center gap-2",children:[l("span",{className:"h-2.5 w-2.5 shrink-0 rounded-sm",style:{backgroundColor:$[o.kind]},"aria-hidden":"true"}),l("span",{className:"font-semibold text-gray-900 [font-variant-numeric:tabular-nums] dark:text-gray-100",children:o.kind==="total"?o.formattedEnd:o.formattedValue})]}),o.kind==="total"?null:w("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[l("span",{children:ae}),l("span",{className:"[font-variant-numeric:tabular-nums]",children:o.formattedEnd})]})]})}):null]})}function Je({data:v,x:s,y:i,value:a,total:C,start:x=0,orientation:M="vertical",connectors:q=!0,showValues:O=!0,barSize:F,colors:V,height:K=280,width:$,size:I="md",grid:A="y",legend:B,tooltip:ae=!0,tableView:G=!1,title:_,description:z,loading:U=!1,emptyState:D,error:d=!1,errorState:e,onRetry:re,actions:ne,margin:le,locale:o,plotLabel:Y,valueLabel:t,totalLabel:h,increaseLabel:u,decreaseLabel:y,format:p,onStepClick:E,className:J,...Q}){let L=ge(),c=N(()=>p??(n=>Re(n,o)),[p,o]),W=N(()=>s.format??(n=>Se(n,o)),[s.format,o]),R=N(()=>{let n=x;return v.map((m,T)=>{let X=xe(m,s.key,T),g=ve(m,a);if(C?!!m[C]:!1){let f=g??n;return n=f,{index:T,x:X,label:W(X,T),value:f,start:0,end:f,kind:"total",formattedValue:c(f),formattedEnd:c(f),datum:m}}let k=n,S=g===null?n:n+g;return n=S,{index:T,x:X,label:W(X,T),value:g,start:k,end:S,kind:g!==null&&g<0?"decrease":"increase",formattedValue:g===null?"\u2014":`${g>0?"+":""}${c(g)}`,formattedEnd:c(S),datum:m}})},[v,s.key,a,C,x,c,W]),r=N(()=>({increase:V?.increase??Ae,decrease:V?.decrease??Te,total:V?.total??pe}),[V]),b=h??L.chartRunningTotal,P=N(()=>{let n=[{key:"increase",label:u??L.chartIncrease,color:r.increase,marker:"rect"},{key:"decrease",label:y??L.chartDecrease,color:r.decrease,marker:"rect"}];return R.some(m=>m.kind==="total")&&n.push({key:"total",label:b,color:r.total,marker:"rect"}),n},[r,R,u,y,b,L.chartIncrease,L.chartDecrease]),ee=N(()=>R.map(n=>({[s.key]:n.x,[a]:n.kind==="total"?null:n.value,__running:n.end})),[R,s.key,a]),te=B===void 0?!0:B!==!1,Z=typeof B=="string"?B:"bottom";return l(fe,{title:_,description:z,height:K,width:$,size:I,loading:U,empty:R.length===0,emptyState:D,error:d,errorState:e,onRetry:re,actions:ne,tableView:G,legendPosition:Z,legend:te?l(ye,{items:P,position:Z,marker:"rect",size:I}):void 0,table:G?l(be,{data:ee,series:[{key:a,label:t??L.chartValue},{key:"__running",label:b}],xKey:s.key,xLabel:s.label??s.key,formatX:W,formatValue:c,caption:typeof _=="string"?_:void 0}):void 0,className:J,...Q,children:({width:n})=>l(Me,{width:n,height:K,steps:R,data:v,x:s,y:i,grid:A,size:I,orientation:M,connectors:q,showValues:O,barSize:F,palette:r,margin:le,tooltip:ae,plotLabel:Y,totalLabel:b,formatValue:c,formatX:W,onStepClick:E})})}export{Je as WaterfallChart};
|
package/dist/index.d.cts
CHANGED
|
@@ -637,6 +637,12 @@ interface CartesianGeometry {
|
|
|
637
637
|
* never carry — an annotation on the 14th of a weekly series.
|
|
638
638
|
*/
|
|
639
639
|
categoryScale: LinearScale | null;
|
|
640
|
+
/**
|
|
641
|
+
* Reads an x value as the number `categoryScale` places: a timestamp on a
|
|
642
|
+
* time axis, ISO strings included, and the value itself on a linear one.
|
|
643
|
+
* `NaN` when the value cannot be placed.
|
|
644
|
+
*/
|
|
645
|
+
toCategoryNumber: (value: ChartXValue) => number;
|
|
640
646
|
}
|
|
641
647
|
/**
|
|
642
648
|
* Everything a cartesian chart needs to place a mark, computed once.
|
|
@@ -662,7 +668,7 @@ declare function buildCartesianGeometry({ width, height, data, x, y, bounds, mar
|
|
|
662
668
|
* drawn without a clip path, and an out-of-window date would otherwise land in
|
|
663
669
|
* the axis gutter.
|
|
664
670
|
*/
|
|
665
|
-
declare function createCategoryLocator(geometry: Pick<CartesianGeometry, "categoryScale" | "xValues" | "categoryCenters" | "categoryLength">): (value: ChartXValue) => number | null;
|
|
671
|
+
declare function createCategoryLocator(geometry: Pick<CartesianGeometry, "categoryScale" | "xValues" | "categoryCenters" | "categoryLength" | "toCategoryNumber">): (value: ChartXValue) => number | null;
|
|
666
672
|
/**
|
|
667
673
|
* The resolved geometry of a plot, in the shape an application can draw with.
|
|
668
674
|
*
|
|
@@ -2468,6 +2474,15 @@ interface UseChartSizeResult<T extends HTMLElement> {
|
|
|
2468
2474
|
*/
|
|
2469
2475
|
declare function useChartSize<T extends HTMLElement = HTMLDivElement>(options?: UseChartSizeOptions): UseChartSizeResult<T>;
|
|
2470
2476
|
|
|
2477
|
+
/**
|
|
2478
|
+
* Turns a date, a timestamp or a parsable string into a timestamp.
|
|
2479
|
+
*
|
|
2480
|
+
* A string without a time — `2026-03-02`, `2026-03`, `2026` — is read as
|
|
2481
|
+
* midnight local time, like one with a time and no offset: the day the
|
|
2482
|
+
* string names is the day the reader sees, whatever their time zone.
|
|
2483
|
+
*/
|
|
2484
|
+
declare function toTimestamp(value: unknown): number | null;
|
|
2485
|
+
|
|
2471
2486
|
/**
|
|
2472
2487
|
* Ticks for an axis carrying dates.
|
|
2473
2488
|
*
|
|
@@ -2505,8 +2520,6 @@ declare function niceTimeTicks(min: number, max: number, count?: number): TimeTi
|
|
|
2505
2520
|
* reader has to filter out on every label.
|
|
2506
2521
|
*/
|
|
2507
2522
|
declare function formatTimeTick(value: number, unit: TimeUnit, locale?: string): string;
|
|
2508
|
-
/** Turns a date, a timestamp or a parsable string into a timestamp. */
|
|
2509
|
-
declare function toTimestamp(value: unknown): number | null;
|
|
2510
2523
|
|
|
2511
2524
|
/** Resets the series warning. Test helper. */
|
|
2512
2525
|
declare function resetDumbbellWarnings(): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -637,6 +637,12 @@ interface CartesianGeometry {
|
|
|
637
637
|
* never carry — an annotation on the 14th of a weekly series.
|
|
638
638
|
*/
|
|
639
639
|
categoryScale: LinearScale | null;
|
|
640
|
+
/**
|
|
641
|
+
* Reads an x value as the number `categoryScale` places: a timestamp on a
|
|
642
|
+
* time axis, ISO strings included, and the value itself on a linear one.
|
|
643
|
+
* `NaN` when the value cannot be placed.
|
|
644
|
+
*/
|
|
645
|
+
toCategoryNumber: (value: ChartXValue) => number;
|
|
640
646
|
}
|
|
641
647
|
/**
|
|
642
648
|
* Everything a cartesian chart needs to place a mark, computed once.
|
|
@@ -662,7 +668,7 @@ declare function buildCartesianGeometry({ width, height, data, x, y, bounds, mar
|
|
|
662
668
|
* drawn without a clip path, and an out-of-window date would otherwise land in
|
|
663
669
|
* the axis gutter.
|
|
664
670
|
*/
|
|
665
|
-
declare function createCategoryLocator(geometry: Pick<CartesianGeometry, "categoryScale" | "xValues" | "categoryCenters" | "categoryLength">): (value: ChartXValue) => number | null;
|
|
671
|
+
declare function createCategoryLocator(geometry: Pick<CartesianGeometry, "categoryScale" | "xValues" | "categoryCenters" | "categoryLength" | "toCategoryNumber">): (value: ChartXValue) => number | null;
|
|
666
672
|
/**
|
|
667
673
|
* The resolved geometry of a plot, in the shape an application can draw with.
|
|
668
674
|
*
|
|
@@ -2468,6 +2474,15 @@ interface UseChartSizeResult<T extends HTMLElement> {
|
|
|
2468
2474
|
*/
|
|
2469
2475
|
declare function useChartSize<T extends HTMLElement = HTMLDivElement>(options?: UseChartSizeOptions): UseChartSizeResult<T>;
|
|
2470
2476
|
|
|
2477
|
+
/**
|
|
2478
|
+
* Turns a date, a timestamp or a parsable string into a timestamp.
|
|
2479
|
+
*
|
|
2480
|
+
* A string without a time — `2026-03-02`, `2026-03`, `2026` — is read as
|
|
2481
|
+
* midnight local time, like one with a time and no offset: the day the
|
|
2482
|
+
* string names is the day the reader sees, whatever their time zone.
|
|
2483
|
+
*/
|
|
2484
|
+
declare function toTimestamp(value: unknown): number | null;
|
|
2485
|
+
|
|
2471
2486
|
/**
|
|
2472
2487
|
* Ticks for an axis carrying dates.
|
|
2473
2488
|
*
|
|
@@ -2505,8 +2520,6 @@ declare function niceTimeTicks(min: number, max: number, count?: number): TimeTi
|
|
|
2505
2520
|
* reader has to filter out on every label.
|
|
2506
2521
|
*/
|
|
2507
2522
|
declare function formatTimeTick(value: number, unit: TimeUnit, locale?: string): string;
|
|
2508
|
-
/** Turns a date, a timestamp or a parsable string into a timestamp. */
|
|
2509
|
-
declare function toTimestamp(value: unknown): number | null;
|
|
2510
2523
|
|
|
2511
2524
|
/** Resets the series warning. Test helper. */
|
|
2512
2525
|
declare function resetDumbbellWarnings(): void;
|
package/dist/styles.css
CHANGED
|
@@ -1352,6 +1352,18 @@
|
|
|
1352
1352
|
.cursor-text {
|
|
1353
1353
|
cursor: text;
|
|
1354
1354
|
}
|
|
1355
|
+
.touch-pan-x {
|
|
1356
|
+
--tw-pan-x: pan-x;
|
|
1357
|
+
touch-action: var(--tw-pan-x,) var(--tw-pan-y,) var(--tw-pinch-zoom,);
|
|
1358
|
+
}
|
|
1359
|
+
.touch-pan-y {
|
|
1360
|
+
--tw-pan-y: pan-y;
|
|
1361
|
+
touch-action: var(--tw-pan-x,) var(--tw-pan-y,) var(--tw-pinch-zoom,);
|
|
1362
|
+
}
|
|
1363
|
+
.touch-pinch-zoom {
|
|
1364
|
+
--tw-pinch-zoom: pinch-zoom;
|
|
1365
|
+
touch-action: var(--tw-pan-x,) var(--tw-pan-y,) var(--tw-pinch-zoom,);
|
|
1366
|
+
}
|
|
1355
1367
|
.touch-none {
|
|
1356
1368
|
touch-action: none;
|
|
1357
1369
|
}
|
|
@@ -6925,6 +6937,18 @@
|
|
|
6925
6937
|
syntax: "*";
|
|
6926
6938
|
inherits: false;
|
|
6927
6939
|
}
|
|
6940
|
+
@property --tw-pan-x {
|
|
6941
|
+
syntax: "*";
|
|
6942
|
+
inherits: false;
|
|
6943
|
+
}
|
|
6944
|
+
@property --tw-pan-y {
|
|
6945
|
+
syntax: "*";
|
|
6946
|
+
inherits: false;
|
|
6947
|
+
}
|
|
6948
|
+
@property --tw-pinch-zoom {
|
|
6949
|
+
syntax: "*";
|
|
6950
|
+
inherits: false;
|
|
6951
|
+
}
|
|
6928
6952
|
@property --tw-space-y-reverse {
|
|
6929
6953
|
syntax: "*";
|
|
6930
6954
|
inherits: false;
|
|
@@ -7220,6 +7244,9 @@
|
|
|
7220
7244
|
--tw-rotate-z: initial;
|
|
7221
7245
|
--tw-skew-x: initial;
|
|
7222
7246
|
--tw-skew-y: initial;
|
|
7247
|
+
--tw-pan-x: initial;
|
|
7248
|
+
--tw-pan-y: initial;
|
|
7249
|
+
--tw-pinch-zoom: initial;
|
|
7223
7250
|
--tw-space-y-reverse: 0;
|
|
7224
7251
|
--tw-space-x-reverse: 0;
|
|
7225
7252
|
--tw-divide-x-reverse: 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synertech/ui",
|
|
3
|
-
"version": "0.45.
|
|
3
|
+
"version": "0.45.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Synertech UI component library",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -84,11 +84,11 @@
|
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
|
-
"@changesets/cli": "^2.
|
|
88
|
-
"@eslint/js": "^9.39.
|
|
87
|
+
"@changesets/cli": "^2.31.1",
|
|
88
|
+
"@eslint/js": "^9.39.5",
|
|
89
89
|
"@mdxeditor/editor": "^3.52.3",
|
|
90
|
-
"@storybook/addon-docs": "^10.
|
|
91
|
-
"@storybook/react-vite": "^10.
|
|
90
|
+
"@storybook/addon-docs": "^10.6.7",
|
|
91
|
+
"@storybook/react-vite": "^10.6.7",
|
|
92
92
|
"@tailwindcss/postcss": "^4.1.18",
|
|
93
93
|
"@tailwindcss/vite": "^4.1.18",
|
|
94
94
|
"@testing-library/jest-dom": "^6.9.1",
|
|
@@ -97,25 +97,25 @@
|
|
|
97
97
|
"@types/react": "^19.2.8",
|
|
98
98
|
"@types/react-dom": "^19.2.3",
|
|
99
99
|
"@vitejs/plugin-react": "^5.1.2",
|
|
100
|
-
"@vitest/coverage-v8": "^4.1.
|
|
100
|
+
"@vitest/coverage-v8": "^4.1.12",
|
|
101
101
|
"autoprefixer": "^10.4.23",
|
|
102
|
-
"eslint": "^9.39.
|
|
103
|
-
"eslint-plugin-storybook": "^10.
|
|
102
|
+
"eslint": "^9.39.5",
|
|
103
|
+
"eslint-plugin-storybook": "^10.6.7",
|
|
104
104
|
"jsdom": "^27.4.0",
|
|
105
|
-
"postcss": "^8.5.
|
|
105
|
+
"postcss": "^8.5.33",
|
|
106
106
|
"prettier": "^3.7.4",
|
|
107
107
|
"react": "^19.2.3",
|
|
108
108
|
"react-dom": "^19.2.3",
|
|
109
|
-
"storybook": "^10.
|
|
109
|
+
"storybook": "^10.6.7",
|
|
110
110
|
"tailwindcss": "^4.1.18",
|
|
111
111
|
"tsup": "^8.5.1",
|
|
112
112
|
"typescript": "^5.9.3",
|
|
113
113
|
"typescript-eslint": "^8.52.0",
|
|
114
|
-
"vite": "^6.4.
|
|
115
|
-
"vitest": "^4.1.
|
|
114
|
+
"vite": "^6.4.6",
|
|
115
|
+
"vitest": "^4.1.12"
|
|
116
116
|
},
|
|
117
117
|
"dependencies": {
|
|
118
|
-
"dompurify": "^3.4.
|
|
118
|
+
"dompurify": "^3.4.18",
|
|
119
119
|
"react-markdown": "^10.1.0",
|
|
120
120
|
"remark-gfm": "^4.0.1"
|
|
121
121
|
}
|