@synertech/ui 0.51.0 → 0.52.0

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.
Files changed (147) hide show
  1. package/.claude/skills/use-synertech-ui/SKILL.md +183 -147
  2. package/README.md +27 -19
  3. package/dist/components/advance-detachable/AdvanceDetachable.cjs +1 -1
  4. package/dist/components/advance-detachable/AdvanceDetachable.js +1 -1
  5. package/dist/components/area-chart/AreaChart.cjs +1 -1
  6. package/dist/components/area-chart/AreaChart.js +1 -1
  7. package/dist/components/avatar/Avatar.cjs +1 -1
  8. package/dist/components/avatar/Avatar.js +1 -1
  9. package/dist/components/avatar/AvatarImage.cjs +1 -0
  10. package/dist/components/avatar/AvatarImage.js +1 -0
  11. package/dist/components/banner/Banner.cjs +1 -1
  12. package/dist/components/banner/Banner.js +1 -1
  13. package/dist/components/bar-chart/BarChart.cjs +1 -1
  14. package/dist/components/bar-chart/BarChart.js +1 -1
  15. package/dist/components/box-plot/BoxPlot.cjs +1 -1
  16. package/dist/components/box-plot/BoxPlot.js +1 -1
  17. package/dist/components/breadcrumb/Breadcrumb.cjs +1 -1
  18. package/dist/components/breadcrumb/Breadcrumb.js +1 -1
  19. package/dist/components/bullet-chart/BulletChart.cjs +1 -1
  20. package/dist/components/bullet-chart/BulletChart.js +1 -1
  21. package/dist/components/calendar/Calendar.cjs +1 -1
  22. package/dist/components/calendar/Calendar.js +1 -1
  23. package/dist/components/candlestick-chart/CandlestickChart.cjs +1 -1
  24. package/dist/components/candlestick-chart/CandlestickChart.js +1 -1
  25. package/dist/components/card/Card.cjs +1 -1
  26. package/dist/components/card/Card.js +1 -1
  27. package/dist/components/chart/ChartAnnotations.cjs +1 -1
  28. package/dist/components/chart/ChartAnnotations.js +1 -1
  29. package/dist/components/chart/ChartBrush.cjs +1 -1
  30. package/dist/components/chart/ChartBrush.js +1 -1
  31. package/dist/components/chart/ChartContainer.cjs +1 -1
  32. package/dist/components/chart/ChartContainer.js +1 -1
  33. package/dist/components/chart/ChartExportButton.cjs +1 -1
  34. package/dist/components/chart/ChartExportButton.js +1 -1
  35. package/dist/components/chart/ChartPatterns.cjs +1 -1
  36. package/dist/components/chart/ChartPatterns.js +1 -1
  37. package/dist/components/chart/ChartPlotClip.cjs +1 -0
  38. package/dist/components/chart/ChartPlotClip.js +1 -0
  39. package/dist/components/chart/ChartSync.cjs +1 -1
  40. package/dist/components/chart/ChartSync.js +1 -1
  41. package/dist/components/chart/ChartTableView.cjs +1 -1
  42. package/dist/components/chart/ChartTableView.js +1 -1
  43. package/dist/components/chart/exportSource.cjs +1 -0
  44. package/dist/components/chart/exportSource.js +1 -0
  45. package/dist/components/chart/palette.cjs +1 -1
  46. package/dist/components/chart/palette.js +1 -1
  47. package/dist/components/chart/useChartSize.cjs +1 -1
  48. package/dist/components/chart/useChartSize.js +1 -1
  49. package/dist/components/chart/utils/bins.cjs +1 -1
  50. package/dist/components/chart/utils/bins.js +1 -1
  51. package/dist/components/chart/utils/cartesian.cjs +1 -1
  52. package/dist/components/chart/utils/cartesian.js +1 -1
  53. package/dist/components/chart/utils/export.cjs +7 -1
  54. package/dist/components/chart/utils/export.js +7 -1
  55. package/dist/components/chart/utils/format.cjs +1 -1
  56. package/dist/components/chart/utils/format.js +1 -1
  57. package/dist/components/chart/utils/keyboard.cjs +1 -1
  58. package/dist/components/chart/utils/keyboard.js +1 -1
  59. package/dist/components/chart/utils/period.cjs +1 -1
  60. package/dist/components/chart/utils/period.js +1 -1
  61. package/dist/components/chart/utils/regression.cjs +1 -0
  62. package/dist/components/chart/utils/regression.js +1 -0
  63. package/dist/components/chart/utils/stack.cjs +1 -1
  64. package/dist/components/chart/utils/stack.js +1 -1
  65. package/dist/components/chart/utils/ticks.cjs +1 -1
  66. package/dist/components/chart/utils/ticks.js +1 -1
  67. package/dist/components/checkbox/Checkbox.cjs +1 -1
  68. package/dist/components/checkbox/Checkbox.js +1 -1
  69. package/dist/components/circular-progress/CircularProgress.cjs +1 -1
  70. package/dist/components/circular-progress/CircularProgress.js +1 -1
  71. package/dist/components/datagrid/DataGrid.cjs +1 -1
  72. package/dist/components/datagrid/DataGrid.js +1 -1
  73. package/dist/components/detachable/Detachable.cjs +1 -1
  74. package/dist/components/detachable/Detachable.js +1 -1
  75. package/dist/components/detachable/popup-window.cjs +1 -0
  76. package/dist/components/detachable/popup-window.js +1 -0
  77. package/dist/components/device-mockup/DeviceMockup.cjs +1 -1
  78. package/dist/components/device-mockup/DeviceMockup.js +1 -1
  79. package/dist/components/divider/Divider.cjs +1 -1
  80. package/dist/components/divider/Divider.js +1 -1
  81. package/dist/components/dumbbell-chart/DumbbellChart.cjs +1 -1
  82. package/dist/components/dumbbell-chart/DumbbellChart.js +1 -1
  83. package/dist/components/file-selector/FileSelector.cjs +1 -1
  84. package/dist/components/file-selector/FileSelector.js +1 -1
  85. package/dist/components/footer/FooterBottom.cjs +1 -1
  86. package/dist/components/footer/FooterBottom.js +1 -1
  87. package/dist/components/form/input/Input.cjs +1 -1
  88. package/dist/components/form/input/Input.js +1 -1
  89. package/dist/components/form/mention-input/MentionInput.cjs +5 -4
  90. package/dist/components/form/mention-input/MentionInput.js +5 -4
  91. package/dist/components/form/number-input/NumberInput.cjs +1 -1
  92. package/dist/components/form/number-input/NumberInput.js +1 -1
  93. package/dist/components/form/shared/InputWrapper.cjs +1 -1
  94. package/dist/components/form/shared/InputWrapper.js +1 -1
  95. package/dist/components/funnel-chart/FunnelChart.cjs +1 -1
  96. package/dist/components/funnel-chart/FunnelChart.js +1 -1
  97. package/dist/components/gantt-chart/GanttChart.cjs +1 -1
  98. package/dist/components/gantt-chart/GanttChart.js +1 -1
  99. package/dist/components/heat-map/Heatmap.cjs +1 -1
  100. package/dist/components/heat-map/Heatmap.js +1 -1
  101. package/dist/components/image-uploader/ImageUploader.cjs +1 -1
  102. package/dist/components/image-uploader/ImageUploader.js +1 -1
  103. package/dist/components/line-chart/LineChart.cjs +1 -1
  104. package/dist/components/line-chart/LineChart.js +1 -1
  105. package/dist/components/pagination/Pagination.cjs +1 -1
  106. package/dist/components/pagination/Pagination.js +1 -1
  107. package/dist/components/pie-chart/PieChart.cjs +1 -1
  108. package/dist/components/pie-chart/PieChart.js +1 -1
  109. package/dist/components/progress-bar/ProgressBar.cjs +1 -1
  110. package/dist/components/progress-bar/ProgressBar.js +1 -1
  111. package/dist/components/radio-button/RadioButton.cjs +1 -1
  112. package/dist/components/radio-button/RadioButton.js +1 -1
  113. package/dist/components/scatter-chart/ScatterChart.cjs +1 -1
  114. package/dist/components/scatter-chart/ScatterChart.js +1 -1
  115. package/dist/components/scatter-chart/index.cjs +1 -1
  116. package/dist/components/scatter-chart/index.js +1 -1
  117. package/dist/components/schema-editor/SchemaEditor.cjs +1 -1
  118. package/dist/components/schema-editor/SchemaEditor.js +1 -1
  119. package/dist/components/schema-editor/canvas/GridLayer.cjs +1 -1
  120. package/dist/components/schema-editor/canvas/GridLayer.js +1 -1
  121. package/dist/components/schema-editor/relations/SchemaRelationRenderer.cjs +1 -1
  122. package/dist/components/schema-editor/relations/SchemaRelationRenderer.js +1 -1
  123. package/dist/components/schema-editor/utils/sql-export.cjs +4 -4
  124. package/dist/components/schema-editor/utils/sql-export.js +7 -7
  125. package/dist/components/slider/Slider.cjs +1 -1
  126. package/dist/components/slider/Slider.js +1 -1
  127. package/dist/components/sparkline/Sparkline.cjs +1 -1
  128. package/dist/components/sparkline/Sparkline.js +1 -1
  129. package/dist/components/table/TableRow.cjs +1 -1
  130. package/dist/components/table/TableRow.js +1 -1
  131. package/dist/components/waterfall-chart/WaterfallChart.cjs +1 -1
  132. package/dist/components/waterfall-chart/WaterfallChart.js +1 -1
  133. package/dist/components/workflow-editor/WorkflowEditor.cjs +1 -1
  134. package/dist/components/workflow-editor/WorkflowEditor.js +1 -1
  135. package/dist/components/workflow-editor/canvas/GridLayer.cjs +1 -1
  136. package/dist/components/workflow-editor/canvas/GridLayer.js +1 -1
  137. package/dist/index.d.cts +433 -170
  138. package/dist/index.d.ts +433 -170
  139. package/dist/lib/accept.cjs +1 -0
  140. package/dist/lib/accept.js +1 -0
  141. package/dist/lib/css-value.cjs +1 -0
  142. package/dist/lib/css-value.js +1 -0
  143. package/dist/lib/ui-labels.cjs +1 -1
  144. package/dist/lib/ui-labels.js +1 -1
  145. package/dist/styles-no-preflight.css +10270 -0
  146. package/dist/styles.css +301 -28
  147. package/package.json +9 -4
@@ -1 +1 @@
1
- "use strict";"use client";var te=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var Ce=Object.prototype.hasOwnProperty;var ke=(l,a)=>{for(var n in a)te(l,n,{get:a[n],enumerable:!0})},xe=(l,a,n,o)=>{if(a&&typeof a=="object"||typeof a=="function")for(let h of ye(a))!Ce.call(l,h)&&h!==n&&te(l,h,{get:()=>a[h],enumerable:!(o=pe(a,h))||o.enumerable});return l};var ve=l=>xe(te({},"__esModule",{value:!0}),l);var Se={};ke(Se,{CandlestickChart:()=>Ne});module.exports=ve(Se);var c=require("react"),D=require("../../lib/i18n.cjs"),re=require("../chart/ChartAxis.cjs"),oe=require("../chart/ChartContainer.cjs"),le=require("../chart/ChartGrid.cjs"),ie=require("../chart/ChartLegend.cjs"),se=require("../chart/ChartTableView.cjs"),ce=require("../chart/ChartTooltip.cjs"),U=require("../chart/palette.cjs"),he=require("../chart/utils/cartesian.cjs"),R=require("../chart/utils/data.cjs"),F=require("../chart/utils/format.cjs"),ue=require("../chart/utils/keyboard.cjs"),ge=require("../chart/utils/path.cjs"),me=require("../chart/utils/scales.cjs"),de=require("../chart/utils/touch.cjs"),e=require("react/jsx-runtime"),we=16,Le=1.5,Re=(0,c.memo)(function({candles:a}){return(0,e.jsx)("g",{children:a.map(n=>(0,e.jsxs)("g",{children:[n.wick?(0,e.jsx)("line",{x1:n.wick.x,y1:n.wick.y1,x2:n.wick.x,y2:n.wick.y2,stroke:n.color,strokeWidth:1.5}):null,n.body?(0,e.jsx)("path",{d:n.body,fill:n.hollow?"none":n.color,stroke:n.color,strokeWidth:n.hollow?1.5:0}):null]},n.key))})});function Pe({width:l,height:a,data:n,candles:o,x:h,y,grid:P,size:O,candleSize:z,fillRising:N,palette:H,referenceLines:E,margin:G,tooltip:f,plotLabel:j,formatValue:b,formatX:_,onCandleClick:C}){let[x,S]=(0,c.useState)(null),u=x!==null&&x<o.length?x:null,k=(0,D.useUILabels)(),t=(0,c.useMemo)(()=>{let r=o.flatMap(i=>i.high===null||i.low===null?[]:[i.low,i.high]),g=(0,he.buildCartesianGeometry)({width:l,height:a,data:n,x:h,y,bounds:r.length===0?null:[Math.min(...r),Math.max(...r)],margin:G,orientation:"vertical",placement:"band",formatValue:b,formatX:_,defaultIncludeZero:!1}),{valueScale:p,bandwidth:I,categoryPositions:$,innerWidth:J,innerHeight:K}=g,v=Math.min(z??we,Math.max(1,I-2));return{rendered:o.map((i,B)=>{let V=$[B]+(I-v)/2,T=V+v/2,d=i.rising?H.up:H.down,Y=i.high===null||i.low===null?null:{x:T,y1:p(i.high),y2:p(i.low)},w=null;if(i.open!==null&&i.close!==null){let X=p(i.open),L=p(i.close);w=(0,ge.buildBarPath)({x:V,y:Math.min(X,L),width:v,height:Math.max(Le,Math.abs(L-X)),radius:0,round:"none"})}return{key:`${B}`,color:d,body:w,hollow:i.rising&&!N,wick:Y,left:V,width:v}}),categoryPositions:$,categoryCenters:g.categoryCenters,bandwidth:I,categoryTicks:g.categoryTicks,valueTicks:g.valueTicks,valueScale:p,innerWidth:J,innerHeight:K,margin:g.margin}},[o,n,h,y,l,a,G,z,N,H,b,_]),Z=(0,c.useCallback)(r=>{if(f===!1||o.length===0)return;let g=r.currentTarget.getBoundingClientRect(),p=r.clientX-g.left-t.margin.left;S((0,me.nearestIndex)(t.categoryCenters,p))},[f,o.length,t.margin.left,t.categoryCenters]),M=(0,c.useCallback)(()=>{!C||u===null||C(o[u])},[C,u,o]),q=(0,c.useCallback)(r=>(0,ue.handleChartKeyDown)(r,{count:o.length,current:u,axis:"x",onMove:S,pick:C?M:null}),[o.length,u,C,M]),s=u===null?null:o[u];return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("svg",{width:l,height:a,role:"img","aria-label":j??o.map(r=>r.label).join(", "),tabIndex:0,className:`${de.CHART_TOUCH} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500`,onPointerMove:Z,onPointerLeave:()=>S(null),onKeyDown:q,onBlur:()=>S(null),onClick:M,children:[(0,e.jsxs)("g",{transform:`translate(${t.margin.left}, ${t.margin.top})`,children:[(0,e.jsx)(le.ChartGrid,{width:t.innerWidth,height:t.innerHeight,horizontal:P==="y"||P==="both"?t.valueTicks.map(r=>r.offset):void 0}),u!==null?(0,e.jsx)("rect",{x:t.categoryPositions[u],y:0,width:t.bandwidth,height:t.innerHeight,className:"fill-gray-400 dark:fill-gray-500",opacity:.12,"aria-hidden":"true"}):null,E?.map(r=>(0,e.jsxs)("g",{children:[(0,e.jsx)("line",{x1:0,y1:t.valueScale(r.value),x2:t.innerWidth,y2:t.valueScale(r.value),stroke:r.color??"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:r.dashed===!1?void 0:"4 4"}),r.label?(0,e.jsx)("text",{x:t.innerWidth,y:t.valueScale(r.value)-4,textAnchor:"end",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:r.label}):null]},`${r.value}-${r.label??""}`)),(0,e.jsx)(Re,{candles:t.rendered})]}),(0,e.jsx)("g",{transform:`translate(${t.margin.left}, ${t.margin.top+t.innerHeight})`,children:h.hidden?null:(0,e.jsx)(re.ChartAxis,{orientation:"bottom",ticks:t.categoryTicks,length:t.innerWidth,label:h.label,size:O})}),(0,e.jsx)("g",{transform:`translate(${t.margin.left}, ${t.margin.top})`,children:y?.hidden?null:(0,e.jsx)(re.ChartAxis,{orientation:"left",ticks:t.valueTicks,length:t.innerHeight,showLine:!1,label:y?.label,size:O})})]}),s&&u!==null&&f!==!1?(0,e.jsx)(ce.ChartTooltip,{x:t.margin.left+t.categoryCenters[u],y:t.margin.top+(s.high===null?t.innerHeight/2:t.valueScale(s.high)),containerWidth:l,children:typeof f=="function"?f(s):(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)("div",{className:"font-medium text-gray-900 dark:text-gray-100",children:s.label}),(0,e.jsx)("dl",{className:"grid grid-cols-[auto_auto] gap-x-3 gap-y-0.5",children:[[k.chartOpen,s.open],[k.chartHigh,s.high],[k.chartLow,s.low],[k.chartClose,s.close]].map(([r,g])=>(0,e.jsxs)("div",{className:"contents",children:[(0,e.jsx)("dt",{className:"text-gray-500 dark:text-gray-400",children:r}),(0,e.jsx)("dd",{className:"justify-self-end font-medium text-gray-900 [font-variant-numeric:tabular-nums] dark:text-gray-100",children:g===null?"\u2014":b(g)})]},r))}),s.change===null?null:(0,e.jsxs)("div",{className:"flex items-center gap-2 border-t border-gray-200 pt-1 dark:border-gray-700",children:[(0,e.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:s.rising?k.chartRise:k.chartFall}),(0,e.jsxs)("span",{className:"[font-variant-numeric:tabular-nums] font-semibold text-gray-900 dark:text-gray-100",children:[s.change>0?"+":"",b(s.change)]})]})]})}):null]})}function Ne({data:l,x:a,y:n,open:o,high:h,low:y,close:P,candleSize:O,fillRising:z=!1,colors:N,referenceLines:H,height:E=300,width:G,size:f="md",grid:j="y",legend:b,tooltip:_=!0,tableView:C=!1,title:x,description:S,loading:u=!1,emptyState:k,error:t=!1,errorState:Z,onRetry:M,actions:q,margin:s,locale:r,plotLabel:g,openLabel:p,highLabel:I,lowLabel:$,closeLabel:J,riseLabel:K,fallLabel:v,format:Q,onCandleClick:i,className:B,...V}){let T=(0,D.useUILocale)(r),d=(0,D.useUILabels)(),Y=(0,c.useMemo)(()=>n?.format??Q??(m=>(0,F.formatAuto)(m,T)),[n?.format,Q,T]),w=(0,c.useMemo)(()=>a.format??(m=>(0,F.formatXValue)(m,T)),[a.format,T]),X=(0,c.useMemo)(()=>l.map((m,ee)=>{let ae=(0,R.readXValue)(m,a.key,ee),A=(0,R.readNumber)(m,o),W=(0,R.readNumber)(m,P);return{index:ee,x:ae,label:w(ae,ee),open:A,high:(0,R.readNumber)(m,h),low:(0,R.readNumber)(m,y),close:W,change:A===null||W===null?null:W-A,rising:A===null||W===null?!0:W>=A,datum:m}}),[l,a.key,o,h,y,P,w]),L=(0,c.useMemo)(()=>({up:N?.up??U.CHART_UP_COLOR,down:N?.down??U.CHART_DOWN_COLOR}),[N]),fe=(0,c.useMemo)(()=>[{key:"up",label:K??d.chartRise,color:L.up,marker:"rect"},{key:"down",label:v??d.chartFall,color:L.down,marker:"rect"}],[L,K,v,d.chartRise,d.chartFall]),be=b===void 0?!0:b!==!1,ne=typeof b=="string"?b:"bottom";return(0,e.jsx)(oe.ChartContainer,{title:x,description:S,height:E,width:G,size:f,loading:u,empty:X.length===0,emptyState:k,error:t,errorState:Z,onRetry:M,actions:q,tableView:C,legendPosition:ne,legend:be?(0,e.jsx)(ie.ChartLegend,{items:fe,position:ne,marker:"rect",size:f}):void 0,table:C?(0,e.jsx)(se.ChartTableView,{data:l,series:[{key:o,label:p??d.chartOpen},{key:h,label:I??d.chartHigh},{key:y,label:$??d.chartLow},{key:P,label:J??d.chartClose}],xKey:a.key,xLabel:a.label??a.key,formatX:w,formatValue:Y,caption:typeof x=="string"?x:void 0}):void 0,className:B,...V,children:({width:m})=>(0,e.jsx)(Pe,{width:m,height:E,data:l,candles:X,x:a,y:n,grid:j,size:f,candleSize:O,fillRising:z,palette:L,referenceLines:H,margin:s,tooltip:_,plotLabel:g,formatValue:Y,formatX:w,onCandleClick:i})})}0&&(module.exports={CandlestickChart});
1
+ "use strict";"use client";var ae=Object.defineProperty;var ke=Object.getOwnPropertyDescriptor;var we=Object.getOwnPropertyNames;var xe=Object.prototype.hasOwnProperty;var ve=(o,n)=>{for(var u in n)ae(o,u,{get:n[u],enumerable:!0})},Le=(o,n,u,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let c of we(n))!xe.call(o,c)&&c!==u&&ae(o,c,{get:()=>n[c],enumerable:!(r=ke(n,c))||r.enumerable});return o};var Pe=o=>Le(ae({},"__esModule",{value:!0}),o);var Te={};ve(Te,{CandlestickChart:()=>He});module.exports=Pe(Te);var s=require("react"),z=require("../../lib/i18n.cjs"),oe=require("../chart/ChartAxis.cjs"),he=require("../chart/ChartContainer.cjs"),ue=require("../chart/ChartGrid.cjs"),ge=require("../chart/ChartLegend.cjs"),T=require("../chart/ChartPlotClip.cjs"),de=require("../chart/ChartTableView.cjs"),me=require("../chart/ChartTooltip.cjs"),J=require("../chart/palette.cjs"),V=require("../chart/utils/cartesian.cjs"),v=require("../chart/utils/data.cjs"),Q=require("../chart/utils/format.cjs"),fe=require("../chart/utils/keyboard.cjs"),pe=require("../chart/utils/path.cjs"),be=require("../chart/utils/scales.cjs"),ye=require("../chart/utils/ticks.cjs"),Ce=require("../chart/utils/touch.cjs"),e=require("react/jsx-runtime"),Re=16,Ne=1.5,Se=(0,s.memo)(function({candles:n,clipId:u}){return(0,e.jsx)("g",{clipPath:`url(#${u})`,children:n.map(r=>(0,e.jsxs)("g",{children:[r.wick?(0,e.jsx)("line",{x1:r.wick.x,y1:r.wick.y1,x2:r.wick.x,y2:r.wick.y2,stroke:r.color,strokeWidth:1.5}):null,r.body?(0,e.jsx)("path",{d:r.body,fill:r.hollow?"none":r.color,stroke:r.color,strokeWidth:r.hollow?1.5:0}):null]},r.key))})});function Ie({width:o,height:n,data:u,candles:r,x:c,y,grid:L,size:E,candleSize:G,fillRising:P,palette:X,referenceLines:R,margin:_,tooltip:f,plotLabel:ee,formatValue:p,formatX:K,onCandleClick:C,locale:N}){let[M,S]=(0,s.useState)(null),g=M!==null&&M<r.length?M:null,k=(0,z.useUILabels)(),B=(0,T.plotClipId)((0,s.useId)()),t=(0,s.useMemo)(()=>{let a=r.flatMap(i=>i.high===null||i.low===null?[]:[i.low,i.high]),l=(0,V.buildCartesianGeometry)({locale:N,width:o,height:n,data:u,x:c,y,bounds:(0,V.widenBounds)((0,ye.extent)(a),(0,V.annotationValues)(u,c.key,R,void 0)),margin:_,orientation:"vertical",placement:"band",formatValue:p,formatX:K,defaultIncludeZero:!1}),{valueScale:b,bandwidth:W,categoryPositions:O,innerWidth:Y,innerHeight:U}=l,I=Math.min(G??Re,Math.max(1,W-2));return{rendered:r.map((i,w)=>{let d=O[w]+(W-I)/2,F=d+I/2,H=i.rising?X.up:X.down,j=i.high===null||i.low===null?null:{x:F,y1:b(i.high),y2:b(i.low)},x=null;if(i.open!==null&&i.close!==null){let Z=b(i.open),q=b(i.close);x=(0,pe.buildBarPath)({x:d,y:Math.min(Z,q),width:I,height:Math.max(Ne,Math.abs(q-Z)),radius:0,round:"none"})}return{key:`${w}`,color:H,body:x,hollow:i.rising&&!P,wick:j,left:d,width:I}}),categoryPositions:O,categoryCenters:l.categoryCenters,bandwidth:W,categoryTicks:l.categoryTicks,valueTicks:l.valueTicks,valueScale:b,innerWidth:Y,innerHeight:U,margin:l.margin}},[N,r,u,c,y,o,n,_,G,P,X,R,p,K]),te=(0,s.useCallback)(a=>{if(f===!1||r.length===0)return;let l=a.currentTarget.getBoundingClientRect(),b=a.clientX-l.left-t.margin.left;S((0,be.nearestIndex)(t.categoryCenters,b))},[f,r.length,t.margin.left,t.categoryCenters]),A=(0,s.useCallback)(()=>{!C||g===null||C(r[g])},[C,g,r]),re=(0,s.useCallback)(a=>(0,fe.handleChartKeyDown)(a,{count:r.length,current:g,axis:"x",onMove:S,pick:C?A:null}),[r.length,g,C,A]),h=g===null?null:r[g];return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("svg",{width:o,height:n,role:"img","aria-label":ee??r.map(a=>a.label).join(", "),tabIndex:0,className:`${Ce.CHART_TOUCH} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500`,onPointerMove:te,onPointerLeave:()=>S(null),onKeyDown:re,onBlur:()=>S(null),onClick:A,children:[(0,e.jsxs)("g",{transform:`translate(${t.margin.left}, ${t.margin.top})`,children:[(0,e.jsx)(T.ChartPlotClip,{id:B,width:t.innerWidth,height:t.innerHeight,bleed:1}),(0,e.jsx)(ue.ChartGrid,{width:t.innerWidth,height:t.innerHeight,horizontal:L==="y"||L==="both"?t.valueTicks.map(a=>a.offset):void 0}),g!==null?(0,e.jsx)("rect",{x:t.categoryPositions[g],y:0,width:t.bandwidth,height:t.innerHeight,className:"fill-gray-400 dark:fill-gray-500",opacity:.12,"aria-hidden":"true"}):null,R?.map(a=>{let l=t.valueScale(a.value);return(0,T.isOnPlot)(l,t.innerHeight)?(0,e.jsxs)("g",{children:[(0,e.jsx)("line",{x1:0,y1:l,x2:t.innerWidth,y2:l,stroke:a.color??"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:a.dashed===!1?void 0:"4 4"}),a.label?(0,e.jsx)("text",{x:t.innerWidth,y:l-4,textAnchor:"end",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:a.label}):null]},`${a.value}-${a.label??""}`):null}),(0,e.jsx)(Se,{candles:t.rendered,clipId:B})]}),(0,e.jsx)("g",{transform:`translate(${t.margin.left}, ${t.margin.top+t.innerHeight})`,children:c.hidden?null:(0,e.jsx)(oe.ChartAxis,{orientation:"bottom",ticks:t.categoryTicks,length:t.innerWidth,label:c.label,size:E})}),(0,e.jsx)("g",{transform:`translate(${t.margin.left}, ${t.margin.top})`,children:y?.hidden?null:(0,e.jsx)(oe.ChartAxis,{orientation:"left",ticks:t.valueTicks,length:t.innerHeight,showLine:!1,label:y?.label,size:E})})]}),h&&g!==null&&f!==!1?(0,e.jsx)(me.ChartTooltip,{x:t.margin.left+t.categoryCenters[g],y:t.margin.top+(h.high===null?t.innerHeight/2:t.valueScale(h.high)),containerWidth:o,children:typeof f=="function"?f(h):(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)("div",{className:"font-medium text-gray-900 dark:text-gray-100",children:h.label}),(0,e.jsx)("dl",{className:"grid grid-cols-[auto_auto] gap-x-3 gap-y-0.5",children:[[k.chartOpen,h.open],[k.chartHigh,h.high],[k.chartLow,h.low],[k.chartClose,h.close]].map(([a,l])=>(0,e.jsxs)("div",{className:"contents",children:[(0,e.jsx)("dt",{className:"text-gray-500 dark:text-gray-400",children:a}),(0,e.jsx)("dd",{className:"justify-self-end font-medium text-gray-900 [font-variant-numeric:tabular-nums] dark:text-gray-100",children:l===null?"\u2014":p(l)})]},a))}),h.change===null?null:(0,e.jsxs)("div",{className:"flex items-center gap-2 border-t border-gray-200 pt-1 dark:border-gray-700",children:[(0,e.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:h.rising?k.chartRise:k.chartFall}),(0,e.jsxs)("span",{className:"[font-variant-numeric:tabular-nums] font-semibold text-gray-900 dark:text-gray-100",children:[h.change>0?"+":"",p(h.change)]})]})]})}):null]})}function He({data:o,x:n,y:u,open:r,high:c,low:y,close:L,candleSize:E,fillRising:G=!1,colors:P,referenceLines:X,height:R=300,width:_,size:f="md",grid:ee="y",legend:p,tooltip:K=!0,tableView:C=!1,title:N,description:M,loading:S=!1,emptyState:g,error:k=!1,errorState:B,onRetry:t,actions:te,margin:A,locale:re,plotLabel:h,openLabel:a,highLabel:l,lowLabel:b,closeLabel:W,riseLabel:O,fallLabel:Y,format:U,onCandleClick:I,className:le,...i}){let w=(0,z.useUILocale)(re),d=(0,z.useUILabels)(),F=(0,s.useMemo)(()=>u?.format??U??(m=>(0,Q.formatAuto)(m,w)),[u?.format,U,w]),H=(0,s.useMemo)(()=>n.format??(m=>(0,Q.formatXValue)(m,w)),[n.format,w]),j=(0,s.useMemo)(()=>o.map((m,ne)=>{let ce=(0,v.readXValue)(m,n.key,ne),D=(0,v.readNumber)(m,r),$=(0,v.readNumber)(m,L);return{index:ne,x:ce,label:H(ce,ne),open:D,high:(0,v.readNumber)(m,c),low:(0,v.readNumber)(m,y),close:$,change:D===null||$===null?null:$-D,rising:D===null||$===null?!0:$>=D,datum:m}}),[o,n.key,r,c,y,L,H]),x=(0,s.useMemo)(()=>({up:P?.up??J.CHART_UP_COLOR,down:P?.down??J.CHART_DOWN_COLOR}),[P]),Z=(0,s.useMemo)(()=>[{key:"up",label:O??d.chartRise,color:x.up,marker:"rect"},{key:"down",label:Y??d.chartFall,color:x.down,marker:"rect"}],[x,O,Y,d.chartRise,d.chartFall]),q=p===void 0?!0:p!==!1,ie=typeof p=="string"?p:"bottom",se=[{key:r,label:a??d.chartOpen},{key:c,label:l??d.chartHigh},{key:y,label:b??d.chartLow},{key:L,label:W??d.chartClose}];return(0,e.jsx)(he.ChartContainer,{title:N,description:M,height:R,width:_,size:f,loading:S,empty:j.length===0,emptyState:g,error:k,errorState:B,onRetry:t,actions:te,exportSource:{data:o,series:se,xKey:n.key,xLabel:n.label??n.key,formatX:n.format},tableView:C,legendPosition:ie,legend:q?(0,e.jsx)(ge.ChartLegend,{items:Z,position:ie,marker:"rect",size:f}):void 0,table:C?(0,e.jsx)(de.ChartTableView,{data:o,series:se,xKey:n.key,xLabel:n.label??n.key,formatX:H,formatValue:F,caption:typeof N=="string"?N:void 0}):void 0,className:le,...i,children:({width:m})=>(0,e.jsx)(Ie,{locale:w,width:m,height:R,data:o,candles:j,x:n,y:u,grid:ee,size:f,candleSize:E,fillRising:G,palette:x,referenceLines:X,margin:A,tooltip:K,plotLabel:h,formatValue:F,formatX:H,onCandleClick:I})})}0&&(module.exports={CandlestickChart});
@@ -1 +1 @@
1
- "use client";import{memo as le,useCallback as Q,useMemo as T,useState as ie}from"react";import{useUILabels as ne,useUILocale as se}from"../../lib/i18n.js";import{ChartAxis as re}from"../chart/ChartAxis.js";import{ChartContainer as ce}from"../chart/ChartContainer.js";import{ChartGrid as he}from"../chart/ChartGrid.js";import{ChartLegend as ue}from"../chart/ChartLegend.js";import{ChartTableView as ge}from"../chart/ChartTableView.js";import{ChartTooltip as me}from"../chart/ChartTooltip.js";import{CHART_DOWN_COLOR as de,CHART_UP_COLOR as fe}from"../chart/palette.js";import{buildCartesianGeometry as be}from"../chart/utils/cartesian.js";import{readNumber as Y,readXValue as pe}from"../chart/utils/data.js";import{formatAuto as ye,formatXValue as Ce}from"../chart/utils/format.js";import{handleChartKeyDown as ke}from"../chart/utils/keyboard.js";import{buildBarPath as xe}from"../chart/utils/path.js";import{nearestIndex as ve}from"../chart/utils/scales.js";import{CHART_TOUCH as we}from"../chart/utils/touch.js";import{Fragment as Se,jsx as r,jsxs as b}from"react/jsx-runtime";var Le=16,Re=1.5,Pe=le(function({candles:i}){return r("g",{children:i.map(n=>b("g",{children:[n.wick?r("line",{x1:n.wick.x,y1:n.wick.y1,x2:n.wick.x,y2:n.wick.y2,stroke:n.color,strokeWidth:1.5}):null,n.body?r("path",{d:n.body,fill:n.hollow?"none":n.color,stroke:n.color,strokeWidth:n.hollow?1.5:0}):null]},n.key))})});function Ne({width:u,height:i,data:n,candles:o,x:p,y,grid:R,size:D,candleSize:O,fillRising:P,palette:H,referenceLines:z,margin:E,tooltip:m,plotLabel:U,formatValue:d,formatX:G,onCandleClick:C}){let[x,N]=ie(null),s=x!==null&&x<o.length?x:null,k=ne(),e=T(()=>{let t=o.flatMap(a=>a.high===null||a.low===null?[]:[a.low,a.high]),c=be({width:u,height:i,data:n,x:p,y,bounds:t.length===0?null:[Math.min(...t),Math.max(...t)],margin:E,orientation:"vertical",placement:"band",formatValue:d,formatX:G,defaultIncludeZero:!1}),{valueScale:f,bandwidth:I,categoryPositions:_,innerWidth:Z,innerHeight:$}=c,v=Math.min(O??Le,Math.max(1,I-2));return{rendered:o.map((a,K)=>{let V=_[K]+(I-v)/2,S=V+v/2,g=a.rising?H.up:H.down,B=a.high===null||a.low===null?null:{x:S,y1:f(a.high),y2:f(a.low)},w=null;if(a.open!==null&&a.close!==null){let X=f(a.open),L=f(a.close);w=xe({x:V,y:Math.min(X,L),width:v,height:Math.max(Re,Math.abs(L-X)),radius:0,round:"none"})}return{key:`${K}`,color:g,body:w,hollow:a.rising&&!P,wick:B,left:V,width:v}}),categoryPositions:_,categoryCenters:c.categoryCenters,bandwidth:I,categoryTicks:c.categoryTicks,valueTicks:c.valueTicks,valueScale:f,innerWidth:Z,innerHeight:$,margin:c.margin}},[o,n,p,y,u,i,E,O,P,H,d,G]),F=Q(t=>{if(m===!1||o.length===0)return;let c=t.currentTarget.getBoundingClientRect(),f=t.clientX-c.left-e.margin.left;N(ve(e.categoryCenters,f))},[m,o.length,e.margin.left,e.categoryCenters]),M=Q(()=>{!C||s===null||C(o[s])},[C,s,o]),j=Q(t=>ke(t,{count:o.length,current:s,axis:"x",onMove:N,pick:C?M:null}),[o.length,s,C,M]),l=s===null?null:o[s];return b(Se,{children:[b("svg",{width:u,height:i,role:"img","aria-label":U??o.map(t=>t.label).join(", "),tabIndex:0,className:`${we} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500`,onPointerMove:F,onPointerLeave:()=>N(null),onKeyDown:j,onBlur:()=>N(null),onClick:M,children:[b("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[r(he,{width:e.innerWidth,height:e.innerHeight,horizontal:R==="y"||R==="both"?e.valueTicks.map(t=>t.offset):void 0}),s!==null?r("rect",{x:e.categoryPositions[s],y:0,width:e.bandwidth,height:e.innerHeight,className:"fill-gray-400 dark:fill-gray-500",opacity:.12,"aria-hidden":"true"}):null,z?.map(t=>b("g",{children:[r("line",{x1:0,y1:e.valueScale(t.value),x2:e.innerWidth,y2:e.valueScale(t.value),stroke:t.color??"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:t.dashed===!1?void 0:"4 4"}),t.label?r("text",{x:e.innerWidth,y:e.valueScale(t.value)-4,textAnchor:"end",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:t.label}):null]},`${t.value}-${t.label??""}`)),r(Pe,{candles:e.rendered})]}),r("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:p.hidden?null:r(re,{orientation:"bottom",ticks:e.categoryTicks,length:e.innerWidth,label:p.label,size:D})}),r("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:y?.hidden?null:r(re,{orientation:"left",ticks:e.valueTicks,length:e.innerHeight,showLine:!1,label:y?.label,size:D})})]}),l&&s!==null&&m!==!1?r(me,{x:e.margin.left+e.categoryCenters[s],y:e.margin.top+(l.high===null?e.innerHeight/2:e.valueScale(l.high)),containerWidth:u,children:typeof m=="function"?m(l):b("div",{className:"flex flex-col gap-1",children:[r("div",{className:"font-medium text-gray-900 dark:text-gray-100",children:l.label}),r("dl",{className:"grid grid-cols-[auto_auto] gap-x-3 gap-y-0.5",children:[[k.chartOpen,l.open],[k.chartHigh,l.high],[k.chartLow,l.low],[k.chartClose,l.close]].map(([t,c])=>b("div",{className:"contents",children:[r("dt",{className:"text-gray-500 dark:text-gray-400",children:t}),r("dd",{className:"justify-self-end font-medium text-gray-900 [font-variant-numeric:tabular-nums] dark:text-gray-100",children:c===null?"\u2014":d(c)})]},t))}),l.change===null?null:b("div",{className:"flex items-center gap-2 border-t border-gray-200 pt-1 dark:border-gray-700",children:[r("span",{className:"text-gray-500 dark:text-gray-400",children:l.rising?k.chartRise:k.chartFall}),b("span",{className:"[font-variant-numeric:tabular-nums] font-semibold text-gray-900 dark:text-gray-100",children:[l.change>0?"+":"",d(l.change)]})]})]})}):null]})}function Be({data:u,x:i,y:n,open:o,high:p,low:y,close:R,candleSize:D,fillRising:O=!1,colors:P,referenceLines:H,height:z=300,width:E,size:m="md",grid:U="y",legend:d,tooltip:G=!0,tableView:C=!1,title:x,description:N,loading:s=!1,emptyState:k,error:e=!1,errorState:F,onRetry:M,actions:j,margin:l,locale:t,plotLabel:c,openLabel:f,highLabel:I,lowLabel:_,closeLabel:Z,riseLabel:$,fallLabel:v,format:q,onCandleClick:a,className:K,...V}){let S=se(t),g=ne(),B=T(()=>n?.format??q??(h=>ye(h,S)),[n?.format,q,S]),w=T(()=>i.format??(h=>Ce(h,S)),[i.format,S]),X=T(()=>u.map((h,J)=>{let te=pe(h,i.key,J),A=Y(h,o),W=Y(h,R);return{index:J,x:te,label:w(te,J),open:A,high:Y(h,p),low:Y(h,y),close:W,change:A===null||W===null?null:W-A,rising:A===null||W===null?!0:W>=A,datum:h}}),[u,i.key,o,p,y,R,w]),L=T(()=>({up:P?.up??fe,down:P?.down??de}),[P]),ae=T(()=>[{key:"up",label:$??g.chartRise,color:L.up,marker:"rect"},{key:"down",label:v??g.chartFall,color:L.down,marker:"rect"}],[L,$,v,g.chartRise,g.chartFall]),oe=d===void 0?!0:d!==!1,ee=typeof d=="string"?d:"bottom";return r(ce,{title:x,description:N,height:z,width:E,size:m,loading:s,empty:X.length===0,emptyState:k,error:e,errorState:F,onRetry:M,actions:j,tableView:C,legendPosition:ee,legend:oe?r(ue,{items:ae,position:ee,marker:"rect",size:m}):void 0,table:C?r(ge,{data:u,series:[{key:o,label:f??g.chartOpen},{key:p,label:I??g.chartHigh},{key:y,label:_??g.chartLow},{key:R,label:Z??g.chartClose}],xKey:i.key,xLabel:i.label??i.key,formatX:w,formatValue:B,caption:typeof x=="string"?x:void 0}):void 0,className:K,...V,children:({width:h})=>r(Ne,{width:h,height:z,data:u,candles:X,x:i,y:n,grid:U,size:m,candleSize:D,fillRising:O,palette:L,referenceLines:H,margin:l,tooltip:G,plotLabel:c,formatValue:B,formatX:w,onCandleClick:a})})}export{Be as CandlestickChart};
1
+ "use client";import{memo as ie,useCallback as ee,useId as se,useMemo as H,useState as ce}from"react";import{useUILabels as le,useUILocale as he}from"../../lib/i18n.js";import{ChartAxis as oe}from"../chart/ChartAxis.js";import{ChartContainer as ue}from"../chart/ChartContainer.js";import{ChartGrid as ge}from"../chart/ChartGrid.js";import{ChartLegend as de}from"../chart/ChartLegend.js";import{ChartPlotClip as me,isOnPlot as fe,plotClipId as pe}from"../chart/ChartPlotClip.js";import{ChartTableView as be}from"../chart/ChartTableView.js";import{ChartTooltip as ye}from"../chart/ChartTooltip.js";import{CHART_DOWN_COLOR as Ce,CHART_UP_COLOR as ke}from"../chart/palette.js";import{annotationValues as we,buildCartesianGeometry as xe,widenBounds as ve}from"../chart/utils/cartesian.js";import{readNumber as j,readXValue as Le}from"../chart/utils/data.js";import{formatAuto as Pe,formatXValue as Re}from"../chart/utils/format.js";import{handleChartKeyDown as Ne}from"../chart/utils/keyboard.js";import{buildBarPath as Se}from"../chart/utils/path.js";import{nearestIndex as Ie}from"../chart/utils/scales.js";import{extent as He}from"../chart/utils/ticks.js";import{CHART_TOUCH as Te}from"../chart/utils/touch.js";import{Fragment as We,jsx as n,jsxs as b}from"react/jsx-runtime";var Ve=16,Xe=1.5,Me=ie(function({candles:a,clipId:g}){return n("g",{clipPath:`url(#${g})`,children:a.map(t=>b("g",{children:[t.wick?n("line",{x1:t.wick.x,y1:t.wick.y1,x2:t.wick.x,y2:t.wick.y2,stroke:t.color,strokeWidth:1.5}):null,t.body?n("path",{d:t.body,fill:t.hollow?"none":t.color,stroke:t.color,strokeWidth:t.hollow?1.5:0}):null]},t.key))})});function Ae({width:u,height:a,data:g,candles:t,x:d,y,grid:v,size:D,candleSize:$,fillRising:L,palette:T,referenceLines:P,margin:z,tooltip:m,plotLabel:Z,formatValue:f,formatX:E,onCandleClick:C,locale:R}){let[V,N]=ce(null),s=V!==null&&V<t.length?V:null,k=le(),G=pe(se()),e=H(()=>{let r=t.flatMap(l=>l.high===null||l.low===null?[]:[l.low,l.high]),o=xe({locale:R,width:u,height:a,data:g,x:d,y,bounds:ve(He(r),we(g,d.key,P,void 0)),margin:z,orientation:"vertical",placement:"band",formatValue:f,formatX:E,defaultIncludeZero:!1}),{valueScale:p,bandwidth:M,categoryPositions:A,innerWidth:_,innerHeight:K}=o,S=Math.min($??Ve,Math.max(1,M-2));return{rendered:t.map((l,w)=>{let c=A[w]+(M-S)/2,B=c+S/2,I=l.rising?T.up:T.down,Y=l.high===null||l.low===null?null:{x:B,y1:p(l.high),y2:p(l.low)},x=null;if(l.open!==null&&l.close!==null){let U=p(l.open),F=p(l.close);x=Se({x:c,y:Math.min(U,F),width:S,height:Math.max(Xe,Math.abs(F-U)),radius:0,round:"none"})}return{key:`${w}`,color:I,body:x,hollow:l.rising&&!L,wick:Y,left:c,width:S}}),categoryPositions:A,categoryCenters:o.categoryCenters,bandwidth:M,categoryTicks:o.categoryTicks,valueTicks:o.valueTicks,valueScale:p,innerWidth:_,innerHeight:K,margin:o.margin}},[R,t,g,d,y,u,a,z,$,L,T,P,f,E]),q=ee(r=>{if(m===!1||t.length===0)return;let o=r.currentTarget.getBoundingClientRect(),p=r.clientX-o.left-e.margin.left;N(Ie(e.categoryCenters,p))},[m,t.length,e.margin.left,e.categoryCenters]),X=ee(()=>{!C||s===null||C(t[s])},[C,s,t]),J=ee(r=>Ne(r,{count:t.length,current:s,axis:"x",onMove:N,pick:C?X:null}),[t.length,s,C,X]),i=s===null?null:t[s];return b(We,{children:[b("svg",{width:u,height:a,role:"img","aria-label":Z??t.map(r=>r.label).join(", "),tabIndex:0,className:`${Te} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500`,onPointerMove:q,onPointerLeave:()=>N(null),onKeyDown:J,onBlur:()=>N(null),onClick:X,children:[b("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[n(me,{id:G,width:e.innerWidth,height:e.innerHeight,bleed:1}),n(ge,{width:e.innerWidth,height:e.innerHeight,horizontal:v==="y"||v==="both"?e.valueTicks.map(r=>r.offset):void 0}),s!==null?n("rect",{x:e.categoryPositions[s],y:0,width:e.bandwidth,height:e.innerHeight,className:"fill-gray-400 dark:fill-gray-500",opacity:.12,"aria-hidden":"true"}):null,P?.map(r=>{let o=e.valueScale(r.value);return fe(o,e.innerHeight)?b("g",{children:[n("line",{x1:0,y1:o,x2:e.innerWidth,y2:o,stroke:r.color??"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:r.dashed===!1?void 0:"4 4"}),r.label?n("text",{x:e.innerWidth,y:o-4,textAnchor:"end",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:r.label}):null]},`${r.value}-${r.label??""}`):null}),n(Me,{candles:e.rendered,clipId:G})]}),n("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:d.hidden?null:n(oe,{orientation:"bottom",ticks:e.categoryTicks,length:e.innerWidth,label:d.label,size:D})}),n("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:y?.hidden?null:n(oe,{orientation:"left",ticks:e.valueTicks,length:e.innerHeight,showLine:!1,label:y?.label,size:D})})]}),i&&s!==null&&m!==!1?n(ye,{x:e.margin.left+e.categoryCenters[s],y:e.margin.top+(i.high===null?e.innerHeight/2:e.valueScale(i.high)),containerWidth:u,children:typeof m=="function"?m(i):b("div",{className:"flex flex-col gap-1",children:[n("div",{className:"font-medium text-gray-900 dark:text-gray-100",children:i.label}),n("dl",{className:"grid grid-cols-[auto_auto] gap-x-3 gap-y-0.5",children:[[k.chartOpen,i.open],[k.chartHigh,i.high],[k.chartLow,i.low],[k.chartClose,i.close]].map(([r,o])=>b("div",{className:"contents",children:[n("dt",{className:"text-gray-500 dark:text-gray-400",children:r}),n("dd",{className:"justify-self-end font-medium text-gray-900 [font-variant-numeric:tabular-nums] dark:text-gray-100",children:o===null?"\u2014":f(o)})]},r))}),i.change===null?null:b("div",{className:"flex items-center gap-2 border-t border-gray-200 pt-1 dark:border-gray-700",children:[n("span",{className:"text-gray-500 dark:text-gray-400",children:i.rising?k.chartRise:k.chartFall}),b("span",{className:"[font-variant-numeric:tabular-nums] font-semibold text-gray-900 dark:text-gray-100",children:[i.change>0?"+":"",f(i.change)]})]})]})}):null]})}function tt({data:u,x:a,y:g,open:t,high:d,low:y,close:v,candleSize:D,fillRising:$=!1,colors:L,referenceLines:T,height:P=300,width:z,size:m="md",grid:Z="y",legend:f,tooltip:E=!0,tableView:C=!1,title:R,description:V,loading:N=!1,emptyState:s,error:k=!1,errorState:G,onRetry:e,actions:q,margin:X,locale:J,plotLabel:i,openLabel:r,highLabel:o,lowLabel:p,closeLabel:M,riseLabel:A,fallLabel:_,format:K,onCandleClick:S,className:te,...l}){let w=he(J),c=le(),B=H(()=>g?.format??K??(h=>Pe(h,w)),[g?.format,K,w]),I=H(()=>a.format??(h=>Re(h,w)),[a.format,w]),Y=H(()=>u.map((h,Q)=>{let ae=Le(h,a.key,Q),W=j(h,t),O=j(h,v);return{index:Q,x:ae,label:I(ae,Q),open:W,high:j(h,d),low:j(h,y),close:O,change:W===null||O===null?null:O-W,rising:W===null||O===null?!0:O>=W,datum:h}}),[u,a.key,t,d,y,v,I]),x=H(()=>({up:L?.up??ke,down:L?.down??Ce}),[L]),U=H(()=>[{key:"up",label:A??c.chartRise,color:x.up,marker:"rect"},{key:"down",label:_??c.chartFall,color:x.down,marker:"rect"}],[x,A,_,c.chartRise,c.chartFall]),F=f===void 0?!0:f!==!1,re=typeof f=="string"?f:"bottom",ne=[{key:t,label:r??c.chartOpen},{key:d,label:o??c.chartHigh},{key:y,label:p??c.chartLow},{key:v,label:M??c.chartClose}];return n(ue,{title:R,description:V,height:P,width:z,size:m,loading:N,empty:Y.length===0,emptyState:s,error:k,errorState:G,onRetry:e,actions:q,exportSource:{data:u,series:ne,xKey:a.key,xLabel:a.label??a.key,formatX:a.format},tableView:C,legendPosition:re,legend:F?n(de,{items:U,position:re,marker:"rect",size:m}):void 0,table:C?n(be,{data:u,series:ne,xKey:a.key,xLabel:a.label??a.key,formatX:I,formatValue:B,caption:typeof R=="string"?R:void 0}):void 0,className:te,...l,children:({width:h})=>n(Ae,{locale:w,width:h,height:P,data:u,candles:Y,x:a,y:g,grid:Z,size:m,candleSize:D,fillRising:$,palette:x,referenceLines:T,margin:X,tooltip:E,plotLabel:i,formatValue:B,formatX:I,onCandleClick:S})})}export{tt as CandlestickChart};
@@ -1 +1 @@
1
- "use strict";var s=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var k=(e,r)=>{for(var a in r)s(e,a,{get:r[a],enumerable:!0})},N=(e,r,a,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of y(r))!R.call(e,n)&&n!==a&&s(e,n,{get:()=>r[n],enumerable:!(t=P(r,n))||t.enumerable});return e};var z=e=>N(s({},"__esModule",{value:!0}),e);var q={};k(q,{Card:()=>i});module.exports=z(q);var o=require("../../lib/cn.cjs"),u=require("react/jsx-runtime");function B(e,r,a){let t=a||"bg-white dark:bg-gray-800",n=r||"border-gray-200 dark:border-gray-700";switch(e){case"outlined":return(0,o.cn)("border-2 bg-transparent",n);case"elevated":return(0,o.cn)("shadow-lg border-0",t);case"filled":return(0,o.cn)(a||"bg-gray-100 dark:bg-gray-700","border-0");default:return(0,o.cn)("border",n,t)}}function W(e){switch(e){case"sm":return"max-w-sm";case"lg":return"max-w-2xl";default:return"max-w-md"}}function S(e){switch(e){case"none":return"rounded-none";case"sm":return"rounded-sm";case"md":return"rounded-md";case"xl":return"rounded-xl";case"full":return"rounded-3xl";default:return"rounded-lg"}}function V(e){switch(e){case"none":return"";case"sm":return"p-2";case"lg":return"p-6";default:return""}}function i({variant:e="default",size:r="md",rounded:a="lg",padding:t="none",bgColor:n,borderColor:c,shadowColor:g,hoverable:m=!1,clickable:d=!1,as:f="div",className:p,children:C,onClick:l,...h}){let b=f,v=m?"transition-all duration-200 hover:shadow-lg hover:-translate-y-0.5":"",w=d?"cursor-pointer active:scale-[0.98] transition-transform":"",x=g||"";return(0,u.jsx)(b,{className:(0,o.cn)("overflow-hidden",B(e,c,n),W(r),S(a),V(t),v,w,x,p),onClick:d||l?l:void 0,...h,children:C})}i.displayName="Card";0&&(module.exports={Card});
1
+ "use strict";var s=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var k=(e,r)=>{for(var a in r)s(e,a,{get:r[a],enumerable:!0})},N=(e,r,a,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of y(r))!R.call(e,n)&&n!==a&&s(e,n,{get:()=>r[n],enumerable:!(t=P(r,n))||t.enumerable});return e};var z=e=>N(s({},"__esModule",{value:!0}),e);var q={};k(q,{Card:()=>i});module.exports=z(q);var o=require("../../lib/cn.cjs"),u=require("react/jsx-runtime");function B(e,r,a){let t=a||"bg-white dark:bg-gray-800",n=r||"border-gray-200 dark:border-gray-700";switch(e){case"outlined":return(0,o.cn)("border-2 bg-transparent",n);case"elevated":return(0,o.cn)("shadow-lg border-0",t);case"filled":return(0,o.cn)(a||"bg-gray-100 dark:bg-gray-700","border-0");default:return(0,o.cn)("border",n,t)}}function W(e){switch(e){case"sm":return"max-w-sm";case"lg":return"max-w-2xl";default:return"max-w-md"}}function S(e){switch(e){case"none":return"rounded-none";case"sm":return"rounded-sm";case"md":return"rounded-md";case"xl":return"rounded-xl";case"full":return"rounded-3xl";default:return"rounded-lg"}}function V(e){switch(e){case"none":return"";case"sm":return"p-2";case"md":return"p-4";case"lg":return"p-6";default:return""}}function i({variant:e="default",size:r="md",rounded:a="lg",padding:t="none",bgColor:n,borderColor:c,shadowColor:g,hoverable:m=!1,clickable:d=!1,as:f="div",className:p,children:C,onClick:l,...h}){let b=f,v=m?"transition-all duration-200 hover:shadow-lg hover:-translate-y-0.5":"",w=d?"cursor-pointer active:scale-[0.98] transition-transform":"",x=g||"";return(0,u.jsx)(b,{className:(0,o.cn)("overflow-hidden",B(e,c,n),W(r),S(a),V(t),v,w,x,p),onClick:d||l?l:void 0,...h,children:C})}i.displayName="Card";0&&(module.exports={Card});
@@ -1 +1 @@
1
- import{cn as r}from"../../lib/cn.js";import{jsx as R}from"react/jsx-runtime";function v(e,o,n){let a=n||"bg-white dark:bg-gray-800",t=o||"border-gray-200 dark:border-gray-700";switch(e){case"outlined":return r("border-2 bg-transparent",t);case"elevated":return r("shadow-lg border-0",a);case"filled":return r(n||"bg-gray-100 dark:bg-gray-700","border-0");default:return r("border",t,a)}}function w(e){switch(e){case"sm":return"max-w-sm";case"lg":return"max-w-2xl";default:return"max-w-md"}}function x(e){switch(e){case"none":return"rounded-none";case"sm":return"rounded-sm";case"md":return"rounded-md";case"xl":return"rounded-xl";case"full":return"rounded-3xl";default:return"rounded-lg"}}function P(e){switch(e){case"none":return"";case"sm":return"p-2";case"lg":return"p-6";default:return""}}function y({variant:e="default",size:o="md",rounded:n="lg",padding:a="none",bgColor:t,borderColor:l,shadowColor:i,hoverable:u=!1,clickable:s=!1,as:c="div",className:g,children:m,onClick:d,...f}){let p=c,C=u?"transition-all duration-200 hover:shadow-lg hover:-translate-y-0.5":"",h=s?"cursor-pointer active:scale-[0.98] transition-transform":"",b=i||"";return R(p,{className:r("overflow-hidden",v(e,l,t),w(o),x(n),P(a),C,h,b,g),onClick:s||d?d:void 0,...f,children:m})}y.displayName="Card";export{y as Card};
1
+ import{cn as r}from"../../lib/cn.js";import{jsx as R}from"react/jsx-runtime";function v(e,o,n){let a=n||"bg-white dark:bg-gray-800",t=o||"border-gray-200 dark:border-gray-700";switch(e){case"outlined":return r("border-2 bg-transparent",t);case"elevated":return r("shadow-lg border-0",a);case"filled":return r(n||"bg-gray-100 dark:bg-gray-700","border-0");default:return r("border",t,a)}}function w(e){switch(e){case"sm":return"max-w-sm";case"lg":return"max-w-2xl";default:return"max-w-md"}}function x(e){switch(e){case"none":return"rounded-none";case"sm":return"rounded-sm";case"md":return"rounded-md";case"xl":return"rounded-xl";case"full":return"rounded-3xl";default:return"rounded-lg"}}function P(e){switch(e){case"none":return"";case"sm":return"p-2";case"md":return"p-4";case"lg":return"p-6";default:return""}}function y({variant:e="default",size:o="md",rounded:n="lg",padding:a="none",bgColor:t,borderColor:l,shadowColor:i,hoverable:u=!1,clickable:s=!1,as:c="div",className:g,children:m,onClick:d,...f}){let p=c,C=u?"transition-all duration-200 hover:shadow-lg hover:-translate-y-0.5":"",h=s?"cursor-pointer active:scale-[0.98] transition-transform":"",b=i||"";return R(p,{className:r("overflow-hidden",v(e,l,t),w(o),x(n),P(a),C,h,b,g),onClick:s||d?d:void 0,...f,children:m})}y.displayName="Card";export{y as Card};
@@ -1 +1 @@
1
- "use strict";var k=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var D=(t,r)=>{for(var e in r)k(t,e,{get:r[e],enumerable:!0})},$=(t,r,e,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of v(r))!M.call(t,a)&&a!==e&&k(t,a,{get:()=>r[a],enumerable:!(l=_(r,a))||l.enumerable});return t};var w=t=>$(k({},"__esModule",{value:!0}),t);var L={};D(L,{ChartAnnotationLayer:()=>E,describeAnnotations:()=>G});module.exports=w(L);var m=require("./utils/text.cjs"),n=require("react/jsx-runtime"),A=10,C=15,x=5,h=6,b=4,B=.1;function P({x:t,y:r,text:e,align:l}){let a=(0,m.estimateTextWidth)(e,A)+x*2,y=l==="start"?t:t-a;return(0,n.jsxs)("g",{children:[(0,n.jsx)("rect",{x:y,y:r,width:a,height:C,rx:3,className:"fill-white stroke-gray-200 dark:fill-gray-800 dark:stroke-gray-700",strokeWidth:1}),(0,n.jsx)("text",{x:y+x,y:r+C/2,dominantBaseline:"central",className:"fill-gray-600 text-[10px] dark:fill-gray-300",children:e})]})}function E({annotations:t,xAt:r,yAt:e,width:l,height:a,bandwidth:y=0,layer:O="over"}){if(t.length===0)return null;if(O==="under"){let o=t.filter(s=>s.type==="band");return o.length===0?null:(0,n.jsx)("g",{"aria-hidden":"true",children:o.map((s,i)=>{let d=r(s.from),c=r(s.to);if(d===null||c===null)return null;let u=Math.max(0,Math.min(d,c)-y/2),g=Math.min(l,Math.max(d,c)+y/2)-u;if(g<=0)return null;let f=s.label??"",p=(0,m.estimateTextWidth)(f,A)+x*2;return(0,n.jsxs)("g",{children:[(0,n.jsx)("rect",{x:u,y:0,width:g,height:a,fill:s.color??"var(--color-chart-muted)",opacity:B}),f&&p<=g?(0,n.jsx)(P,{x:u+2,y:2,text:f,align:"start"}):null]},`band-${i}`)})})}let N=t.filter(o=>o.type!=="band");return N.length===0?null:(0,n.jsx)("g",{"aria-hidden":"true",children:N.map((o,s)=>{let i=r(o.x);if(i===null)return null;let d=o.color??"var(--color-chart-muted)";if(o.type==="line"){let p=o.label??"",W=(0,m.estimateTextWidth)(p,A)+x*2,T=i+h+W<=l?"start":"end";return(0,n.jsxs)("g",{children:[(0,n.jsx)("line",{x1:i,y1:0,x2:i,y2:a,stroke:d,strokeWidth:1,strokeDasharray:o.dashed===!1?void 0:"3 3"}),p?(0,n.jsx)(P,{x:T==="start"?i+h:i-h,y:2,text:p,align:T}):null]},`line-${s}`)}let c=e(o.y);if(!Number.isFinite(c))return null;let u=o.label??"",I=(0,m.estimateTextWidth)(u,A)+x*2,g=i+b+h+I<=l?"start":"end",f=Math.min(Math.max(0,c-C-h),a-C);return(0,n.jsxs)("g",{children:[(0,n.jsx)("circle",{cx:i,cy:c,r:b,fill:"none",stroke:d,strokeWidth:2}),u?(0,n.jsx)(P,{x:g==="start"?i+b+h:i-b-h,y:f,text:u,align:g}):null]},`point-${s}`)})})}function G(t,r){if(!t||t.length===0)return"";let e=t.map(l=>l.label).filter(l=>!!l);return e.length===0?"":`${r}: ${e.join(", ")}`}0&&(module.exports={ChartAnnotationLayer,describeAnnotations});
1
+ "use strict";var N=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var $=(t,r)=>{for(var e in r)N(t,e,{get:r[e],enumerable:!0})},w=(t,r,e,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of M(r))!D.call(t,l)&&l!==e&&N(t,l,{get:()=>r[l],enumerable:!(i=_(r,l))||i.enumerable});return t};var B=t=>w(N({},"__esModule",{value:!0}),t);var V={};$(V,{ChartAnnotationLayer:()=>G,describeAnnotations:()=>L});module.exports=B(V);var m=require("./utils/text.cjs"),n=require("react/jsx-runtime"),A=10,C=15,x=5,d=6,b=4,E=.1;function I({x:t,y:r,text:e,align:i}){let l=(0,m.estimateTextWidth)(e,A)+x*2,g=i==="start"?t:t-l;return(0,n.jsxs)("g",{children:[(0,n.jsx)("rect",{x:g,y:r,width:l,height:C,rx:3,className:"fill-white stroke-gray-200 dark:fill-gray-800 dark:stroke-gray-700",strokeWidth:1}),(0,n.jsx)("text",{x:g+x,y:r+C/2,dominantBaseline:"central",className:"fill-gray-600 text-[10px] dark:fill-gray-300",children:e})]})}function G({annotations:t,xAt:r,spanAt:e,yAt:i,width:l,height:g,bandwidth:T=0,layer:W="over"}){if(t.length===0)return null;if(W==="under"){let a=t.filter(s=>s.type==="band");return a.length===0?null:(0,n.jsx)("g",{"aria-hidden":"true",children:a.map((s,o)=>{let p=e??r,c=p(s.from),u=p(s.to);if(c===null||u===null)return null;let y=Math.max(0,Math.min(c,u)-T/2),f=Math.min(l,Math.max(c,u)+T/2)-y;if(f<=0)return null;let h=s.label??"",P=(0,m.estimateTextWidth)(h,A)+x*2;return(0,n.jsxs)("g",{children:[(0,n.jsx)("rect",{x:y,y:0,width:f,height:g,fill:s.color??"var(--color-chart-muted)",opacity:E}),h&&P<=f?(0,n.jsx)(I,{x:y+2,y:2,text:h,align:"start"}):null]},`band-${o}`)})})}let v=t.filter(a=>a.type!=="band");return v.length===0?null:(0,n.jsx)("g",{"aria-hidden":"true",children:v.map((a,s)=>{let o=r(a.x);if(o===null)return null;let p=a.color??"var(--color-chart-muted)";if(a.type==="line"){let h=a.label??"",P=(0,m.estimateTextWidth)(h,A)+x*2,O=o+d+P<=l?"start":"end";return(0,n.jsxs)("g",{children:[(0,n.jsx)("line",{x1:o,y1:0,x2:o,y2:g,stroke:p,strokeWidth:1,strokeDasharray:a.dashed===!1?void 0:"3 3"}),h?(0,n.jsx)(I,{x:O==="start"?o+d:o-d,y:2,text:h,align:O}):null]},`line-${s}`)}let c=i(a.y);if(!Number.isFinite(c))return null;let u=a.label??"",y=(0,m.estimateTextWidth)(u,A)+x*2,k=o+b+d+y<=l?"start":"end",f=Math.min(Math.max(0,c-C-d),g-C);return(0,n.jsxs)("g",{children:[(0,n.jsx)("circle",{cx:o,cy:c,r:b,fill:"none",stroke:p,strokeWidth:2}),u?(0,n.jsx)(I,{x:k==="start"?o+b+d:o-b-d,y:f,text:u,align:k}):null]},`point-${s}`)})})}function L(t,r){if(!t||t.length===0)return"";let e=t.map(i=>i.label).filter(i=>!!i);return e.length===0?"":`${r}: ${e.join(", ")}`}0&&(module.exports={ChartAnnotationLayer,describeAnnotations});
@@ -1 +1 @@
1
- import{estimateTextWidth as b}from"./utils/text.js";import{jsx as e,jsxs as C}from"react/jsx-runtime";var A=10,k=15,m=5,u=6,x=4,_=.1;function P({x:n,y:o,text:i,align:l}){let h=b(i,A)+m*2,y=l==="start"?n:n-h;return C("g",{children:[e("rect",{x:y,y:o,width:h,height:k,rx:3,className:"fill-white stroke-gray-200 dark:fill-gray-800 dark:stroke-gray-700",strokeWidth:1}),e("text",{x:y+m,y:o+k/2,dominantBaseline:"central",className:"fill-gray-600 text-[10px] dark:fill-gray-300",children:i})]})}function M({annotations:n,xAt:o,yAt:i,width:l,height:h,bandwidth:y=0,layer:O="over"}){if(n.length===0)return null;if(O==="under"){let t=n.filter(a=>a.type==="band");return t.length===0?null:e("g",{"aria-hidden":"true",children:t.map((a,r)=>{let d=o(a.from),s=o(a.to);if(d===null||s===null)return null;let c=Math.max(0,Math.min(d,s)-y/2),g=Math.min(l,Math.max(d,s)+y/2)-c;if(g<=0)return null;let f=a.label??"",p=b(f,A)+m*2;return C("g",{children:[e("rect",{x:c,y:0,width:g,height:h,fill:a.color??"var(--color-chart-muted)",opacity:_}),f&&p<=g?e(P,{x:c+2,y:2,text:f,align:"start"}):null]},`band-${r}`)})})}let N=n.filter(t=>t.type!=="band");return N.length===0?null:e("g",{"aria-hidden":"true",children:N.map((t,a)=>{let r=o(t.x);if(r===null)return null;let d=t.color??"var(--color-chart-muted)";if(t.type==="line"){let p=t.label??"",W=b(p,A)+m*2,T=r+u+W<=l?"start":"end";return C("g",{children:[e("line",{x1:r,y1:0,x2:r,y2:h,stroke:d,strokeWidth:1,strokeDasharray:t.dashed===!1?void 0:"3 3"}),p?e(P,{x:T==="start"?r+u:r-u,y:2,text:p,align:T}):null]},`line-${a}`)}let s=i(t.y);if(!Number.isFinite(s))return null;let c=t.label??"",I=b(c,A)+m*2,g=r+x+u+I<=l?"start":"end",f=Math.min(Math.max(0,s-k-u),h-k);return C("g",{children:[e("circle",{cx:r,cy:s,r:x,fill:"none",stroke:d,strokeWidth:2}),c?e(P,{x:g==="start"?r+x+u:r-x-u,y:f,text:c,align:g}):null]},`point-${a}`)})})}function D(n,o){if(!n||n.length===0)return"";let i=n.map(l=>l.label).filter(l=>!!l);return i.length===0?"":`${o}: ${i.join(", ")}`}export{M as ChartAnnotationLayer,D as describeAnnotations};
1
+ import{estimateTextWidth as b}from"./utils/text.js";import{jsx as e,jsxs as C}from"react/jsx-runtime";var A=10,k=15,m=5,h=6,x=4,_=.1;function I({x:n,y:a,text:o,align:i}){let d=b(o,A)+m*2,g=i==="start"?n:n-d;return C("g",{children:[e("rect",{x:g,y:a,width:d,height:k,rx:3,className:"fill-white stroke-gray-200 dark:fill-gray-800 dark:stroke-gray-700",strokeWidth:1}),e("text",{x:g+m,y:a+k/2,dominantBaseline:"central",className:"fill-gray-600 text-[10px] dark:fill-gray-300",children:o})]})}function D({annotations:n,xAt:a,spanAt:o,yAt:i,width:d,height:g,bandwidth:T=0,layer:W="over"}){if(n.length===0)return null;if(W==="under"){let t=n.filter(l=>l.type==="band");return t.length===0?null:e("g",{"aria-hidden":"true",children:t.map((l,r)=>{let p=o??a,s=p(l.from),c=p(l.to);if(s===null||c===null)return null;let y=Math.max(0,Math.min(s,c)-T/2),f=Math.min(d,Math.max(s,c)+T/2)-y;if(f<=0)return null;let u=l.label??"",N=b(u,A)+m*2;return C("g",{children:[e("rect",{x:y,y:0,width:f,height:g,fill:l.color??"var(--color-chart-muted)",opacity:_}),u&&N<=f?e(I,{x:y+2,y:2,text:u,align:"start"}):null]},`band-${r}`)})})}let v=n.filter(t=>t.type!=="band");return v.length===0?null:e("g",{"aria-hidden":"true",children:v.map((t,l)=>{let r=a(t.x);if(r===null)return null;let p=t.color??"var(--color-chart-muted)";if(t.type==="line"){let u=t.label??"",N=b(u,A)+m*2,O=r+h+N<=d?"start":"end";return C("g",{children:[e("line",{x1:r,y1:0,x2:r,y2:g,stroke:p,strokeWidth:1,strokeDasharray:t.dashed===!1?void 0:"3 3"}),u?e(I,{x:O==="start"?r+h:r-h,y:2,text:u,align:O}):null]},`line-${l}`)}let s=i(t.y);if(!Number.isFinite(s))return null;let c=t.label??"",y=b(c,A)+m*2,P=r+x+h+y<=d?"start":"end",f=Math.min(Math.max(0,s-k-h),g-k);return C("g",{children:[e("circle",{cx:r,cy:s,r:x,fill:"none",stroke:p,strokeWidth:2}),c?e(I,{x:P==="start"?r+x+h:r-x-h,y:f,text:c,align:P}):null]},`point-${l}`)})})}function $(n,a){if(!n||n.length===0)return"";let o=n.map(i=>i.label).filter(i=>!!i);return o.length===0?"":`${a}: ${o.join(", ")}`}export{D as ChartAnnotationLayer,$ as describeAnnotations};
@@ -1 +1 @@
1
- "use strict";"use client";var P=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var M=(n,o)=>{for(var t in o)P(n,t,{get:o[t],enumerable:!0})},O=(n,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let l of I(o))!K.call(n,l)&&l!==t&&P(n,l,{get:()=>o[l],enumerable:!(i=A(o,l))||i.enumerable});return n};var U=n=>O(P({},"__esModule",{value:!0}),n);var H={};M(H,{ChartBrushLayer:()=>N,useChartBrush:()=>X});module.exports=U(H);var u=require("react"),b=require("./utils/keyboard.cjs"),x=require("./utils/scales.cjs"),E=require("react/jsx-runtime"),T=4,L=.14;function N({from:n,to:o,width:t,height:i,orientation:l="vertical",live:p=!1,label:s}){let y=Math.max(0,Math.min(n,o)),d=Math.min(l==="vertical"?t:i,Math.max(n,o)),h=d-y;if(h<=0)return null;let f=l==="vertical",g=f?{x:y,y:0,width:h,height:i}:{x:0,y,width:t,height:h},m=a=>f?{x1:a,y1:0,x2:a,y2:i}:{x1:0,y1:a,x2:t,y2:a};return(0,E.jsxs)("g",{"aria-hidden":s?void 0:"true",role:s?"img":void 0,"aria-label":s,children:[(0,E.jsx)("rect",{...g,className:"fill-synertech-primary-500",opacity:L}),[y,d].map(a=>(0,E.jsx)("line",{...m(a),className:"stroke-synertech-primary-600 dark:stroke-synertech-primary-400",strokeWidth:1.5,strokeDasharray:p?"3 3":void 0},a))]})}function X({enabled:n,active:o,centers:t,xValues:i,offset:l,orientation:p,onCommit:s}){let[y,d]=(0,u.useState)(null),h=(0,u.useRef)(null),f=(0,u.useRef)(!1),g=(0,u.useRef)(!1),m=(0,u.useRef)(null),a=(0,u.useCallback)((r,e)=>{let[c,C]=r<=e?[r,e]:[e,r];return{from:i[c],to:i[C],fromIndex:c,toIndex:C}},[i]),R=(0,u.useCallback)(r=>{let e=r.currentTarget.getBoundingClientRect();return p==="vertical"?r.clientX-e.left-l:r.clientY-e.top-l},[p,l]),G=(0,u.useCallback)(r=>{if(!n||t.length===0||r.button!==0)return;let e=R(r),c=(0,x.nearestIndex)(t,e);c<0||(h.current={index:c,pixel:e},f.current=!1,g.current=!1,r.currentTarget.setPointerCapture?.(r.pointerId))},[n,t,R]),V=(0,u.useCallback)(r=>{let e=h.current;if(!n||!e)return;let c=R(r);!f.current&&Math.abs(c-e.pixel)<T||(f.current=!0,d(a(e.index,(0,x.nearestIndex)(t,c))))},[n,t,R,a]),v=(0,u.useCallback)(r=>{let e=h.current;if(h.current=null,!n||!e)return;if(r.currentTarget.hasPointerCapture?.(r.pointerId)&&r.currentTarget.releasePointerCapture?.(r.pointerId),!f.current){d(null),o&&s(null);return}g.current=!0,f.current=!1;let c=a(e.index,(0,x.nearestIndex)(t,R(r)));d(null),m.current=c.fromIndex,s(c)},[n,o,t,R,a,s]),B=(0,u.useCallback)((r,e)=>{if(!n||t.length===0)return;if(r.key==="Escape"){m.current=null,d(null),o&&s(null);return}if(!r.shiftKey){m.current=null;return}let c=p==="vertical",C=c?"ArrowRight":"ArrowDown",w=c?"ArrowLeft":"ArrowUp";if(r.key!==C&&r.key!==w)return;if(e===null){m.current=null;return}let D=(0,b.stepChartCursor)(e,r.key===C?1:-1,t.length),S=m.current??e;m.current=S,s(a(S,D))},[n,o,t.length,p,a,s]),k=(0,u.useCallback)(()=>{let r=g.current;return g.current=!1,r},[]);return{dragging:y,onPointerDown:G,onPointerMove:V,onPointerUp:v,onKeyDown:B,consumedClick:k}}0&&(module.exports={ChartBrushLayer,useChartBrush});
1
+ "use strict";"use client";var V=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var O=(e,r)=>{for(var n in r)V(e,n,{get:r[n],enumerable:!0})},X=(e,r,n,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of T(r))!K.call(e,o)&&o!==n&&V(e,o,{get:()=>r[o],enumerable:!(l=M(r,o))||l.enumerable});return e};var N=e=>X(V({},"__esModule",{value:!0}),e);var q={};O(q,{ChartBrushLayer:()=>L,locateBrush:()=>_,useChartBrush:()=>W});module.exports=N(q);var c=require("react"),k=require("./utils/keyboard.cjs"),R=require("./utils/scales.cjs"),G=require("./utils/timestamp.cjs"),P=require("react/jsx-runtime"),U=4,Y=.14;function L({from:e,to:r,width:n,height:l,orientation:o="vertical",live:a=!1,label:s,minSpan:f=0}){let C=o==="vertical"?n:l,p=Math.min(e,r),m=Math.max(e,r);if(m-p<f){let h=(p+m)/2;p=h-f/2,m=h+f/2}let y=Math.max(0,p),g=Math.min(C,m),d=g-y;if(d<=0)return null;let b=o==="vertical",S=b?{x:y,y:0,width:d,height:l}:{x:0,y,width:n,height:d},B=h=>b?{x1:h,y1:0,x2:h,y2:l}:{x1:0,y1:h,x2:n,y2:h};return(0,P.jsxs)("g",{"aria-hidden":s?void 0:"true",role:s?"img":void 0,"aria-label":s,children:[(0,P.jsx)("rect",{...S,className:"fill-synertech-primary-500",opacity:Y}),[y,g].map(h=>(0,P.jsx)("line",{...B(h),className:"stroke-synertech-primary-600 dark:stroke-synertech-primary-400",strokeWidth:1.5,strokeDasharray:a?"3 3":void 0},h))]})}function _(e,r,n,l){let o=(f,C)=>f>=0&&f<r.length&&(0,R.toKey)(r[f])===(0,R.toKey)(C)?n[f]:null,a=o(e.fromIndex,e.from)??l(e.from),s=o(e.toIndex,e.to)??l(e.to);return a===null||s===null?null:{from:a,to:s}}function F(e,r){let n=r-e;if(!(n>0))return Number.NaN;let o=n/864e5,a=new Date(r),s=o>=28&&o<=31?1:o>=89&&o<=92?3:0;return s>0?(a.setMonth(a.getMonth()+s),a.getTime()):o>=365&&o<=366?(a.setFullYear(a.getFullYear()+1),a.getTime()):r+n}function H(e,r){let n=(0,G.toTimestamp)(e[r]);if(n===null)return;if(r+1<e.length)return(0,G.toTimestamp)(e[r+1])===null?void 0:e[r+1];if(r<1)return;let l=(0,G.toTimestamp)(e[r-1]);if(l===null)return;let o=F(l,n);return Number.isFinite(o)?new Date(o):void 0}function W({enabled:e,active:r,centers:n,xValues:l,offset:o,orientation:a,onCommit:s}){let[f,C]=(0,c.useState)(null),p=(0,c.useRef)(null),m=(0,c.useRef)(!1),y=(0,c.useRef)(!1),g=(0,c.useRef)(null),d=(0,c.useCallback)((t,u)=>{let[i,E]=t<=u?[t,u]:[u,t],v=H(l,E);return{from:l[i],to:l[E],fromIndex:i,toIndex:E,...v===void 0?{}:{end:v}}},[l]),b=(0,c.useCallback)(t=>{let u=t.currentTarget.getBoundingClientRect();return a==="vertical"?t.clientX-u.left-o:t.clientY-u.top-o},[a,o]),S=(0,c.useCallback)(t=>{if(!e||n.length===0||t.button!==0)return;let u=b(t),i=(0,R.nearestIndex)(n,u);i<0||(p.current={index:i,pixel:u},m.current=!1,y.current=!1,t.currentTarget.setPointerCapture?.(t.pointerId))},[e,n,b]),B=(0,c.useCallback)(t=>{let u=p.current;if(!e||!u)return;let i=b(t);!m.current&&Math.abs(i-u.pixel)<U||(m.current=!0,C(d(u.index,(0,R.nearestIndex)(n,i))))},[e,n,b,d]),h=(0,c.useCallback)(t=>{let u=p.current;if(p.current=null,!e||!u)return;if(t.currentTarget.hasPointerCapture?.(t.pointerId)&&t.currentTarget.releasePointerCapture?.(t.pointerId),!m.current){C(null),r&&s(null);return}y.current=!0,m.current=!1;let i=d(u.index,(0,R.nearestIndex)(n,b(t)));C(null),g.current=i.fromIndex,s(i)},[e,r,n,b,d,s]),D=(0,c.useCallback)((t,u)=>{if(!e||n.length===0)return!1;if(t.key==="Escape"){g.current=null;let I=r||f!==null;return C(null),r&&s(null),I}if(!t.shiftKey)return g.current=null,!1;let i=a==="vertical",E=i?"ArrowRight":"ArrowDown",v=i?"ArrowLeft":"ArrowUp";if(t.key!==E&&t.key!==v)return!1;if(u===null)return g.current=null,!1;let A=(0,k.stepChartCursor)(u,t.key===E?1:-1,n.length),w=g.current??u;return g.current=w,s(d(w,A)),!1},[e,r,f,n.length,a,d,s]),x=(0,c.useCallback)(()=>{let t=y.current;return y.current=!1,t},[]);return{dragging:f,onPointerDown:S,onPointerMove:B,onPointerUp:h,onKeyDown:D,consumedClick:x}}0&&(module.exports={ChartBrushLayer,locateBrush,useChartBrush});
@@ -1 +1 @@
1
- "use client";import{useCallback as m,useRef as E,useState as D}from"react";import{stepChartCursor as A}from"./utils/keyboard.js";import{nearestIndex as x}from"./utils/scales.js";import{jsx as S,jsxs as M}from"react/jsx-runtime";var I=4,K=.14;function L({from:u,to:s,width:n,height:h,orientation:d="vertical",live:p=!1,label:a}){let y=Math.max(0,Math.min(u,s)),f=Math.min(d==="vertical"?n:h,Math.max(u,s)),c=f-y;if(c<=0)return null;let l=d==="vertical",g=l?{x:y,y:0,width:c,height:h}:{x:0,y,width:n,height:c},i=t=>l?{x1:t,y1:0,x2:t,y2:h}:{x1:0,y1:t,x2:n,y2:t};return M("g",{"aria-hidden":a?void 0:"true",role:a?"img":void 0,"aria-label":a,children:[S("rect",{...g,className:"fill-synertech-primary-500",opacity:K}),[y,f].map(t=>S("line",{...i(t),className:"stroke-synertech-primary-600 dark:stroke-synertech-primary-400",strokeWidth:1.5,strokeDasharray:p?"3 3":void 0},t))]})}function N({enabled:u,active:s,centers:n,xValues:h,offset:d,orientation:p,onCommit:a}){let[y,f]=D(null),c=E(null),l=E(!1),g=E(!1),i=E(null),t=m((r,e)=>{let[o,C]=r<=e?[r,e]:[e,r];return{from:h[o],to:h[C],fromIndex:o,toIndex:C}},[h]),R=m(r=>{let e=r.currentTarget.getBoundingClientRect();return p==="vertical"?r.clientX-e.left-d:r.clientY-e.top-d},[p,d]),b=m(r=>{if(!u||n.length===0||r.button!==0)return;let e=R(r),o=x(n,e);o<0||(c.current={index:o,pixel:e},l.current=!1,g.current=!1,r.currentTarget.setPointerCapture?.(r.pointerId))},[u,n,R]),G=m(r=>{let e=c.current;if(!u||!e)return;let o=R(r);!l.current&&Math.abs(o-e.pixel)<I||(l.current=!0,f(t(e.index,x(n,o))))},[u,n,R,t]),V=m(r=>{let e=c.current;if(c.current=null,!u||!e)return;if(r.currentTarget.hasPointerCapture?.(r.pointerId)&&r.currentTarget.releasePointerCapture?.(r.pointerId),!l.current){f(null),s&&a(null);return}g.current=!0,l.current=!1;let o=t(e.index,x(n,R(r)));f(null),i.current=o.fromIndex,a(o)},[u,s,n,R,t,a]),v=m((r,e)=>{if(!u||n.length===0)return;if(r.key==="Escape"){i.current=null,f(null),s&&a(null);return}if(!r.shiftKey){i.current=null;return}let o=p==="vertical",C=o?"ArrowRight":"ArrowDown",k=o?"ArrowLeft":"ArrowUp";if(r.key!==C&&r.key!==k)return;if(e===null){i.current=null;return}let w=A(e,r.key===C?1:-1,n.length),P=i.current??e;i.current=P,a(t(P,w))},[u,s,n.length,p,t,a]),B=m(()=>{let r=g.current;return g.current=!1,r},[]);return{dragging:y,onPointerDown:b,onPointerMove:G,onPointerUp:V,onKeyDown:v,consumedClick:B}}export{L as ChartBrushLayer,N as useChartBrush};
1
+ "use client";import{useCallback as C,useRef as P,useState as M}from"react";import{stepChartCursor as T}from"./utils/keyboard.js";import{nearestIndex as S,toKey as w}from"./utils/scales.js";import{toTimestamp as B}from"./utils/timestamp.js";import{jsx as k,jsxs as U}from"react/jsx-runtime";var K=4,O=.14;function H({from:r,to:t,width:n,height:s,orientation:u="vertical",live:l=!1,label:a,minSpan:i=0}){let b=u==="vertical"?n:s,d=Math.min(r,t),h=Math.max(r,t);if(h-d<i){let f=(d+h)/2;d=f-i/2,h=f+i/2}let p=Math.max(0,d),y=Math.min(b,h),m=y-p;if(m<=0)return null;let g=u==="vertical",v=g?{x:p,y:0,width:m,height:s}:{x:0,y:p,width:n,height:m},G=f=>g?{x1:f,y1:0,x2:f,y2:s}:{x1:0,y1:f,x2:n,y2:f};return U("g",{"aria-hidden":a?void 0:"true",role:a?"img":void 0,"aria-label":a,children:[k("rect",{...v,className:"fill-synertech-primary-500",opacity:O}),[p,y].map(f=>k("line",{...G(f),className:"stroke-synertech-primary-600 dark:stroke-synertech-primary-400",strokeWidth:1.5,strokeDasharray:l?"3 3":void 0},f))]})}function W(r,t,n,s){let u=(i,b)=>i>=0&&i<t.length&&w(t[i])===w(b)?n[i]:null,l=u(r.fromIndex,r.from)??s(r.from),a=u(r.toIndex,r.to)??s(r.to);return l===null||a===null?null:{from:l,to:a}}function X(r,t){let n=t-r;if(!(n>0))return Number.NaN;let u=n/864e5,l=new Date(t),a=u>=28&&u<=31?1:u>=89&&u<=92?3:0;return a>0?(l.setMonth(l.getMonth()+a),l.getTime()):u>=365&&u<=366?(l.setFullYear(l.getFullYear()+1),l.getTime()):t+n}function N(r,t){let n=B(r[t]);if(n===null)return;if(t+1<r.length)return B(r[t+1])===null?void 0:r[t+1];if(t<1)return;let s=B(r[t-1]);if(s===null)return;let u=X(s,n);return Number.isFinite(u)?new Date(u):void 0}function q({enabled:r,active:t,centers:n,xValues:s,offset:u,orientation:l,onCommit:a}){let[i,b]=M(null),d=P(null),h=P(!1),p=P(!1),y=P(null),m=C((e,o)=>{let[c,R]=e<=o?[e,o]:[o,e],E=N(s,R);return{from:s[c],to:s[R],fromIndex:c,toIndex:R,...E===void 0?{}:{end:E}}},[s]),g=C(e=>{let o=e.currentTarget.getBoundingClientRect();return l==="vertical"?e.clientX-o.left-u:e.clientY-o.top-u},[l,u]),v=C(e=>{if(!r||n.length===0||e.button!==0)return;let o=g(e),c=S(n,o);c<0||(d.current={index:c,pixel:o},h.current=!1,p.current=!1,e.currentTarget.setPointerCapture?.(e.pointerId))},[r,n,g]),G=C(e=>{let o=d.current;if(!r||!o)return;let c=g(e);!h.current&&Math.abs(c-o.pixel)<K||(h.current=!0,b(m(o.index,S(n,c))))},[r,n,g,m]),f=C(e=>{let o=d.current;if(d.current=null,!r||!o)return;if(e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId),!h.current){b(null),t&&a(null);return}p.current=!0,h.current=!1;let c=m(o.index,S(n,g(e)));b(null),y.current=c.fromIndex,a(c)},[r,t,n,g,m,a]),D=C((e,o)=>{if(!r||n.length===0)return!1;if(e.key==="Escape"){y.current=null;let I=t||i!==null;return b(null),t&&a(null),I}if(!e.shiftKey)return y.current=null,!1;let c=l==="vertical",R=c?"ArrowRight":"ArrowDown",E=c?"ArrowLeft":"ArrowUp";if(e.key!==R&&e.key!==E)return!1;if(o===null)return y.current=null,!1;let A=T(o,e.key===R?1:-1,n.length),V=y.current??o;return y.current=V,a(m(V,A)),!1},[r,t,i,n.length,l,m,a]),x=C(()=>{let e=p.current;return p.current=!1,e},[]);return{dragging:i,onPointerDown:v,onPointerMove:G,onPointerUp:f,onKeyDown:D,consumedClick:x}}export{H as ChartBrushLayer,W as locateBrush,q as useChartBrush};
@@ -1 +1 @@
1
- "use strict";"use client";var g=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var X=(r,t)=>{for(var a in t)g(r,a,{get:t[a],enumerable:!0})},Y=(r,t,a,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of K(t))!Q.call(r,o)&&o!==a&&g(r,o,{get:()=>t[o],enumerable:!(l=J(t,o))||l.enumerable});return r};var _=r=>Y(g({},"__esModule",{value:!0}),r);var ae={};X(ae,{ChartContainer:()=>re});module.exports=_(ae);var c=require("react"),d=require("../../lib/cn.cjs"),I=require("../../lib/i18n.cjs"),T=require("../circular-progress/CircularProgress.cjs"),z=require("./useChartSize.cjs"),e=require("react/jsx-runtime"),ee=(0,e.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",className:"text-red-600 dark:text-red-400",children:[(0,e.jsx)("path",{d:"M10 3.5 2.5 16.5h15L10 3.5Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"}),(0,e.jsx)("path",{d:"M10 8v3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"10",cy:"14",r:"0.9",fill:"currentColor"})]}),te={sm:"text-xs",md:"text-sm",lg:"text-base"};function re({title:r,description:t,height:a=240,width:l,size:o="md",legend:i,legendPosition:u="bottom",actions:x,loading:n=!1,empty:y=!1,emptyState:A,error:f=!1,errorState:P,onRetry:v,errorLabel:j,errorHintLabel:H,retryLabel:W,table:m,tableView:w=!1,showTableLabel:B,hideTableLabel:D,noDataLabel:M,loadingLabel:O,ariaLabel:N,children:h,className:$,...U}){let s=(0,I.useUILabels)(),[p,V]=(0,c.useState)(!1),b=(0,c.useId)(),C=`${b}-table`,k=`${b}-title`,L=`${b}-description`,{ref:Z,width:q,measured:F}=(0,z.useChartSize)({width:l}),R=!!m&&w==="toggle",S=!!m&&(w===!0||R&&p),E=(0,e.jsx)("div",{ref:Z,className:"relative w-full",style:{height:a},"aria-busy":n||void 0,children:n&&(y||f)?(0,e.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,e.jsx)(T.CircularProgress,{indeterminate:!0,size:"md","aria-label":O??s.chartLoading})}):f&&!n?(0,e.jsx)("div",{role:"alert",className:"flex h-full w-full flex-col items-center justify-center gap-2 px-4 text-center",children:P??(0,e.jsxs)(e.Fragment,{children:[ee,(0,e.jsx)("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:j??s.chartError}),(0,e.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:H??s.chartErrorHint}),v?(0,e.jsx)("button",{type:"button",onClick:v,className:"mt-1 cursor-pointer rounded-md border border-gray-300 bg-white px-3 py-1.5 text-xs font-medium text-gray-700 transition-colors hover:bg-gray-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",children:W??s.chartRetry}):null]})}):y&&!n&&!f?(0,e.jsx)("div",{className:"flex h-full w-full items-center justify-center text-sm text-gray-500 dark:text-gray-400",children:A??M??s.chartNoData}):(0,e.jsx)("div",{className:(0,d.cn)("h-full w-full transition-opacity duration-200",n&&"opacity-60"),children:typeof h=="function"?h({width:q,height:a,measured:F}):h})});return(0,e.jsxs)("figure",{className:(0,d.cn)("flex w-full flex-col gap-3",$),"aria-label":N,"aria-labelledby":!N&&r?k:void 0,"aria-describedby":t?L:void 0,...U,children:[r||t||x?(0,e.jsxs)("figcaption",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-0.5",children:[r?(0,e.jsx)("span",{id:k,className:(0,d.cn)("font-semibold text-gray-900 dark:text-gray-100",te[o]),children:r}):null,t?(0,e.jsx)("span",{id:L,className:"text-xs text-gray-500 dark:text-gray-400",children:t}):null]}),x]}):null,i&&u==="top"?i:null,i&&u==="right"?(0,e.jsxs)("div",{className:"flex items-start gap-4",children:[(0,e.jsx)("div",{className:"min-w-0 grow",children:E}),i]}):E,i&&u==="bottom"?i:null,R&&(0,e.jsx)("div",{className:"flex",children:(0,e.jsx)("button",{type:"button",onClick:()=>V(G=>!G),"aria-expanded":p,"aria-controls":S?C:void 0,className:"cursor-pointer rounded-sm text-xs font-medium text-gray-600 underline underline-offset-2 hover:text-gray-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500 dark:text-gray-400 dark:hover:text-white",children:p?D??s.chartHideTable:B??s.chartShowTable})}),S&&(0,e.jsx)("div",{id:C,children:m})]})}0&&(module.exports={ChartContainer});
1
+ "use strict";"use client";var x=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var Y=Object.prototype.hasOwnProperty;var _=(r,t)=>{for(var a in t)x(r,a,{get:t[a],enumerable:!0})},ee=(r,t,a,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of X(t))!Y.call(r,o)&&o!==a&&x(r,o,{get:()=>t[o],enumerable:!(l=Q(t,o))||l.enumerable});return r};var te=r=>ee(x({},"__esModule",{value:!0}),r);var se={};_(se,{ChartContainer:()=>oe});module.exports=te(se);var c=require("react"),d=require("../../lib/cn.cjs"),P=require("../../lib/i18n.cjs"),I=require("../circular-progress/CircularProgress.cjs"),T=require("./exportSource.cjs"),z=require("./useChartSize.cjs"),e=require("react/jsx-runtime"),re=(0,e.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",className:"text-red-600 dark:text-red-400",children:[(0,e.jsx)("path",{d:"M10 3.5 2.5 16.5h15L10 3.5Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"}),(0,e.jsx)("path",{d:"M10 8v3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"10",cy:"14",r:"0.9",fill:"currentColor"})]}),ae={sm:"text-xs",md:"text-sm",lg:"text-base"};function oe({title:r,description:t,height:a=240,width:l,size:o="md",legend:i,legendPosition:u="bottom",actions:g,exportSource:A,loading:n=!1,empty:y=!1,emptyState:j,error:f=!1,errorState:H,onRetry:v,errorLabel:W,errorHintLabel:B,retryLabel:D,table:m,tableView:C=!1,showTableLabel:M,hideTableLabel:O,noDataLabel:$,loadingLabel:U,ariaLabel:w,children:h,className:V,...Z}){let s=(0,P.useUILabels)(),[p,q]=(0,c.useState)(!1),b=(0,c.useId)(),N=`${b}-table`,k=`${b}-title`,L=`${b}-description`,{ref:F,width:G,measured:J}=(0,z.useChartSize)({width:l}),R=!!m&&C==="toggle",S=!!m&&(C===!0||R&&p),E=(0,e.jsx)("div",{ref:F,className:"relative w-full",style:{height:a},"aria-busy":n||void 0,children:n&&(y||f)?(0,e.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,e.jsx)(I.CircularProgress,{indeterminate:!0,size:"md","aria-label":U??s.chartLoading})}):f&&!n?(0,e.jsx)("div",{role:"alert",className:"flex h-full w-full flex-col items-center justify-center gap-2 px-4 text-center",children:H??(0,e.jsxs)(e.Fragment,{children:[re,(0,e.jsx)("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:W??s.chartError}),(0,e.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:B??s.chartErrorHint}),v?(0,e.jsx)("button",{type:"button",onClick:v,className:"mt-1 cursor-pointer rounded-md border border-gray-300 bg-white px-3 py-1.5 text-xs font-medium text-gray-700 transition-colors hover:bg-gray-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",children:D??s.chartRetry}):null]})}):y&&!n&&!f?(0,e.jsx)("div",{className:"flex h-full w-full items-center justify-center text-sm text-gray-500 dark:text-gray-400",children:j??$??s.chartNoData}):(0,e.jsx)("div",{className:(0,d.cn)("h-full w-full transition-opacity duration-200",n&&"opacity-60"),children:typeof h=="function"?h({width:G,height:a,measured:J}):h})});return(0,e.jsxs)("figure",{className:(0,d.cn)("flex w-full flex-col gap-3",V),"aria-label":w,"aria-labelledby":!w&&r?k:void 0,"aria-describedby":t?L:void 0,...Z,children:[r||t||g?(0,e.jsxs)("figcaption",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-0.5",children:[r?(0,e.jsx)("span",{id:k,className:(0,d.cn)("font-semibold text-gray-900 dark:text-gray-100",ae[o]),children:r}):null,t?(0,e.jsx)("span",{id:L,className:"text-xs text-gray-500 dark:text-gray-400",children:t}):null]}),(0,e.jsx)(T.ChartExportContext.Provider,{value:A??null,children:g})]}):null,i&&u==="top"?i:null,i&&u==="right"?(0,e.jsxs)("div",{className:"flex items-start gap-4",children:[(0,e.jsx)("div",{className:"min-w-0 grow",children:E}),i]}):E,i&&u==="bottom"?i:null,R&&(0,e.jsx)("div",{className:"flex",children:(0,e.jsx)("button",{type:"button",onClick:()=>q(K=>!K),"aria-expanded":p,"aria-controls":S?N:void 0,className:"cursor-pointer rounded-sm text-xs font-medium text-gray-600 underline underline-offset-2 hover:text-gray-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500 dark:text-gray-400 dark:hover:text-white",children:p?O??s.chartHideTable:M??s.chartShowTable})}),S&&(0,e.jsx)("div",{id:N,children:m})]})}0&&(module.exports={ChartContainer});
@@ -1 +1 @@
1
- "use client";import{useId as Z,useState as q}from"react";import{cn as m}from"../../lib/cn.js";import{useUILabels as F}from"../../lib/i18n.js";import{CircularProgress as G}from"../circular-progress/CircularProgress.js";import{useChartSize as J}from"./useChartSize.js";import{Fragment as X,jsx as e,jsxs as a}from"react/jsx-runtime";var K=a("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",className:"text-red-600 dark:text-red-400",children:[e("path",{d:"M10 3.5 2.5 16.5h15L10 3.5Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"}),e("path",{d:"M10 8v3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e("circle",{cx:"10",cy:"14",r:"0.9",fill:"currentColor"})]}),Q={sm:"text-xs",md:"text-sm",lg:"text-base"};function ie({title:s,description:i,height:h=240,width:R,size:S="md",legend:r,legendPosition:n="bottom",actions:p,loading:o=!1,empty:b=!1,emptyState:E,error:l=!1,errorState:I,onRetry:g,errorLabel:T,errorHintLabel:z,retryLabel:A,table:d,tableView:x=!1,showTableLabel:P,hideTableLabel:j,noDataLabel:H,loadingLabel:W,ariaLabel:y,children:c,className:B,...D}){let t=F(),[u,M]=q(!1),f=Z(),v=`${f}-table`,w=`${f}-title`,N=`${f}-description`,{ref:O,width:$,measured:U}=J({width:R}),C=!!d&&x==="toggle",k=!!d&&(x===!0||C&&u),L=e("div",{ref:O,className:"relative w-full",style:{height:h},"aria-busy":o||void 0,children:o&&(b||l)?e("div",{className:"flex h-full w-full items-center justify-center",children:e(G,{indeterminate:!0,size:"md","aria-label":W??t.chartLoading})}):l&&!o?e("div",{role:"alert",className:"flex h-full w-full flex-col items-center justify-center gap-2 px-4 text-center",children:I??a(X,{children:[K,e("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:T??t.chartError}),e("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:z??t.chartErrorHint}),g?e("button",{type:"button",onClick:g,className:"mt-1 cursor-pointer rounded-md border border-gray-300 bg-white px-3 py-1.5 text-xs font-medium text-gray-700 transition-colors hover:bg-gray-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",children:A??t.chartRetry}):null]})}):b&&!o&&!l?e("div",{className:"flex h-full w-full items-center justify-center text-sm text-gray-500 dark:text-gray-400",children:E??H??t.chartNoData}):e("div",{className:m("h-full w-full transition-opacity duration-200",o&&"opacity-60"),children:typeof c=="function"?c({width:$,height:h,measured:U}):c})});return a("figure",{className:m("flex w-full flex-col gap-3",B),"aria-label":y,"aria-labelledby":!y&&s?w:void 0,"aria-describedby":i?N:void 0,...D,children:[s||i||p?a("figcaption",{className:"flex items-start justify-between gap-3",children:[a("div",{className:"flex flex-col gap-0.5",children:[s?e("span",{id:w,className:m("font-semibold text-gray-900 dark:text-gray-100",Q[S]),children:s}):null,i?e("span",{id:N,className:"text-xs text-gray-500 dark:text-gray-400",children:i}):null]}),p]}):null,r&&n==="top"?r:null,r&&n==="right"?a("div",{className:"flex items-start gap-4",children:[e("div",{className:"min-w-0 grow",children:L}),r]}):L,r&&n==="bottom"?r:null,C&&e("div",{className:"flex",children:e("button",{type:"button",onClick:()=>M(V=>!V),"aria-expanded":u,"aria-controls":k?v:void 0,className:"cursor-pointer rounded-sm text-xs font-medium text-gray-600 underline underline-offset-2 hover:text-gray-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500 dark:text-gray-400 dark:hover:text-white",children:u?j??t.chartHideTable:P??t.chartShowTable})}),k&&e("div",{id:v,children:d})]})}export{ie as ChartContainer};
1
+ "use client";import{useId as q,useState as F}from"react";import{cn as m}from"../../lib/cn.js";import{useUILabels as G}from"../../lib/i18n.js";import{CircularProgress as J}from"../circular-progress/CircularProgress.js";import{ChartExportContext as K}from"./exportSource.js";import{useChartSize as Q}from"./useChartSize.js";import{Fragment as _,jsx as e,jsxs as a}from"react/jsx-runtime";var X=a("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",className:"text-red-600 dark:text-red-400",children:[e("path",{d:"M10 3.5 2.5 16.5h15L10 3.5Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"}),e("path",{d:"M10 8v3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e("circle",{cx:"10",cy:"14",r:"0.9",fill:"currentColor"})]}),Y={sm:"text-xs",md:"text-sm",lg:"text-base"};function de({title:s,description:i,height:h=240,width:R,size:S="md",legend:r,legendPosition:n="bottom",actions:p,exportSource:E,loading:o=!1,empty:b=!1,emptyState:P,error:l=!1,errorState:I,onRetry:x,errorLabel:T,errorHintLabel:z,retryLabel:A,table:d,tableView:g=!1,showTableLabel:j,hideTableLabel:H,noDataLabel:W,loadingLabel:B,ariaLabel:y,children:c,className:D,...M}){let t=G(),[u,O]=F(!1),f=q(),v=`${f}-table`,C=`${f}-title`,w=`${f}-description`,{ref:$,width:U,measured:V}=Q({width:R}),N=!!d&&g==="toggle",k=!!d&&(g===!0||N&&u),L=e("div",{ref:$,className:"relative w-full",style:{height:h},"aria-busy":o||void 0,children:o&&(b||l)?e("div",{className:"flex h-full w-full items-center justify-center",children:e(J,{indeterminate:!0,size:"md","aria-label":B??t.chartLoading})}):l&&!o?e("div",{role:"alert",className:"flex h-full w-full flex-col items-center justify-center gap-2 px-4 text-center",children:I??a(_,{children:[X,e("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:T??t.chartError}),e("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:z??t.chartErrorHint}),x?e("button",{type:"button",onClick:x,className:"mt-1 cursor-pointer rounded-md border border-gray-300 bg-white px-3 py-1.5 text-xs font-medium text-gray-700 transition-colors hover:bg-gray-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",children:A??t.chartRetry}):null]})}):b&&!o&&!l?e("div",{className:"flex h-full w-full items-center justify-center text-sm text-gray-500 dark:text-gray-400",children:P??W??t.chartNoData}):e("div",{className:m("h-full w-full transition-opacity duration-200",o&&"opacity-60"),children:typeof c=="function"?c({width:U,height:h,measured:V}):c})});return a("figure",{className:m("flex w-full flex-col gap-3",D),"aria-label":y,"aria-labelledby":!y&&s?C:void 0,"aria-describedby":i?w:void 0,...M,children:[s||i||p?a("figcaption",{className:"flex items-start justify-between gap-3",children:[a("div",{className:"flex flex-col gap-0.5",children:[s?e("span",{id:C,className:m("font-semibold text-gray-900 dark:text-gray-100",Y[S]),children:s}):null,i?e("span",{id:w,className:"text-xs text-gray-500 dark:text-gray-400",children:i}):null]}),e(K.Provider,{value:E??null,children:p})]}):null,r&&n==="top"?r:null,r&&n==="right"?a("div",{className:"flex items-start gap-4",children:[e("div",{className:"min-w-0 grow",children:L}),r]}):L,r&&n==="bottom"?r:null,N&&e("div",{className:"flex",children:e("button",{type:"button",onClick:()=>O(Z=>!Z),"aria-expanded":u,"aria-controls":k?v:void 0,className:"cursor-pointer rounded-sm text-xs font-medium text-gray-600 underline underline-offset-2 hover:text-gray-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500 dark:text-gray-400 dark:hover:text-white",children:u?H??t.chartHideTable:j??t.chartShowTable})}),k&&e("div",{id:v,children:d})]})}export{de as ChartContainer};
@@ -1 +1 @@
1
- "use strict";"use client";var l=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var M=(t,o)=>{for(var s in o)l(t,s,{get:o[s],enumerable:!0})},P=(t,o,s,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of z(o))!L.call(t,n)&&n!==s&&l(t,n,{get:()=>o[n],enumerable:!(i=S(o,n))||i.enumerable});return t};var T=t=>P(l({},"__esModule",{value:!0}),t);var R={};M(R,{ChartExportButton:()=>J});module.exports=T(R);var f=require("react"),y=require("../../lib/cn.cjs"),v=require("../../lib/i18n.cjs"),w=require("../dropdown/Dropdown.cjs"),E=require("../dropdown/DropdownContent.cjs"),k=require("../dropdown/DropdownItem.cjs"),D=require("../dropdown/DropdownTrigger.cjs"),F=require("./utils/export.cjs"),r=require("react/jsx-runtime"),j={sm:"h-7 px-2.5 text-xs",md:"h-8 px-3 text-sm",lg:"h-10 px-4 text-sm"},b=(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0",children:(0,r.jsx)("path",{d:"M8 2v8m0 0 3-3m-3 3L5 7M2.5 12.5h11",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})});function J({data:t,series:o,xKey:s,xLabel:i,formatX:n,neutralizeFormulas:d,formats:a=["csv","json"],filename:h="chart",size:B="md",label:I,onExport:p,className:N,disabled:m}){let c=(0,v.useUILabels)(),g=(0,f.useCallback)(e=>{let C={data:t,series:o,xKey:s,xLabel:i,formatX:n,neutralizeFormulas:d};p?p(e,C):(0,F.downloadChartData)(e,C,h)},[t,o,s,i,n,d,p,h]),u=I??c.chartExport,O=e=>e==="csv"?c.chartExportCsv:c.chartExportJson,x=(0,y.cn)("inline-flex cursor-pointer items-center gap-2 rounded-full border border-gray-300 bg-white font-medium text-gray-700 transition-colors hover:bg-gray-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",j[B],N);if(a.length<=1){let e=a[0]??"csv";return(0,r.jsxs)("button",{type:"button",onClick:()=>g(e),disabled:m||t.length===0,className:x,children:[b,(0,r.jsx)("span",{children:u})]})}return(0,r.jsxs)(w.Dropdown,{children:[(0,r.jsxs)(D.DropdownTrigger,{disabled:m||t.length===0,className:x,children:[b,(0,r.jsx)("span",{children:u})]}),(0,r.jsx)(E.DropdownContent,{children:a.map(e=>(0,r.jsx)(k.DropdownItem,{onSelect:()=>g(e),children:O(e)},e))})]})}0&&(module.exports={ChartExportButton});
1
+ "use strict";"use client";var m=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var U=(e,t)=>{for(var s in t)m(e,s,{get:t[s],enumerable:!0})},W=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of J(t))!R.call(e,n)&&n!==s&&m(e,n,{get:()=>t[n],enumerable:!(i=j(t,n))||i.enumerable});return e};var q=e=>W(m({},"__esModule",{value:!0}),e);var H={};U(H,{ChartExportButton:()=>G});module.exports=q(H);var L=require("react"),F=require("../../lib/cn.cjs"),S=require("../../lib/i18n.cjs"),B=require("../dropdown/Dropdown.cjs"),I=require("../dropdown/DropdownContent.cjs"),N=require("../dropdown/DropdownItem.cjs"),O=require("../dropdown/DropdownTrigger.cjs"),z=require("./exportSource.cjs"),P=require("./utils/export.cjs"),o=require("react/jsx-runtime"),A={sm:"h-7 px-2.5 text-xs",md:"h-8 px-3 text-sm",lg:"h-10 px-4 text-sm"},D=(0,o.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0",children:(0,o.jsx)("path",{d:"M8 2v8m0 0 3-3m-3 3L5 7M2.5 12.5h11",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})});function G({data:e,series:t,xKey:s,xLabel:i,formatX:n,neutralizeFormulas:g,formats:c=["csv","json"],filename:x="chart",size:K="md",label:M,onExport:d,className:T,disabled:u}){let l=(0,S.useUILabels)(),a=(0,z.useChartExportSource)(),h=e??a?.data??[],f=t??a?.series??[],p=s??a?.xKey,b=i??a?.xLabel,C=n??a?.formatX,y=(0,L.useCallback)(r=>{if(p===void 0)return;let k={data:h,series:f,xKey:p,xLabel:b,formatX:C,neutralizeFormulas:g};d?d(r,k):(0,P.downloadChartData)(r,k,x)},[h,f,p,b,C,g,d,x]),w=h.length===0||p===void 0,E=M??l.chartExport,X=r=>r==="csv"?l.chartExportCsv:l.chartExportJson,v=(0,F.cn)("inline-flex cursor-pointer items-center gap-2 rounded-full border border-gray-300 bg-white font-medium text-gray-700 transition-colors hover:bg-gray-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",A[K],T);if(c.length<=1){let r=c[0]??"csv";return(0,o.jsxs)("button",{type:"button",onClick:()=>y(r),disabled:u||w,className:v,children:[D,(0,o.jsx)("span",{children:E})]})}return(0,o.jsxs)(B.Dropdown,{children:[(0,o.jsxs)(O.DropdownTrigger,{disabled:u||w,className:v,children:[D,(0,o.jsx)("span",{children:E})]}),(0,o.jsx)(I.DropdownContent,{children:c.map(r=>(0,o.jsx)(N.DropdownItem,{onSelect:()=>y(r),children:X(r)},r))})]})}0&&(module.exports={ChartExportButton});
@@ -1 +1 @@
1
- "use client";import{useCallback as E}from"react";import{cn as k}from"../../lib/cn.js";import{useUILabels as D}from"../../lib/i18n.js";import{Dropdown as F}from"../dropdown/Dropdown.js";import{DropdownContent as B}from"../dropdown/DropdownContent.js";import{DropdownItem as I}from"../dropdown/DropdownItem.js";import{DropdownTrigger as N}from"../dropdown/DropdownTrigger.js";import{downloadChartData as O}from"./utils/export.js";import{jsx as o,jsxs as i}from"react/jsx-runtime";var S={sm:"h-7 px-2.5 text-xs",md:"h-8 px-3 text-sm",lg:"h-10 px-4 text-sm"},b=o("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0",children:o("path",{d:"M8 2v8m0 0 3-3m-3 3L5 7M2.5 12.5h11",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})});function U({data:r,series:a,xKey:p,xLabel:c,formatX:l,neutralizeFormulas:d,formats:e=["csv","json"],filename:h="chart",size:f="md",label:y,onExport:n,className:v,disabled:m}){let s=D(),g=E(t=>{let C={data:r,series:a,xKey:p,xLabel:c,formatX:l,neutralizeFormulas:d};n?n(t,C):O(t,C,h)},[r,a,p,c,l,d,n,h]),u=y??s.chartExport,w=t=>t==="csv"?s.chartExportCsv:s.chartExportJson,x=k("inline-flex cursor-pointer items-center gap-2 rounded-full border border-gray-300 bg-white font-medium text-gray-700 transition-colors hover:bg-gray-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",S[f],v);if(e.length<=1){let t=e[0]??"csv";return i("button",{type:"button",onClick:()=>g(t),disabled:m||r.length===0,className:x,children:[b,o("span",{children:u})]})}return i(F,{children:[i(N,{disabled:m||r.length===0,className:x,children:[b,o("span",{children:u})]}),o(B,{children:e.map(t=>o(I,{onSelect:()=>g(t),children:w(t)},t))})]})}export{U as ChartExportButton};
1
+ "use client";import{useCallback as I}from"react";import{cn as N}from"../../lib/cn.js";import{useUILabels as O}from"../../lib/i18n.js";import{Dropdown as z}from"../dropdown/Dropdown.js";import{DropdownContent as P}from"../dropdown/DropdownContent.js";import{DropdownItem as K}from"../dropdown/DropdownItem.js";import{DropdownTrigger as M}from"../dropdown/DropdownTrigger.js";import{useChartExportSource as T}from"./exportSource.js";import{downloadChartData as X}from"./utils/export.js";import{jsx as o,jsxs as p}from"react/jsx-runtime";var j={sm:"h-7 px-2.5 text-xs",md:"h-8 px-3 text-sm",lg:"h-10 px-4 text-sm"},y=o("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0",children:o("path",{d:"M8 2v8m0 0 3-3m-3 3L5 7M2.5 12.5h11",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})});function V({data:w,series:E,xKey:v,xLabel:k,formatX:D,neutralizeFormulas:c,formats:n=["csv","json"],filename:d="chart",size:L="md",label:F,onExport:s,className:S,disabled:l}){let a=O(),r=T(),i=w??r?.data??[],h=E??r?.series??[],e=v??r?.xKey,m=k??r?.xLabel,g=D??r?.formatX,x=I(t=>{if(e===void 0)return;let C={data:i,series:h,xKey:e,xLabel:m,formatX:g,neutralizeFormulas:c};s?s(t,C):X(t,C,d)},[i,h,e,m,g,c,s,d]),u=i.length===0||e===void 0,f=F??a.chartExport,B=t=>t==="csv"?a.chartExportCsv:a.chartExportJson,b=N("inline-flex cursor-pointer items-center gap-2 rounded-full border border-gray-300 bg-white font-medium text-gray-700 transition-colors hover:bg-gray-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",j[L],S);if(n.length<=1){let t=n[0]??"csv";return p("button",{type:"button",onClick:()=>x(t),disabled:l||u,className:b,children:[y,o("span",{children:f})]})}return p(z,{children:[p(M,{disabled:l||u,className:b,children:[y,o("span",{children:f})]}),o(P,{children:n.map(t=>o(K,{onSelect:()=>x(t),children:B(t)},t))})]})}export{V as ChartExportButton};
@@ -1 +1 @@
1
- "use strict";var f=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var m=(t,r)=>{for(var n in r)f(t,n,{get:r[n],enumerable:!0})},P=(t,r,n,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of b(r))!C.call(t,o)&&o!==n&&f(t,o,{get:()=>r[o],enumerable:!(i=x(r,o))||i.enumerable});return t};var $=t=>P(f({},"__esModule",{value:!0}),t);var R={};m(R,{CHART_PATTERNS:()=>k,CHART_SURFACE_COLOR:()=>l,ChartPatternDefs:()=>S,getPattern:()=>g,patternBackground:()=>w,patternFill:()=>y,patternId:()=>p});module.exports=$(R);var a=require("react/jsx-runtime"),l="var(--color-chart-surface)",k=["solid","diagonal","diagonal-reverse","cross","dots","diagonal-wide","diagonal-reverse-wide","dots-wide"],h={solid:null,diagonal:{tile:6,rotate:45,stroke:2},"diagonal-reverse":{tile:6,rotate:-45,stroke:2},cross:{tile:6,rotate:45,stroke:1.25,crossed:!0},dots:{tile:6,rotate:0,stroke:0,dot:1.5},"diagonal-wide":{tile:10,rotate:45,stroke:3},"diagonal-reverse-wide":{tile:10,rotate:-45,stroke:3},"dots-wide":{tile:10,rotate:0,stroke:0,dot:2.6}};function g(t){return!Number.isFinite(t)||t<0?"solid":k[Math.floor(t)%k.length]}function p(t,r){return`${t.replace(/[^a-zA-Z0-9_-]/g,"")}-texture-${Math.max(0,Math.floor(r))}`}function y(t,r,n,i){return!t||g(n)==="solid"?i:`url(#${p(r,n)})`}function S({id:t,entries:r}){return(0,a.jsx)("defs",{children:r.map(({slot:n,color:i})=>{let o=h[g(n)];if(!o)return null;let{tile:e,rotate:u,stroke:s,crossed:d,dot:c}=o;return(0,a.jsxs)("pattern",{id:p(t,n),width:e,height:e,patternUnits:"userSpaceOnUse",patternTransform:u===0?void 0:`rotate(${u})`,children:[(0,a.jsx)("rect",{width:e,height:e,fill:i}),c?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("circle",{cx:e/4,cy:e/4,r:c,fill:l}),(0,a.jsx)("circle",{cx:e*3/4,cy:e*3/4,r:c,fill:l})]}):null,s>0?(0,a.jsx)("line",{x1:e/2,y1:0,x2:e/2,y2:e,stroke:l,strokeWidth:s}):null,d?(0,a.jsx)("line",{x1:0,y1:e/2,x2:e,y2:e/2,stroke:l,strokeWidth:s}):null]},p(t,n))})})}function w(t,r){let n=h[g(t)];if(!n)return{backgroundColor:r};let{tile:i,rotate:o,stroke:e,crossed:u,dot:s}=n;if(s)return{backgroundColor:r,backgroundImage:`radial-gradient(${l} ${s-.4}px, transparent ${s}px)`,backgroundSize:`${i/2}px ${i/2}px`};let d=c=>`repeating-linear-gradient(${c}deg, ${l} 0 ${e}px, transparent ${e}px ${i}px)`;return{backgroundColor:r,backgroundImage:u?`${d(o)}, ${d(o+90)}`:d(o)}}0&&(module.exports={CHART_PATTERNS,CHART_SURFACE_COLOR,ChartPatternDefs,getPattern,patternBackground,patternFill,patternId});
1
+ "use strict";var f=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var C=(t,r)=>{for(var n in r)f(t,n,{get:r[n],enumerable:!0})},P=(t,r,n,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of h(r))!m.call(t,o)&&o!==n&&f(t,o,{get:()=>r[o],enumerable:!(i=b(r,o))||i.enumerable});return t};var $=t=>P(f({},"__esModule",{value:!0}),t);var R={};C(R,{CHART_PATTERNS:()=>k,CHART_SURFACE_COLOR:()=>s.CHART_SURFACE_COLOR,ChartPatternDefs:()=>S,getPattern:()=>g,patternBackground:()=>w,patternFill:()=>y,patternId:()=>p});module.exports=$(R);var s=require("./palette.cjs"),a=require("react/jsx-runtime");var k=["solid","diagonal","diagonal-reverse","cross","dots","diagonal-wide","diagonal-reverse-wide","dots-wide"],x={solid:null,diagonal:{tile:6,rotate:45,stroke:2},"diagonal-reverse":{tile:6,rotate:-45,stroke:2},cross:{tile:6,rotate:45,stroke:1.25,crossed:!0},dots:{tile:6,rotate:0,stroke:0,dot:1.5},"diagonal-wide":{tile:10,rotate:45,stroke:3},"diagonal-reverse-wide":{tile:10,rotate:-45,stroke:3},"dots-wide":{tile:10,rotate:0,stroke:0,dot:2.6}};function g(t){return!Number.isFinite(t)||t<0?"solid":k[Math.floor(t)%k.length]}function p(t,r){return`${t.replace(/[^a-zA-Z0-9_-]/g,"")}-texture-${Math.max(0,Math.floor(r))}`}function y(t,r,n,i){return!t||g(n)==="solid"?i:`url(#${p(r,n)})`}function S({id:t,entries:r}){return(0,a.jsx)("defs",{children:r.map(({slot:n,color:i})=>{let o=x[g(n)];if(!o)return null;let{tile:e,rotate:c,stroke:l,crossed:d,dot:u}=o;return(0,a.jsxs)("pattern",{id:p(t,n),width:e,height:e,patternUnits:"userSpaceOnUse",patternTransform:c===0?void 0:`rotate(${c})`,children:[(0,a.jsx)("rect",{width:e,height:e,fill:i}),u?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("circle",{cx:e/4,cy:e/4,r:u,fill:s.CHART_SURFACE_COLOR}),(0,a.jsx)("circle",{cx:e*3/4,cy:e*3/4,r:u,fill:s.CHART_SURFACE_COLOR})]}):null,l>0?(0,a.jsx)("line",{x1:e/2,y1:0,x2:e/2,y2:e,stroke:s.CHART_SURFACE_COLOR,strokeWidth:l}):null,d?(0,a.jsx)("line",{x1:0,y1:e/2,x2:e,y2:e/2,stroke:s.CHART_SURFACE_COLOR,strokeWidth:l}):null]},p(t,n))})})}function w(t,r){let n=x[g(t)];if(!n)return{backgroundColor:r};let{tile:i,rotate:o,stroke:e,crossed:c,dot:l}=n;if(l)return{backgroundColor:r,backgroundImage:`radial-gradient(${s.CHART_SURFACE_COLOR} ${l-.4}px, transparent ${l}px)`,backgroundSize:`${i/2}px ${i/2}px`};let d=u=>`repeating-linear-gradient(${u}deg, ${s.CHART_SURFACE_COLOR} 0 ${e}px, transparent ${e}px ${i}px)`;return{backgroundColor:r,backgroundImage:c?`${d(o)}, ${d(o+90)}`:d(o)}}0&&(module.exports={CHART_PATTERNS,CHART_SURFACE_COLOR,ChartPatternDefs,getPattern,patternBackground,patternFill,patternId});
@@ -1 +1 @@
1
- import{Fragment as x,jsx as s,jsxs as k}from"react/jsx-runtime";var l="var(--color-chart-surface)",f=["solid","diagonal","diagonal-reverse","cross","dots","diagonal-wide","diagonal-reverse-wide","dots-wide"],h={solid:null,diagonal:{tile:6,rotate:45,stroke:2},"diagonal-reverse":{tile:6,rotate:-45,stroke:2},cross:{tile:6,rotate:45,stroke:1.25,crossed:!0},dots:{tile:6,rotate:0,stroke:0,dot:1.5},"diagonal-wide":{tile:10,rotate:45,stroke:3},"diagonal-reverse-wide":{tile:10,rotate:-45,stroke:3},"dots-wide":{tile:10,rotate:0,stroke:0,dot:2.6}};function g(r){return!Number.isFinite(r)||r<0?"solid":f[Math.floor(r)%f.length]}function p(r,e){return`${r.replace(/[^a-zA-Z0-9_-]/g,"")}-texture-${Math.max(0,Math.floor(e))}`}function b(r,e,n,o){return!r||g(n)==="solid"?o:`url(#${p(e,n)})`}function C({id:r,entries:e}){return s("defs",{children:e.map(({slot:n,color:o})=>{let i=h[g(n)];if(!i)return null;let{tile:t,rotate:u,stroke:a,crossed:d,dot:c}=i;return k("pattern",{id:p(r,n),width:t,height:t,patternUnits:"userSpaceOnUse",patternTransform:u===0?void 0:`rotate(${u})`,children:[s("rect",{width:t,height:t,fill:o}),c?k(x,{children:[s("circle",{cx:t/4,cy:t/4,r:c,fill:l}),s("circle",{cx:t*3/4,cy:t*3/4,r:c,fill:l})]}):null,a>0?s("line",{x1:t/2,y1:0,x2:t/2,y2:t,stroke:l,strokeWidth:a}):null,d?s("line",{x1:0,y1:t/2,x2:t,y2:t/2,stroke:l,strokeWidth:a}):null]},p(r,n))})})}function m(r,e){let n=h[g(r)];if(!n)return{backgroundColor:e};let{tile:o,rotate:i,stroke:t,crossed:u,dot:a}=n;if(a)return{backgroundColor:e,backgroundImage:`radial-gradient(${l} ${a-.4}px, transparent ${a}px)`,backgroundSize:`${o/2}px ${o/2}px`};let d=c=>`repeating-linear-gradient(${c}deg, ${l} 0 ${t}px, transparent ${t}px ${o}px)`;return{backgroundColor:e,backgroundImage:u?`${d(i)}, ${d(i+90)}`:d(i)}}export{f as CHART_PATTERNS,l as CHART_SURFACE_COLOR,C as ChartPatternDefs,g as getPattern,m as patternBackground,b as patternFill,p as patternId};
1
+ import{CHART_SURFACE_COLOR as l}from"./palette.js";import{Fragment as b,jsx as s,jsxs as k}from"react/jsx-runtime";var f=["solid","diagonal","diagonal-reverse","cross","dots","diagonal-wide","diagonal-reverse-wide","dots-wide"],x={solid:null,diagonal:{tile:6,rotate:45,stroke:2},"diagonal-reverse":{tile:6,rotate:-45,stroke:2},cross:{tile:6,rotate:45,stroke:1.25,crossed:!0},dots:{tile:6,rotate:0,stroke:0,dot:1.5},"diagonal-wide":{tile:10,rotate:45,stroke:3},"diagonal-reverse-wide":{tile:10,rotate:-45,stroke:3},"dots-wide":{tile:10,rotate:0,stroke:0,dot:2.6}};function g(r){return!Number.isFinite(r)||r<0?"solid":f[Math.floor(r)%f.length]}function p(r,e){return`${r.replace(/[^a-zA-Z0-9_-]/g,"")}-texture-${Math.max(0,Math.floor(e))}`}function m(r,e,n,o){return!r||g(n)==="solid"?o:`url(#${p(e,n)})`}function C({id:r,entries:e}){return s("defs",{children:e.map(({slot:n,color:o})=>{let i=x[g(n)];if(!i)return null;let{tile:t,rotate:c,stroke:a,crossed:d,dot:u}=i;return k("pattern",{id:p(r,n),width:t,height:t,patternUnits:"userSpaceOnUse",patternTransform:c===0?void 0:`rotate(${c})`,children:[s("rect",{width:t,height:t,fill:o}),u?k(b,{children:[s("circle",{cx:t/4,cy:t/4,r:u,fill:l}),s("circle",{cx:t*3/4,cy:t*3/4,r:u,fill:l})]}):null,a>0?s("line",{x1:t/2,y1:0,x2:t/2,y2:t,stroke:l,strokeWidth:a}):null,d?s("line",{x1:0,y1:t/2,x2:t,y2:t/2,stroke:l,strokeWidth:a}):null]},p(r,n))})})}function P(r,e){let n=x[g(r)];if(!n)return{backgroundColor:e};let{tile:o,rotate:i,stroke:t,crossed:c,dot:a}=n;if(a)return{backgroundColor:e,backgroundImage:`radial-gradient(${l} ${a-.4}px, transparent ${a}px)`,backgroundSize:`${o/2}px ${o/2}px`};let d=u=>`repeating-linear-gradient(${u}deg, ${l} 0 ${t}px, transparent ${t}px ${o}px)`;return{backgroundColor:e,backgroundImage:c?`${d(i)}, ${d(i+90)}`:d(i)}}export{f as CHART_PATTERNS,l as CHART_SURFACE_COLOR,C as ChartPatternDefs,g as getPattern,P as patternBackground,m as patternFill,p as patternId};
@@ -0,0 +1 @@
1
+ "use strict";var p=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var u=(t,r)=>{for(var n in r)p(t,n,{get:r[n],enumerable:!0})},P=(t,r,n,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of a(r))!l.call(t,e)&&e!==n&&p(t,e,{get:()=>r[e],enumerable:!(i=h(r,e))||i.enumerable});return t};var c=t=>P(p({},"__esModule",{value:!0}),t);var s={};u(s,{ChartPlotClip:()=>g,isOnPlot:()=>C,plotClipId:()=>m});module.exports=c(s);var o=require("react/jsx-runtime");function m(t){return`${t.replace(/[^a-zA-Z0-9_-]/g,"")}-plot`}function C(t,r){return Number.isFinite(t)&&t>=-.5&&t<=r+.5}function g({id:t,width:r,height:n,bleed:i=0}){return(0,o.jsx)("defs",{children:(0,o.jsx)("clipPath",{id:t,children:(0,o.jsx)("rect",{x:-i,y:-i,width:Math.max(0,r+i*2),height:Math.max(0,n+i*2)})})})}0&&(module.exports={ChartPlotClip,isOnPlot,plotClipId});
@@ -0,0 +1 @@
1
+ import{jsx as n}from"react/jsx-runtime";function o(t){return`${t.replace(/[^a-zA-Z0-9_-]/g,"")}-plot`}function p(t,i){return Number.isFinite(t)&&t>=-.5&&t<=i+.5}function h({id:t,width:i,height:e,bleed:r=0}){return n("defs",{children:n("clipPath",{id:t,children:n("rect",{x:-r,y:-r,width:Math.max(0,i+r*2),height:Math.max(0,e+r*2)})})})}export{h as ChartPlotClip,p as isOnPlot,o as plotClipId};
@@ -1 +1 @@
1
- "use strict";"use client";var c=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var D=(e,t)=>{for(var r in t)c(e,r,{get:t[r],enumerable:!0})},H=(e,t,r,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of X(t))!b.call(e,o)&&o!==r&&c(e,o,{get:()=>t[o],enumerable:!(l=g(t,o))||l.enumerable});return e};var k=e=>H(c({},"__esModule",{value:!0}),e);var w={};D(w,{ChartSyncProvider:()=>O,brushToPeriod:()=>T,useChartSync:()=>N});module.exports=k(w);var n=require("react"),h=require("./utils/period.cjs"),p=require("./utils/scales.cjs"),v=require("./utils/timestamp.cjs"),S=require("react/jsx-runtime"),B=(0,n.createContext)(null);function N(){return(0,n.useContext)(B)}function O({children:e,hover:t=!0,brush:r,defaultBrush:l=null,onBrushChange:o}){let[C,x]=(0,n.useState)(null),[R,V]=(0,n.useState)(l),s=r!==void 0,i=s?r:R,d=(0,n.useCallback)(a=>{if(!t)return;let y=u=>u===null?"\0":(0,p.toKey)(u);x(u=>y(u)===y(a)?u:a)},[t]),f=(0,n.useCallback)(a=>{s||V(a),o?.(a)},[s,o]),P=(0,n.useMemo)(()=>({hovered:t?C:null,brush:i??null,hoverShared:t,setHovered:d,setBrush:f}),[t,C,i,d,f]);return(0,S.jsx)(B.Provider,{value:P,children:e})}function T(e){let t=m(e.from),r=m(e.to);if(!t||!r)return null;let[l,o]=t<=r?[t,r]:[r,t];return{preset:"custom",from:(0,h.startOfDay)(l),to:(0,h.endOfDay)(o)}}function m(e){let t=(0,v.toTimestamp)(e);return t===null?null:new Date(t)}0&&(module.exports={ChartSyncProvider,brushToPeriod,useChartSync});
1
+ "use strict";"use client";var d=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var D=(e,t)=>{for(var r in t)d(e,r,{get:t[r],enumerable:!0})},H=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of X(t))!b.call(e,l)&&l!==r&&d(e,l,{get:()=>t[l],enumerable:!(o=g(t,l))||o.enumerable});return e};var T=e=>H(d({},"__esModule",{value:!0}),e);var O={};D(O,{ChartSyncProvider:()=>w,brushToPeriod:()=>N,useChartSync:()=>k});module.exports=T(O);var n=require("react"),h=require("./utils/period.cjs"),v=require("./utils/scales.cjs"),B=require("./utils/timestamp.cjs"),x=require("react/jsx-runtime"),S=(0,n.createContext)(null);function k(){return(0,n.useContext)(S)}function w({children:e,hover:t=!0,brush:r,defaultBrush:o=null,onBrushChange:l}){let[u,c]=(0,n.useState)(null),[R,V]=(0,n.useState)(o),C=r!==void 0,f=C?r:R,m=(0,n.useCallback)(a=>{if(!t)return;let p=s=>s===null?"\0":(0,v.toKey)(s);c(s=>p(s)===p(a)?s:a)},[t]),y=(0,n.useCallback)(a=>{C||V(a),l?.(a)},[C,l]),P=(0,n.useMemo)(()=>({hovered:t?u:null,brush:f??null,hoverShared:t,setHovered:m,setBrush:y}),[t,u,f,m,y]);return(0,x.jsx)(S.Provider,{value:P,children:e})}function N(e){let t=i(e.from),r=i(e.to);if(!t||!r)return null;let[o,l]=t<=r?[t,r]:[r,t],u=e.end===void 0?null:i(e.end),c=u!==null&&u>l?new Date(u.getTime()-1):l;return{preset:"custom",from:(0,h.startOfDay)(o),to:(0,h.endOfDay)(c)}}function i(e){let t=(0,B.toTimestamp)(e);return t===null?null:new Date(t)}0&&(module.exports={ChartSyncProvider,brushToPeriod,useChartSync});
@@ -1 +1 @@
1
- "use client";import{createContext as x,useCallback as d,useContext as R,useMemo as V,useState as f}from"react";import{endOfDay as P,startOfDay as g}from"./utils/period.js";import{toKey as X}from"./utils/scales.js";import{toTimestamp as b}from"./utils/timestamp.js";import{jsx as D}from"react/jsx-runtime";var m=x(null);function T(){return R(m)}function w({children:r,hover:t=!0,brush:e,defaultBrush:a=null,onBrushChange:l}){let[h,p]=f(null),[v,B]=f(a),u=e!==void 0,s=u?e:v,c=d(n=>{if(!t)return;let i=o=>o===null?"\0":X(o);p(o=>i(o)===i(n)?o:n)},[t]),C=d(n=>{u||B(n),l?.(n)},[u,l]),S=V(()=>({hovered:t?h:null,brush:s??null,hoverShared:t,setHovered:c,setBrush:C}),[t,h,s,c,C]);return D(m.Provider,{value:S,children:r})}function I(r){let t=y(r.from),e=y(r.to);if(!t||!e)return null;let[a,l]=t<=e?[t,e]:[e,t];return{preset:"custom",from:g(a),to:P(l)}}function y(r){let t=b(r);return t===null?null:new Date(t)}export{w as ChartSyncProvider,I as brushToPeriod,T as useChartSync};
1
+ "use client";import{createContext as x,useCallback as m,useContext as R,useMemo as V,useState as y}from"react";import{endOfDay as P,startOfDay as g}from"./utils/period.js";import{toKey as X}from"./utils/scales.js";import{toTimestamp as b}from"./utils/timestamp.js";import{jsx as D}from"react/jsx-runtime";var p=x(null);function N(){return R(p)}function O({children:e,hover:t=!0,brush:r,defaultBrush:a=null,onBrushChange:l}){let[n,s]=y(null),[v,B]=y(a),h=r!==void 0,C=h?r:v,d=m(o=>{if(!t)return;let f=u=>u===null?"\0":X(u);s(u=>f(u)===f(o)?u:o)},[t]),i=m(o=>{h||B(o),l?.(o)},[h,l]),S=V(()=>({hovered:t?n:null,brush:C??null,hoverShared:t,setHovered:d,setBrush:i}),[t,n,C,d,i]);return D(p.Provider,{value:S,children:e})}function I(e){let t=c(e.from),r=c(e.to);if(!t||!r)return null;let[a,l]=t<=r?[t,r]:[r,t],n=e.end===void 0?null:c(e.end),s=n!==null&&n>l?new Date(n.getTime()-1):l;return{preset:"custom",from:g(a),to:P(s)}}function c(e){let t=b(e);return t===null?null:new Date(t)}export{O as ChartSyncProvider,I as brushToPeriod,N as useChartSync};
@@ -1 +1 @@
1
- "use strict";var p=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var S=(a,t)=>{for(var o in t)p(a,o,{get:t[o],enumerable:!0})},D=(a,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of P(t))!R.call(a,l)&&l!==o&&p(a,l,{get:()=>t[l],enumerable:!(n=X(t,l))||n.enumerable});return a};var L=a=>D(p({},"__esModule",{value:!0}),a);var W={};S(W,{ChartTableView:()=>B});module.exports=L(W);var f=require("../../lib/cn.cjs"),y=require("../table/Table.cjs"),x=require("../table/TableBody.cjs"),d=require("../table/TableCell.cjs"),k=require("../table/TableHeader.cjs"),c=require("../table/TableHeaderCell.cjs"),v=require("../table/TableRow.cjs"),V=require("./palette.cjs"),s=require("./utils/data.cjs"),u=require("./utils/format.cjs"),r=require("react/jsx-runtime");function B({data:a,series:t,xKey:o,xLabel:n,formatX:l,formatValue:h,caption:C,emptyLabel:w,className:T,...g}){let b=t.filter(e=>!e.hidden);if(a.length===0||b.length===0)return(0,r.jsx)("div",{className:(0,f.cn)("text-sm text-gray-500 dark:text-gray-400",T),...g,children:w});let N=(e,m)=>{let i=(0,s.readXValue)(e,o,m);return l?l(i,m):(0,u.formatXValue)(i)},H=e=>e===null?"\u2014":h?h(e):(0,u.formatNumber)(e);return(0,r.jsx)("div",{className:(0,f.cn)("w-full overflow-x-auto",T),...g,children:(0,r.jsxs)(y.Table,{children:[C?(0,r.jsx)("caption",{className:"sr-only",children:C}):null,(0,r.jsxs)(k.TableHeader,{children:[(0,r.jsx)(c.TableHeaderCell,{children:n??o}),b.map(e=>(0,r.jsx)(c.TableHeaderCell,{className:"text-right",children:(0,V.getSeriesLabel)(e)},e.key))]}),(0,r.jsx)(x.TableBody,{children:a.map((e,m)=>(0,r.jsxs)(v.TableRow,{clickable:!1,children:[(0,r.jsx)(d.TableCell,{className:"font-medium text-gray-900 dark:text-gray-100",children:N(e,m)}),b.map(i=>(0,r.jsx)(d.TableCell,{className:"text-right [font-variant-numeric:tabular-nums]",children:H((0,s.readNumber)(e,i.key))},i.key))]},m))})]})})}0&&(module.exports={ChartTableView});
1
+ "use strict";var f=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var D=(a,t)=>{for(var m in t)f(a,m,{get:t[m],enumerable:!0})},L=(a,t,m,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of P(t))!S.call(a,o)&&o!==m&&f(a,o,{get:()=>t[o],enumerable:!(n=X(t,o))||n.enumerable});return a};var B=a=>L(f({},"__esModule",{value:!0}),a);var F={};D(F,{ChartTableView:()=>W});module.exports=B(F);var p=require("../../lib/cn.cjs"),T=require("../table/Table.cjs"),y=require("../table/TableBody.cjs"),d=require("../table/TableCell.cjs"),k=require("../table/TableHeader.cjs"),c=require("../table/TableHeaderCell.cjs"),v=require("../table/TableRow.cjs"),x=require("./palette.cjs"),s=require("./utils/data.cjs"),u=require("./utils/format.cjs"),r=require("react/jsx-runtime");function W({data:a,series:t,xKey:m,xLabel:n,formatX:o,formatValue:V,columnFormats:w,caption:g,emptyLabel:N,className:h,...C}){let b=t.filter(e=>!e.hidden);if(a.length===0||b.length===0)return(0,r.jsx)("div",{className:(0,p.cn)("text-sm text-gray-500 dark:text-gray-400",h),...C,children:N});let R=(e,i)=>{let l=(0,s.readXValue)(e,m,i);return o?o(l,i):(0,u.formatXValue)(l)},H=(e,i)=>{if(e===null)return"\u2014";let l=w?.[i]??V;return l?l(e):(0,u.formatNumber)(e)};return(0,r.jsx)("div",{className:(0,p.cn)("w-full overflow-x-auto",h),...C,children:(0,r.jsxs)(T.Table,{children:[g?(0,r.jsx)("caption",{className:"sr-only",children:g}):null,(0,r.jsxs)(k.TableHeader,{children:[(0,r.jsx)(c.TableHeaderCell,{children:n??m}),b.map(e=>(0,r.jsx)(c.TableHeaderCell,{className:"text-right",children:(0,x.getSeriesLabel)(e)},e.key))]}),(0,r.jsx)(y.TableBody,{children:a.map((e,i)=>(0,r.jsxs)(v.TableRow,{clickable:!1,children:[(0,r.jsx)(d.TableCell,{className:"font-medium text-gray-900 dark:text-gray-100",children:R(e,i)}),b.map(l=>(0,r.jsx)(d.TableCell,{className:"text-right [font-variant-numeric:tabular-nums]",children:H((0,s.readNumber)(e,l.key),l.key)},l.key))]},i))})]})})}0&&(module.exports={ChartTableView});
@@ -1 +1 @@
1
- import{cn as f}from"../../lib/cn.js";import{Table as x}from"../table/Table.js";import{TableBody as k}from"../table/TableBody.js";import{TableCell as d}from"../table/TableCell.js";import{TableHeader as v}from"../table/TableHeader.js";import{TableHeaderCell as c}from"../table/TableHeaderCell.js";import{TableRow as V}from"../table/TableRow.js";import{getSeriesLabel as w}from"./palette.js";import{readNumber as N,readXValue as H}from"./utils/data.js";import{formatNumber as X,formatXValue as P}from"./utils/format.js";import{jsx as r,jsxs as o}from"react/jsx-runtime";function F({data:m,series:h,xKey:i,xLabel:C,formatX:n,formatValue:s,caption:u,emptyLabel:T,className:b,...p}){let l=h.filter(e=>!e.hidden);if(m.length===0||l.length===0)return r("div",{className:f("text-sm text-gray-500 dark:text-gray-400",b),...p,children:T});let g=(e,t)=>{let a=H(e,i,t);return n?n(a,t):P(a)},y=e=>e===null?"\u2014":s?s(e):X(e);return r("div",{className:f("w-full overflow-x-auto",b),...p,children:o(x,{children:[u?r("caption",{className:"sr-only",children:u}):null,o(v,{children:[r(c,{children:C??i}),l.map(e=>r(c,{className:"text-right",children:w(e)},e.key))]}),r(k,{children:m.map((e,t)=>o(V,{clickable:!1,children:[r(d,{className:"font-medium text-gray-900 dark:text-gray-100",children:g(e,t)}),l.map(a=>r(d,{className:"text-right [font-variant-numeric:tabular-nums]",children:y(N(e,a.key))},a.key))]},t))})]})})}export{F as ChartTableView};
1
+ import{cn as f}from"../../lib/cn.js";import{Table as v}from"../table/Table.js";import{TableBody as x}from"../table/TableBody.js";import{TableCell as p}from"../table/TableCell.js";import{TableHeader as V}from"../table/TableHeader.js";import{TableHeaderCell as d}from"../table/TableHeaderCell.js";import{TableRow as w}from"../table/TableRow.js";import{getSeriesLabel as N}from"./palette.js";import{readNumber as R,readXValue as H}from"./utils/data.js";import{formatNumber as X,formatXValue as P}from"./utils/format.js";import{jsx as t,jsxs as o}from"react/jsx-runtime";function G({data:m,series:c,xKey:i,xLabel:g,formatX:n,formatValue:h,columnFormats:C,caption:s,emptyLabel:T,className:u,...b}){let l=c.filter(e=>!e.hidden);if(m.length===0||l.length===0)return t("div",{className:f("text-sm text-gray-500 dark:text-gray-400",u),...b,children:T});let y=(e,a)=>{let r=H(e,i,a);return n?n(r,a):P(r)},k=(e,a)=>{if(e===null)return"\u2014";let r=C?.[a]??h;return r?r(e):X(e)};return t("div",{className:f("w-full overflow-x-auto",u),...b,children:o(v,{children:[s?t("caption",{className:"sr-only",children:s}):null,o(V,{children:[t(d,{children:g??i}),l.map(e=>t(d,{className:"text-right",children:N(e)},e.key))]}),t(x,{children:m.map((e,a)=>o(w,{clickable:!1,children:[t(p,{className:"font-medium text-gray-900 dark:text-gray-100",children:y(e,a)}),l.map(r=>t(p,{className:"text-right [font-variant-numeric:tabular-nums]",children:k(R(e,r.key),r.key)},r.key))]},a))})]})})}export{G as ChartTableView};
@@ -0,0 +1 @@
1
+ "use strict";"use client";var n=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var a=(r,t)=>{for(var e in t)n(r,e,{get:t[e],enumerable:!0})},h=(r,t,e,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of l(t))!C.call(r,o)&&o!==e&&n(r,o,{get:()=>t[o],enumerable:!(p=c(t,o))||p.enumerable});return r};var i=r=>h(n({},"__esModule",{value:!0}),r);var E={};a(E,{ChartExportContext:()=>x,useChartExportSource:()=>s});module.exports=i(E);var u=require("react"),x=(0,u.createContext)(null);function s(){return(0,u.useContext)(x)}0&&(module.exports={ChartExportContext,useChartExportSource});
@@ -0,0 +1 @@
1
+ "use client";import{createContext as t,useContext as r}from"react";var o=t(null);function u(){return r(o)}export{o as ChartExportContext,u as useChartExportSource};
@@ -1 +1 @@
1
- "use strict";var p=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var q=(r,e)=>{for(var n in e)p(r,n,{get:e[n],enumerable:!0})},k=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of N(e))!M.call(r,o)&&o!==n&&p(r,o,{get:()=>e[o],enumerable:!(t=H(e,o))||t.enumerable});return r};var P=r=>k(p({},"__esModule",{value:!0}),r);var z={};q(z,{CHART_ALL_PAIRS_LIMIT:()=>F,CHART_DIVERGING_COLORS:()=>b,CHART_DIVERGING_DARK_STOPS:()=>E,CHART_DIVERGING_NEUTRAL_INDEX:()=>T,CHART_DOWN_COLOR:()=>U,CHART_MAX_COLOR_CLASSES:()=>W,CHART_MUTED_COLOR:()=>u,CHART_ORDINAL_COLORS:()=>C,CHART_ORDINAL_DARK_STOPS:()=>V,CHART_PALETTE_SIZE:()=>G,CHART_SEQUENTIAL_COLORS:()=>S,CHART_SEQUENTIAL_DARK_STOPS:()=>L,CHART_SERIES_COLORS:()=>R,CHART_UP_COLOR:()=>w,createDivergingScale:()=>X,createSequentialScale:()=>Q,getOrdinalColor:()=>j,getSeriesColor:()=>x,getSeriesLabel:()=>O,rampColor:()=>v,resetPaletteWarnings:()=>K,resolveSeriesColor:()=>A,toLegendItems:()=>$});module.exports=P(z);var G=8,R=["var(--color-chart-1)","var(--color-chart-2)","var(--color-chart-3)","var(--color-chart-4)","var(--color-chart-5)","var(--color-chart-6)","var(--color-chart-7)","var(--color-chart-8)"],u="var(--color-chart-muted)",w="var(--color-chart-up)",U="var(--color-chart-down)",F=3,d=!1;function x(r,e){return e||(r<0||r>=8?(d||(d=!0,console.warn('[@synertech/ui] A chart was given more than 8 series. Extra series share the de-emphasis grey: fold the tail into an "Other" bucket, or split the chart, instead of relying on a ninth colour.')),u):R[r])}function A(r,e,n){return n&&r.key!==n?u:x(e,r.color)}function O(r){return r.label??r.key}function $(r,e,n=!1){return r.map((t,o)=>({key:t.key,label:O(t),color:A(t,o,e),hidden:t.hidden,...t.type==="line"?{marker:"line"}:{},...n&&t.type!=="line"?{pattern:o}:{}}))}function K(){d=!1}var S=["var(--color-chart-seq-1)","var(--color-chart-seq-2)","var(--color-chart-seq-3)","var(--color-chart-seq-4)","var(--color-chart-seq-5)","var(--color-chart-seq-6)"],C=["var(--color-chart-ord-1)","var(--color-chart-ord-2)","var(--color-chart-ord-3)","var(--color-chart-ord-4)","var(--color-chart-ord-5)"],b=["var(--color-chart-div-1)","var(--color-chart-div-2)","var(--color-chart-div-3)","var(--color-chart-div-4)","var(--color-chart-div-5)","var(--color-chart-div-6)","var(--color-chart-div-7)"],T=3,L=[!1,!1,!1,!1,!0,!0],V=[!1,!1,!0,!0,!0],E=[!0,!1,!1,!1,!1,!1,!0],W=7;function h(r){return Number.isFinite(r)?r<0?0:r>1?1:r:0}function v(r,e){if(r.length===0)return u;if(r.length===1)return r[0];let n=h(e)*(r.length-1),t=Math.min(r.length-2,Math.floor(n)),o=n-t;if(o<=.005)return r[t];if(o>=.995)return r[t+1];let a=Math.round(o*1e3)/10;return`color-mix(in oklab, ${r[t+1]} ${a}%, ${r[t]})`}function Z(r,e){return e<=1?.5:Math.min(e-1,Math.floor(h(r)*e))/(e-1)}function y(r,e,n,t,o){let a=c=>{let l=t(c);return n===null?l:Z(l,n)},s=(c=>Number.isFinite(c)?v(e,a(c)):u);return Object.defineProperties(s,{domain:{value:[r[0],r[1]],enumerable:!0},colors:{value:e,enumerable:!0},steps:{value:n,enumerable:!0},position:{value:c=>Number.isFinite(c)?a(c):0,enumerable:!0},onDark:{value:c=>{if(!Number.isFinite(c)||o.length===0)return!1;let l=Math.round(a(c)*(o.length-1));return o[l]??!1},enumerable:!0}}),s}function Q(r,e={}){let{steps:n,colors:t=S,darkStops:o}=e,[a,s]=r,c=s-a;return y(r,t,n??null,l=>c===0?0:(l-a)/c,o??(t===S?L:[]))}function X(r,e={}){let{steps:n,colors:t=b,darkStops:o,center:a=0,symmetric:s=!0}=e,[c,l]=r;if(s){let i=Math.max(Math.abs(l-a),Math.abs(a-c));c=a-i,l=a+i}let m=t===b?T:(t.length-1)/2,f=t.length-1;return y([c,l],t,n??null,i=>{if(i>=a){let _=l-a,D=_<=0?0:h((i-a)/_);return(m+D*(f-m))/f}let g=a-c,I=g<=0?0:h((a-i)/g);return(m-I*m)/f},o??(t===b?E:[]))}function j(r,e=C.length,n=C){return e<=1?n[n.length-1]??u:v(n,h(r/(e-1)))}0&&(module.exports={CHART_ALL_PAIRS_LIMIT,CHART_DIVERGING_COLORS,CHART_DIVERGING_DARK_STOPS,CHART_DIVERGING_NEUTRAL_INDEX,CHART_DOWN_COLOR,CHART_MAX_COLOR_CLASSES,CHART_MUTED_COLOR,CHART_ORDINAL_COLORS,CHART_ORDINAL_DARK_STOPS,CHART_PALETTE_SIZE,CHART_SEQUENTIAL_COLORS,CHART_SEQUENTIAL_DARK_STOPS,CHART_SERIES_COLORS,CHART_UP_COLOR,createDivergingScale,createSequentialScale,getOrdinalColor,getSeriesColor,getSeriesLabel,rampColor,resetPaletteWarnings,resolveSeriesColor,toLegendItems});
1
+ "use strict";var p=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var P=(r,e)=>{for(var t in e)p(r,t,{get:e[t],enumerable:!0})},G=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of q(e))!k.call(r,o)&&o!==t&&p(r,o,{get:()=>e[o],enumerable:!(n=M(e,o))||n.enumerable});return r};var U=r=>G(p({},"__esModule",{value:!0}),r);var J={};P(J,{CHART_ALL_PAIRS_LIMIT:()=>K,CHART_DIVERGING_COLORS:()=>f,CHART_DIVERGING_DARK_STOPS:()=>E,CHART_DIVERGING_NEUTRAL_INDEX:()=>y,CHART_DOWN_COLOR:()=>$,CHART_MAX_COLOR_CLASSES:()=>X,CHART_MUTED_COLOR:()=>u,CHART_ORDINAL_COLORS:()=>S,CHART_ORDINAL_DARK_STOPS:()=>Q,CHART_PALETTE_SIZE:()=>d,CHART_SEQUENTIAL_COLORS:()=>v,CHART_SEQUENTIAL_DARK_STOPS:()=>I,CHART_SERIES_COLORS:()=>O,CHART_SURFACE_COLOR:()=>w,CHART_UP_COLOR:()=>F,createDivergingScale:()=>Z,createSequentialScale:()=>z,getOrdinalColor:()=>B,getSeriesColor:()=>A,getSeriesLabel:()=>L,rampColor:()=>g,resetPaletteWarnings:()=>W,resolveSeriesColor:()=>T,toLegendItems:()=>V});module.exports=U(J);var x=require("../../lib/css-value.cjs"),d=8,O=["var(--color-chart-1)","var(--color-chart-2)","var(--color-chart-3)","var(--color-chart-4)","var(--color-chart-5)","var(--color-chart-6)","var(--color-chart-7)","var(--color-chart-8)"],u="var(--color-chart-muted)",w="var(--color-chart-surface)",F="var(--color-chart-up)",$="var(--color-chart-down)",K=3,C=!1;function A(r,e){let t=(0,x.safeCssColor)(e);return t||(r<0||r>=d?(C||(C=!0,console.warn(`[@synertech/ui] A chart was given more than ${d} series. Extra series share the de-emphasis grey: fold the tail into an "Other" bucket, or split the chart, instead of relying on a ninth colour.`)),u):O[r])}function T(r,e,t){return t&&r.key!==t?u:A(e,r.color)}function L(r){return r.label??r.key}function V(r,e,t=!1){return r.map((n,o)=>({key:n.key,label:L(n),color:T(n,o,e),hidden:n.hidden,...n.type==="line"?{marker:"line"}:{},...t&&n.type!=="line"?{pattern:o}:{}}))}function W(){C=!1}var v=["var(--color-chart-seq-1)","var(--color-chart-seq-2)","var(--color-chart-seq-3)","var(--color-chart-seq-4)","var(--color-chart-seq-5)","var(--color-chart-seq-6)"],S=["var(--color-chart-ord-1)","var(--color-chart-ord-2)","var(--color-chart-ord-3)","var(--color-chart-ord-4)","var(--color-chart-ord-5)"],f=["var(--color-chart-div-1)","var(--color-chart-div-2)","var(--color-chart-div-3)","var(--color-chart-div-4)","var(--color-chart-div-5)","var(--color-chart-div-6)","var(--color-chart-div-7)"],y=3,I=[!1,!1,!1,!1,!0,!0],Q=[!1,!1,!0,!0,!0],E=[!0,!1,!1,!1,!1,!1,!0],X=7;function h(r){return Number.isFinite(r)?r<0?0:r>1?1:r:0}function g(r,e){if(r.length===0)return u;if(r.length===1)return r[0];let t=h(e)*(r.length-1),n=Math.min(r.length-2,Math.floor(t)),o=t-n;if(o<=.005)return r[n];if(o>=.995)return r[n+1];let a=Math.round(o*1e3)/10;return`color-mix(in oklab, ${r[n+1]} ${a}%, ${r[n]})`}function j(r,e){return e<=1?.5:Math.min(e-1,Math.floor(h(r)*e))/(e-1)}function D(r,e,t,n,o){let a=c=>{let l=n(c);return t===null?l:j(l,t)},s=(c=>Number.isFinite(c)?g(e,a(c)):u);return Object.defineProperties(s,{domain:{value:[r[0],r[1]],enumerable:!0},colors:{value:e,enumerable:!0},steps:{value:t,enumerable:!0},position:{value:c=>Number.isFinite(c)?a(c):0,enumerable:!0},onDark:{value:c=>{if(!Number.isFinite(c)||o.length===0)return!1;let l=Math.round(a(c)*(o.length-1));return o[l]??!1},enumerable:!0}}),s}function z(r,e={}){let{steps:t,colors:n=v,darkStops:o}=e,[a,s]=r,c=s-a;return D(r,n,t??null,l=>c===0?0:(l-a)/c,o??(n===v?I:[]))}function Z(r,e={}){let{steps:t,colors:n=f,darkStops:o,center:a=0,symmetric:s=!0}=e,[c,l]=r;if(s){let i=Math.max(Math.abs(l-a),Math.abs(a-c));c=a-i,l=a+i}let m=n===f?y:(n.length-1)/2,b=n.length-1;return D([c,l],n,t??null,i=>{if(i>=a){let _=l-a,N=_<=0?0:h((i-a)/_);return(m+N*(b-m))/b}let R=a-c,H=R<=0?0:h((a-i)/R);return(m-H*m)/b},o??(n===f?E:[]))}function B(r,e=S.length,t=S){return e<=1?t[t.length-1]??u:g(t,h(r/(e-1)))}0&&(module.exports={CHART_ALL_PAIRS_LIMIT,CHART_DIVERGING_COLORS,CHART_DIVERGING_DARK_STOPS,CHART_DIVERGING_NEUTRAL_INDEX,CHART_DOWN_COLOR,CHART_MAX_COLOR_CLASSES,CHART_MUTED_COLOR,CHART_ORDINAL_COLORS,CHART_ORDINAL_DARK_STOPS,CHART_PALETTE_SIZE,CHART_SEQUENTIAL_COLORS,CHART_SEQUENTIAL_DARK_STOPS,CHART_SERIES_COLORS,CHART_SURFACE_COLOR,CHART_UP_COLOR,createDivergingScale,createSequentialScale,getOrdinalColor,getSeriesColor,getSeriesLabel,rampColor,resetPaletteWarnings,resolveSeriesColor,toLegendItems});
@@ -1 +1 @@
1
- var H=8,A=["var(--color-chart-1)","var(--color-chart-2)","var(--color-chart-3)","var(--color-chart-4)","var(--color-chart-5)","var(--color-chart-6)","var(--color-chart-7)","var(--color-chart-8)"],h="var(--color-chart-muted)",N="var(--color-chart-up)",M="var(--color-chart-down)",q=3,p=!1;function O(r,e){return e||(r<0||r>=8?(p||(p=!0,console.warn('[@synertech/ui] A chart was given more than 8 series. Extra series share the de-emphasis grey: fold the tail into an "Other" bucket, or split the chart, instead of relying on a ninth colour.')),h):A[r])}function T(r,e,n){return n&&r.key!==n?h:O(e,r.color)}function L(r){return r.label??r.key}function k(r,e,n=!1){return r.map((t,c)=>({key:t.key,label:L(t),color:T(t,c,e),hidden:t.hidden,...t.type==="line"?{marker:"line"}:{},...n&&t.type!=="line"?{pattern:c}:{}}))}function P(){p=!1}var C=["var(--color-chart-seq-1)","var(--color-chart-seq-2)","var(--color-chart-seq-3)","var(--color-chart-seq-4)","var(--color-chart-seq-5)","var(--color-chart-seq-6)"],v=["var(--color-chart-ord-1)","var(--color-chart-ord-2)","var(--color-chart-ord-3)","var(--color-chart-ord-4)","var(--color-chart-ord-5)"],f=["var(--color-chart-div-1)","var(--color-chart-div-2)","var(--color-chart-div-3)","var(--color-chart-div-4)","var(--color-chart-div-5)","var(--color-chart-div-6)","var(--color-chart-div-7)"],E=3,y=[!1,!1,!1,!1,!0,!0],G=[!1,!1,!0,!0,!0],I=[!0,!1,!1,!1,!1,!1,!0],w=7;function u(r){return Number.isFinite(r)?r<0?0:r>1?1:r:0}function g(r,e){if(r.length===0)return h;if(r.length===1)return r[0];let n=u(e)*(r.length-1),t=Math.min(r.length-2,Math.floor(n)),c=n-t;if(c<=.005)return r[t];if(c>=.995)return r[t+1];let o=Math.round(c*1e3)/10;return`color-mix(in oklab, ${r[t+1]} ${o}%, ${r[t]})`}function D(r,e){return e<=1?.5:Math.min(e-1,Math.floor(u(r)*e))/(e-1)}function _(r,e,n,t,c){let o=a=>{let l=t(a);return n===null?l:D(l,n)},s=(a=>Number.isFinite(a)?g(e,o(a)):h);return Object.defineProperties(s,{domain:{value:[r[0],r[1]],enumerable:!0},colors:{value:e,enumerable:!0},steps:{value:n,enumerable:!0},position:{value:a=>Number.isFinite(a)?o(a):0,enumerable:!0},onDark:{value:a=>{if(!Number.isFinite(a)||c.length===0)return!1;let l=Math.round(o(a)*(c.length-1));return c[l]??!1},enumerable:!0}}),s}function U(r,e={}){let{steps:n,colors:t=C,darkStops:c}=e,[o,s]=r,a=s-o;return _(r,t,n??null,l=>a===0?0:(l-o)/a,c??(t===C?y:[]))}function F(r,e={}){let{steps:n,colors:t=f,darkStops:c,center:o=0,symmetric:s=!0}=e,[a,l]=r;if(s){let i=Math.max(Math.abs(l-o),Math.abs(o-a));a=o-i,l=o+i}let m=t===f?E:(t.length-1)/2,b=t.length-1;return _([a,l],t,n??null,i=>{if(i>=o){let S=l-o,x=S<=0?0:u((i-o)/S);return(m+x*(b-m))/b}let d=o-a,R=d<=0?0:u((o-i)/d);return(m-R*m)/b},c??(t===f?I:[]))}function $(r,e=v.length,n=v){return e<=1?n[n.length-1]??h:g(n,u(r/(e-1)))}export{q as CHART_ALL_PAIRS_LIMIT,f as CHART_DIVERGING_COLORS,I as CHART_DIVERGING_DARK_STOPS,E as CHART_DIVERGING_NEUTRAL_INDEX,M as CHART_DOWN_COLOR,w as CHART_MAX_COLOR_CLASSES,h as CHART_MUTED_COLOR,v as CHART_ORDINAL_COLORS,G as CHART_ORDINAL_DARK_STOPS,H as CHART_PALETTE_SIZE,C as CHART_SEQUENTIAL_COLORS,y as CHART_SEQUENTIAL_DARK_STOPS,A as CHART_SERIES_COLORS,N as CHART_UP_COLOR,F as createDivergingScale,U as createSequentialScale,$ as getOrdinalColor,O as getSeriesColor,L as getSeriesLabel,g as rampColor,P as resetPaletteWarnings,T as resolveSeriesColor,k as toLegendItems};
1
+ import{safeCssColor as A}from"../../lib/css-value.js";var v=8,T=["var(--color-chart-1)","var(--color-chart-2)","var(--color-chart-3)","var(--color-chart-4)","var(--color-chart-5)","var(--color-chart-6)","var(--color-chart-7)","var(--color-chart-8)"],h="var(--color-chart-muted)",q="var(--color-chart-surface)",k="var(--color-chart-up)",P="var(--color-chart-down)",G=3,p=!1;function L(r,n){let e=A(n);return e||(r<0||r>=v?(p||(p=!0,console.warn(`[@synertech/ui] A chart was given more than ${v} series. Extra series share the de-emphasis grey: fold the tail into an "Other" bucket, or split the chart, instead of relying on a ninth colour.`)),h):T[r])}function y(r,n,e){return e&&r.key!==e?h:L(n,r.color)}function I(r){return r.label??r.key}function U(r,n,e=!1){return r.map((t,c)=>({key:t.key,label:I(t),color:y(t,c,n),hidden:t.hidden,...t.type==="line"?{marker:"line"}:{},...e&&t.type!=="line"?{pattern:c}:{}}))}function w(){p=!1}var S=["var(--color-chart-seq-1)","var(--color-chart-seq-2)","var(--color-chart-seq-3)","var(--color-chart-seq-4)","var(--color-chart-seq-5)","var(--color-chart-seq-6)"],g=["var(--color-chart-ord-1)","var(--color-chart-ord-2)","var(--color-chart-ord-3)","var(--color-chart-ord-4)","var(--color-chart-ord-5)"],b=["var(--color-chart-div-1)","var(--color-chart-div-2)","var(--color-chart-div-3)","var(--color-chart-div-4)","var(--color-chart-div-5)","var(--color-chart-div-6)","var(--color-chart-div-7)"],E=3,D=[!1,!1,!1,!1,!0,!0],F=[!1,!1,!0,!0,!0],H=[!0,!1,!1,!1,!1,!1,!0],$=7;function u(r){return Number.isFinite(r)?r<0?0:r>1?1:r:0}function R(r,n){if(r.length===0)return h;if(r.length===1)return r[0];let e=u(n)*(r.length-1),t=Math.min(r.length-2,Math.floor(e)),c=e-t;if(c<=.005)return r[t];if(c>=.995)return r[t+1];let o=Math.round(c*1e3)/10;return`color-mix(in oklab, ${r[t+1]} ${o}%, ${r[t]})`}function N(r,n){return n<=1?.5:Math.min(n-1,Math.floor(u(r)*n))/(n-1)}function _(r,n,e,t,c){let o=a=>{let l=t(a);return e===null?l:N(l,e)},s=(a=>Number.isFinite(a)?R(n,o(a)):h);return Object.defineProperties(s,{domain:{value:[r[0],r[1]],enumerable:!0},colors:{value:n,enumerable:!0},steps:{value:e,enumerable:!0},position:{value:a=>Number.isFinite(a)?o(a):0,enumerable:!0},onDark:{value:a=>{if(!Number.isFinite(a)||c.length===0)return!1;let l=Math.round(o(a)*(c.length-1));return c[l]??!1},enumerable:!0}}),s}function K(r,n={}){let{steps:e,colors:t=S,darkStops:c}=n,[o,s]=r,a=s-o;return _(r,t,e??null,l=>a===0?0:(l-o)/a,c??(t===S?D:[]))}function V(r,n={}){let{steps:e,colors:t=b,darkStops:c,center:o=0,symmetric:s=!0}=n,[a,l]=r;if(s){let i=Math.max(Math.abs(l-o),Math.abs(o-a));a=o-i,l=o+i}let m=t===b?E:(t.length-1)/2,f=t.length-1;return _([a,l],t,e??null,i=>{if(i>=o){let C=l-o,O=C<=0?0:u((i-o)/C);return(m+O*(f-m))/f}let d=o-a,x=d<=0?0:u((o-i)/d);return(m-x*m)/f},c??(t===b?H:[]))}function W(r,n=g.length,e=g){return n<=1?e[e.length-1]??h:R(e,u(r/(n-1)))}export{G as CHART_ALL_PAIRS_LIMIT,b as CHART_DIVERGING_COLORS,H as CHART_DIVERGING_DARK_STOPS,E as CHART_DIVERGING_NEUTRAL_INDEX,P as CHART_DOWN_COLOR,$ as CHART_MAX_COLOR_CLASSES,h as CHART_MUTED_COLOR,g as CHART_ORDINAL_COLORS,F as CHART_ORDINAL_DARK_STOPS,v as CHART_PALETTE_SIZE,S as CHART_SEQUENTIAL_COLORS,D as CHART_SEQUENTIAL_DARK_STOPS,T as CHART_SERIES_COLORS,q as CHART_SURFACE_COLOR,k as CHART_UP_COLOR,V as createDivergingScale,K as createSequentialScale,W as getOrdinalColor,L as getSeriesColor,I as getSeriesLabel,R as rampColor,w as resetPaletteWarnings,y as resolveSeriesColor,U as toLegendItems};
@@ -1 +1 @@
1
- "use strict";"use client";var f=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var p=(t,e)=>{for(var r in e)f(t,r,{get:e[r],enumerable:!0})},w=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of b(e))!T.call(t,n)&&n!==r&&f(t,n,{get:()=>e[n],enumerable:!(i=m(e,n))||i.enumerable});return t};var R=t=>w(f({},"__esModule",{value:!0}),t);var C={};p(C,{DEFAULT_CHART_WIDTH:()=>h,useChartSize:()=>z});module.exports=R(C);var s=require("react"),h=640;function z(t={}){let{width:e,fallbackWidth:r=h}=t,i=(0,s.useRef)(null),[n,l]=(0,s.useState)(0);return(0,s.useEffect)(()=>{if(e!==void 0)return;let o=i.current;if(!o)return;let a=u=>{l(d=>Math.abs(d-u)<1?d:u)};if(a(o.getBoundingClientRect().width),typeof ResizeObserver>"u")return;let c=new ResizeObserver(u=>{for(let d of u)a(d.contentRect.width)});return c.observe(o),()=>c.disconnect()},[e]),e!==void 0?{ref:i,width:e,measured:!0}:{ref:i,width:n>0?n:r,measured:n>0}}0&&(module.exports={DEFAULT_CHART_WIDTH,useChartSize});
1
+ "use strict";"use client";var l=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var w=(t,e)=>{for(var u in e)l(t,u,{get:e[u],enumerable:!0})},C=(t,e,u,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of T(e))!p.call(t,n)&&n!==u&&l(t,n,{get:()=>e[n],enumerable:!(c=b(e,n))||c.enumerable});return t};var R=t=>C(l({},"__esModule",{value:!0}),t);var z={};w(z,{DEFAULT_CHART_WIDTH:()=>h,useChartSize:()=>v});module.exports=R(z);var r=require("react"),h=640;function v(t={}){let{width:e,fallbackWidth:u=h}=t,c=(0,r.useRef)(null),[n,m]=(0,r.useState)(0),i=(0,r.useRef)(null);return(0,r.useEffect)(()=>{let s=e===void 0?c.current:null;if(i.current?.element===s||(i.current?.disconnect(),i.current=null,!s))return;let f=d=>{m(o=>Math.abs(o-d)<1?o:d)};if(f(s.getBoundingClientRect().width),typeof ResizeObserver>"u"){i.current={element:s,disconnect:()=>{}};return}let a=new ResizeObserver(d=>{if(s.isConnected)for(let o of d)f(o.contentRect.width)});a.observe(s),i.current={element:s,disconnect:()=>a.disconnect()}}),(0,r.useEffect)(()=>()=>{i.current?.disconnect(),i.current=null},[]),e!==void 0?{ref:c,width:e,measured:!0}:{ref:c,width:n>0?n:u,measured:n>0}}0&&(module.exports={DEFAULT_CHART_WIDTH,useChartSize});
@@ -1 +1 @@
1
- "use client";import{useEffect as c,useRef as h,useState as l}from"react";var m=640;function T(o={}){let{width:e,fallbackWidth:f=m}=o,r=h(null),[i,a]=l(0);return c(()=>{if(e!==void 0)return;let s=r.current;if(!s)return;let u=t=>{a(n=>Math.abs(n-t)<1?n:t)};if(u(s.getBoundingClientRect().width),typeof ResizeObserver>"u")return;let d=new ResizeObserver(t=>{for(let n of t)u(n.contentRect.width)});return d.observe(s),()=>d.disconnect()},[e]),e!==void 0?{ref:r,width:e,measured:!0}:{ref:r,width:i>0?i:f,measured:i>0}}export{m as DEFAULT_CHART_WIDTH,T as useChartSize};
1
+ "use client";import{useEffect as o,useRef as l,useState as m}from"react";var b=640;function p(f={}){let{width:i,fallbackWidth:a=b}=f,s=l(null),[u,h]=m(0),e=l(null);return o(()=>{let t=i===void 0?s.current:null;if(e.current?.element===t||(e.current?.disconnect(),e.current=null,!t))return;let c=n=>{h(r=>Math.abs(r-n)<1?r:n)};if(c(t.getBoundingClientRect().width),typeof ResizeObserver>"u"){e.current={element:t,disconnect:()=>{}};return}let d=new ResizeObserver(n=>{if(t.isConnected)for(let r of n)c(r.contentRect.width)});d.observe(t),e.current={element:t,disconnect:()=>d.disconnect()}}),o(()=>()=>{e.current?.disconnect(),e.current=null},[]),i!==void 0?{ref:s,width:i,measured:!0}:{ref:s,width:u>0?u:a,measured:u>0}}export{b as DEFAULT_CHART_WIDTH,p as useChartSize};