@synertech/ui 0.45.0 → 0.46.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 (150) hide show
  1. package/.claude/skills/use-synertech-ui/SKILL.md +116 -18
  2. package/README.md +47 -5
  3. package/dist/components/area-chart/AreaChart.cjs +1 -1
  4. package/dist/components/area-chart/AreaChart.js +1 -1
  5. package/dist/components/avatar/Avatar.cjs +1 -1
  6. package/dist/components/avatar/Avatar.js +1 -1
  7. package/dist/components/banner/Banner.cjs +1 -1
  8. package/dist/components/banner/Banner.js +1 -1
  9. package/dist/components/bar-chart/BarChart.cjs +1 -1
  10. package/dist/components/bar-chart/BarChart.js +1 -1
  11. package/dist/components/box-plot/BoxPlot.cjs +1 -1
  12. package/dist/components/box-plot/BoxPlot.js +1 -1
  13. package/dist/components/breadcrumb/Breadcrumb.cjs +1 -1
  14. package/dist/components/breadcrumb/Breadcrumb.js +1 -1
  15. package/dist/components/bullet-chart/BulletChart.cjs +1 -1
  16. package/dist/components/bullet-chart/BulletChart.js +1 -1
  17. package/dist/components/calendar/Calendar.cjs +1 -1
  18. package/dist/components/calendar/Calendar.js +1 -1
  19. package/dist/components/candlestick-chart/CandlestickChart.cjs +1 -1
  20. package/dist/components/candlestick-chart/CandlestickChart.js +1 -1
  21. package/dist/components/chart/ChartBrush.cjs +1 -1
  22. package/dist/components/chart/ChartBrush.js +1 -1
  23. package/dist/components/chart/ChartExportButton.cjs +1 -1
  24. package/dist/components/chart/ChartExportButton.js +1 -1
  25. package/dist/components/chart/ChartSync.cjs +1 -1
  26. package/dist/components/chart/ChartSync.js +1 -1
  27. package/dist/components/chart/utils/cartesian.cjs +1 -1
  28. package/dist/components/chart/utils/cartesian.js +1 -1
  29. package/dist/components/chart/utils/export.cjs +1 -2
  30. package/dist/components/chart/utils/export.js +1 -2
  31. package/dist/components/chart/utils/keyboard.cjs +1 -0
  32. package/dist/components/chart/utils/keyboard.js +1 -0
  33. package/dist/components/chart/utils/path.cjs +1 -1
  34. package/dist/components/chart/utils/path.js +1 -1
  35. package/dist/components/chart/utils/time.cjs +1 -1
  36. package/dist/components/chart/utils/time.js +1 -1
  37. package/dist/components/chart/utils/timestamp.cjs +1 -0
  38. package/dist/components/chart/utils/timestamp.js +1 -0
  39. package/dist/components/chart/utils/touch.cjs +1 -0
  40. package/dist/components/chart/utils/touch.js +1 -0
  41. package/dist/components/chip/Chip.cjs +1 -1
  42. package/dist/components/chip/Chip.js +1 -1
  43. package/dist/components/datagrid/DataGrid.cjs +1 -2
  44. package/dist/components/datagrid/DataGrid.js +1 -2
  45. package/dist/components/device-mockup/DeviceMockup.cjs +1 -1
  46. package/dist/components/device-mockup/DeviceMockup.js +1 -1
  47. package/dist/components/dropdown/Dropdown.cjs +1 -1
  48. package/dist/components/dropdown/Dropdown.js +1 -1
  49. package/dist/components/dropdown/DropdownCheckboxItem.cjs +1 -1
  50. package/dist/components/dropdown/DropdownCheckboxItem.js +1 -1
  51. package/dist/components/dropdown/DropdownContent.cjs +1 -1
  52. package/dist/components/dropdown/DropdownContent.js +1 -1
  53. package/dist/components/dropdown/DropdownItem.cjs +1 -1
  54. package/dist/components/dropdown/DropdownItem.js +1 -1
  55. package/dist/components/dropdown/DropdownRadio.cjs +1 -1
  56. package/dist/components/dropdown/DropdownRadio.js +1 -1
  57. package/dist/components/dropdown/DropdownSubMenu.cjs +1 -1
  58. package/dist/components/dropdown/DropdownSubMenu.js +1 -1
  59. package/dist/components/dropdown/hooks/index.cjs +1 -1
  60. package/dist/components/dropdown/hooks/index.js +1 -1
  61. package/dist/components/dropdown/hooks/useClickOutside.cjs +1 -1
  62. package/dist/components/dropdown/hooks/useClickOutside.js +1 -1
  63. package/dist/components/dropdown/index.cjs +1 -1
  64. package/dist/components/dropdown/index.js +1 -1
  65. package/dist/components/dropdown/menu-navigation.cjs +1 -0
  66. package/dist/components/dropdown/menu-navigation.js +1 -0
  67. package/dist/components/dumbbell-chart/DumbbellChart.cjs +1 -1
  68. package/dist/components/dumbbell-chart/DumbbellChart.js +1 -1
  69. package/dist/components/file-selector/FileSelector.cjs +1 -1
  70. package/dist/components/file-selector/FileSelector.js +1 -1
  71. package/dist/components/form/input/Input.cjs +1 -1
  72. package/dist/components/form/input/Input.js +1 -1
  73. package/dist/components/form/mention-input/MentionInput.cjs +1 -1
  74. package/dist/components/form/mention-input/MentionInput.js +1 -1
  75. package/dist/components/form/number-input/NumberInput.cjs +1 -1
  76. package/dist/components/form/number-input/NumberInput.js +1 -1
  77. package/dist/components/funnel-chart/FunnelChart.cjs +1 -1
  78. package/dist/components/funnel-chart/FunnelChart.js +1 -1
  79. package/dist/components/gantt-chart/GanttChart.cjs +1 -1
  80. package/dist/components/gantt-chart/GanttChart.js +1 -1
  81. package/dist/components/header/Header.cjs +1 -1
  82. package/dist/components/header/Header.js +1 -1
  83. package/dist/components/heat-map/Heatmap.cjs +1 -1
  84. package/dist/components/heat-map/Heatmap.js +1 -1
  85. package/dist/components/help-button/HelpButton.cjs +7 -7
  86. package/dist/components/help-button/HelpButton.js +7 -7
  87. package/dist/components/help-button/MarkdownEditor.cjs +1 -1
  88. package/dist/components/help-button/MarkdownEditor.js +1 -1
  89. package/dist/components/image-uploader/ImageUploader.cjs +1 -1
  90. package/dist/components/image-uploader/ImageUploader.js +1 -1
  91. package/dist/components/label/Label.cjs +1 -1
  92. package/dist/components/label/Label.js +1 -1
  93. package/dist/components/line-chart/LineChart.cjs +1 -1
  94. package/dist/components/line-chart/LineChart.js +1 -1
  95. package/dist/components/modal/Modal.cjs +1 -1
  96. package/dist/components/modal/Modal.js +1 -1
  97. package/dist/components/pagination/Pagination.cjs +1 -1
  98. package/dist/components/pagination/Pagination.js +1 -1
  99. package/dist/components/pie-chart/PieChart.cjs +1 -1
  100. package/dist/components/pie-chart/PieChart.js +1 -1
  101. package/dist/components/radio-button/RadioButton.cjs +1 -1
  102. package/dist/components/radio-button/RadioButton.js +1 -1
  103. package/dist/components/scatter-chart/ScatterChart.cjs +1 -1
  104. package/dist/components/scatter-chart/ScatterChart.js +1 -1
  105. package/dist/components/schema-editor/SchemaEditor.cjs +1 -1
  106. package/dist/components/schema-editor/SchemaEditor.js +1 -1
  107. package/dist/components/schema-editor/legend/SchemaLegend.cjs +1 -1
  108. package/dist/components/schema-editor/legend/SchemaLegend.js +1 -1
  109. package/dist/components/schema-editor/tables/SchemaTableRenderer.cjs +1 -1
  110. package/dist/components/schema-editor/tables/SchemaTableRenderer.js +1 -1
  111. package/dist/components/schema-editor/toolbar/SchemaToolbar.cjs +1 -1
  112. package/dist/components/schema-editor/toolbar/SchemaToolbar.js +1 -1
  113. package/dist/components/select/Select.cjs +1 -1
  114. package/dist/components/select/Select.js +1 -1
  115. package/dist/components/tabs/Tabs.cjs +1 -1
  116. package/dist/components/tabs/Tabs.js +1 -1
  117. package/dist/components/tabs/TabsContent.cjs +1 -1
  118. package/dist/components/tabs/TabsContent.js +1 -1
  119. package/dist/components/tabs/TabsContext.cjs +1 -1
  120. package/dist/components/tabs/TabsContext.js +1 -1
  121. package/dist/components/tabs/TabsList.cjs +1 -1
  122. package/dist/components/tabs/TabsList.js +1 -1
  123. package/dist/components/tabs/TabsTrigger.cjs +1 -1
  124. package/dist/components/tabs/TabsTrigger.js +1 -1
  125. package/dist/components/toast/Toast.cjs +1 -1
  126. package/dist/components/toast/Toast.js +1 -1
  127. package/dist/components/waterfall-chart/WaterfallChart.cjs +1 -1
  128. package/dist/components/waterfall-chart/WaterfallChart.js +1 -1
  129. package/dist/components/wizard/Wizard.cjs +1 -1
  130. package/dist/components/wizard/Wizard.js +1 -1
  131. package/dist/components/workflow-editor/WorkflowEditor.cjs +1 -1
  132. package/dist/components/workflow-editor/WorkflowEditor.js +1 -1
  133. package/dist/components/workflow-editor/toolbar/WorkflowToolbar.cjs +1 -1
  134. package/dist/components/workflow-editor/toolbar/WorkflowToolbar.js +1 -1
  135. package/dist/index.cjs +1 -1
  136. package/dist/index.d.cts +830 -175
  137. package/dist/index.d.ts +830 -175
  138. package/dist/index.js +1 -1
  139. package/dist/lib/aria-hide.cjs +1 -1
  140. package/dist/lib/aria-hide.js +1 -1
  141. package/dist/lib/csv.cjs +2 -0
  142. package/dist/lib/csv.js +2 -0
  143. package/dist/lib/i18n.cjs +1 -1
  144. package/dist/lib/i18n.js +1 -1
  145. package/dist/lib/server-labels.cjs +1 -0
  146. package/dist/lib/server-labels.js +1 -0
  147. package/dist/lib/ui-labels.cjs +1 -0
  148. package/dist/lib/ui-labels.js +1 -0
  149. package/dist/styles.css +3070 -264
  150. package/package.json +14 -14
@@ -1 +1 @@
1
- "use client";import{memo as we,useCallback as w,useMemo as Z,useState as fe}from"react";import{cn as Ae}from"../../lib/cn.js";import{useUILabels as Ve}from"../../lib/i18n.js";import{ChartAnnotationLayer as Ce,describeAnnotations as Ee}from"../chart/ChartAnnotations.js";import{ChartAxis as be}from"../chart/ChartAxis.js";import{ChartBrushLayer as Be,useChartBrush as Te}from"../chart/ChartBrush.js";import{ChartContainer as He}from"../chart/ChartContainer.js";import{ChartGrid as Ne}from"../chart/ChartGrid.js";import{ChartLegend as We}from"../chart/ChartLegend.js";import{useChartSync as Ie}from"../chart/ChartSync.js";import{ChartTableView as De}from"../chart/ChartTableView.js";import{ChartTooltip as Me,ChartTooltipContent as Ke}from"../chart/ChartTooltip.js";import{getSeriesLabel as xe,resolveSeriesColor as Xe,toLegendItems as $e}from"../chart/palette.js";import{buildCartesianGeometry as Ge,createCategoryLocator as Oe,createPlotContext as ze,splitOverlay as _e}from"../chart/utils/cartesian.js";import{collectAllValues as je,readNumber as ke}from"../chart/utils/data.js";import{decimatePath as Ue,warnPointBudget as Fe}from"../chart/utils/decimate.js";import{formatAuto as Ye,formatXValue as Pe}from"../chart/utils/format.js";import{buildLinePath as ve}from"../chart/utils/path.js";import{nearestIndex as qe,toKey as Q,toNumber as Je}from"../chart/utils/scales.js";import{extent as Qe}from"../chart/utils/ticks.js";import{Fragment as ot,jsx as o,jsxs as A}from"react/jsx-runtime";var Ze=24,et=10,tt=10,nt=we(function({lines:g,showMarkers:r}){return o("g",{children:g.map(i=>A("g",{children:[i.solid?o("path",{d:i.solid,fill:"none",stroke:i.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}):null,i.dashed?o("path",{d:i.dashed,fill:"none",stroke:i.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:"5 4"}):null,r?i.markers.map(d=>o("circle",{cx:d.x,cy:d.y,r:3,fill:i.color,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},`${d.x}-${d.y}`)):null]},i.key))})});function rt({width:f,height:g,data:r,resolvedSeries:i,x:d,y:V,grid:b,size:z,curve:x,forecastFrom:W,forecastLabel:k,markers:P,connectNulls:E,referenceLines:ee,annotations:v,annotationsLabel:te,overlay:ne,maxPoints:L,brush:_,onBrush:j,brushLabel:re,syncEnabled:oe,margin:U,tooltip:S,onPointClick:I,plotLabel:ae,formatValue:R,formatX:B}){let[D,M]=fe(null),s=D!==null&&D<r.length?D:null,[se,ie]=fe(null),le=Ie(),h=oe?le:null,e=Z(()=>{let t=i.filter(c=>!c.hidden),n=Ge({width:f,height:g,data:r,x:d,y:V,bounds:Qe(je(r,t.map(c=>c.key))),margin:U,placement:"point",formatValue:R,formatX:B,extraTop:k?et:0}),l=n.categoryCenters,m=n.valueScale,J=W===void 0?-1:n.xValues.findIndex(c=>Q(c)===Q(W)),Le=t.map(c=>{let O=r.map((N,Re)=>{let me=ke(N,c.key);return{x:l[Re],y:me===null?Number.NaN:m(me),defined:me!==null}}),ge={connectNulls:E},ce=J>=0,de=N=>L&&L>0?Ue(N,L):N,ye=de(ce?O.slice(0,J+1):O),pe=c.dashed?de(O):ce?de(O.slice(J)):[];return L||Fe("LineChart",O.length),{key:c.key,color:c.color,solid:c.dashed?"":ve(ye,x,ge),dashed:c.dashed||ce?ve(pe,x,ge):"",markers:[...ye,...c.dashed?[]:pe].filter(N=>N.defined!==!1)}}),Se=r.length>1?n.innerWidth/(r.length-1):0;return{visible:t,locate:Oe(n),plot:ze({geometry:n,width:f,height:g,data:r,series:t,formatValue:R,formatX:B}),xValues:n.xValues,xPositions:l,xTicks:n.categoryTicks,yTicks:n.valueTicks,yScale:m,innerWidth:n.innerWidth,innerHeight:n.innerHeight,margin:n.margin,lines:Le,forecastIndex:J,showMarkers:P==="always"||P==="auto"&&Se>=Ze&&r.length>1}},[r,i,d,V,f,g,U,x,E,W,k,P,L,R,B]),y=w(t=>e.visible.map(n=>{let l=ke(r[t],n.key);return{seriesKey:n.key,seriesLabel:xe(n),color:n.color,value:l,formattedValue:l===null?"\u2014":R(l),datum:r[t]}}),[r,e.visible,R]),F=h?h.brush:se,he=w(t=>{ie(t),h?.setBrush(t),j?.(t)},[h,j]),u=Te({enabled:_,active:F!==null,centers:e.xPositions,xValues:e.xValues,offset:e.margin.left,orientation:"vertical",onCommit:he}),Y=w(t=>{if(u.onPointerMove(t),S===!1||r.length===0)return;let n=t.currentTarget.getBoundingClientRect(),l=t.clientX-n.left-e.margin.left,m=qe(e.xPositions,l);M(m>=0?m:null),h?.setHovered(m>=0?e.xValues[m]:null)},[u,S,r.length,e.margin.left,e.xPositions,e.xValues,h]),K=w(()=>{M(null),h?.setHovered(null)},[h]),ue=w(t=>{if(r.length===0)return;u.onKeyDown(t,s);let n=r.length-1,l=s??0,m=t.key==="ArrowRight"?Math.min(n,l+1):t.key==="ArrowLeft"?Math.max(0,l-1):t.key==="Home"?0:t.key==="End"?n:t.key==="Escape"?null:void 0;m!==void 0&&(t.preventDefault(),M(m),h?.setHovered(m===null?null:e.xValues[m]))},[r.length,s,u,h,e.xValues]),T=w(()=>{if(u.consumedClick()||!I||s===null)return;let[t]=y(s);t&&I({...t,index:s,x:e.xValues[s]})},[u,I,s,y,e.xValues]),q=s!==null||!h?.hovered?null:(()=>{let t=Q(h.hovered),n=e.xValues.findIndex(l=>Q(l)===t);return n<0?null:n})(),p=s??q,X=p===null?null:y(p),$=(X??[]).filter(t=>t.value!==null),H=u.dragging??F,G=(()=>{if(!H)return null;let t=e.locate(H.from),n=e.locate(H.to);return t===null||n===null?null:{from:t,to:n}})(),a=_e(ne),C=s===null||X===null?null:{x:e.xValues[s],xLabel:B(e.xValues[s],s),index:s,points:X};return A(ot,{children:[A("svg",{width:f,height:g,role:"img","aria-label":ae??[e.visible.map(t=>xe(t)).join(", "),Ee(v,te)].filter(Boolean).join(". "),tabIndex:0,className:Ae("touch-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",_&&"select-none"),onPointerDown:u.onPointerDown,onPointerMove:Y,onPointerUp:u.onPointerUp,onPointerCancel:u.onPointerUp,onPointerLeave:K,onKeyDown:ue,onBlur:K,onClick:T,children:[A("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[o(Ne,{width:e.innerWidth,height:e.innerHeight,horizontal:b==="y"||b==="both"?e.yTicks.map(t=>t.offset):void 0,vertical:b==="x"||b==="both"?e.xTicks.map(t=>t.offset):void 0}),v?o(Ce,{layer:"under",annotations:v,xAt:e.locate,yAt:e.yScale,width:e.innerWidth,height:e.innerHeight}):null,G?o(Be,{from:G.from,to:G.to,width:e.innerWidth,height:e.innerHeight,live:u.dragging!==null,label:re}):null,a.under?.(e.plot),ee?.map(t=>{let n=e.yScale(t.value),l=n<tt?n+12:n-4;return A("g",{children:[o("line",{x1:0,y1:n,x2:e.innerWidth,y2:n,stroke:t.color??"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:t.dashed===!1?void 0:"4 4"}),t.label?o("text",{x:e.innerWidth,y:l,textAnchor:"end",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:t.label}):null]},`${t.value}-${t.label??""}`)}),e.forecastIndex>=0?A("g",{children:[o("line",{x1:e.xPositions[e.forecastIndex],y1:0,x2:e.xPositions[e.forecastIndex],y2:e.innerHeight,className:"stroke-gray-300 dark:stroke-gray-600",strokeWidth:1,strokeDasharray:"3 3"}),k?o("text",{x:e.xPositions[e.forecastIndex]+4,y:-2,className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:k}):null]}):null,o(nt,{lines:e.lines,showMarkers:e.showMarkers}),v?o(Ce,{annotations:v,xAt:e.locate,yAt:e.yScale,width:e.innerWidth,height:e.innerHeight}):null,a.over?.(e.plot),p!==null?A("g",{"aria-hidden":"true",children:[o("line",{x1:e.xPositions[p],y1:0,x2:e.xPositions[p],y2:e.innerHeight,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:1,strokeDasharray:s===null?"3 3":void 0}),$.map(t=>o("circle",{cx:e.xPositions[p],cy:e.yScale(t.value),r:4,fill:t.color,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},t.seriesKey))]}):null]}),o("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:d.hidden?null:o(be,{orientation:"bottom",ticks:e.xTicks,length:e.innerWidth,label:d.label,size:z})}),o("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:V?.hidden?null:o(be,{orientation:"left",ticks:e.yTicks,length:e.innerHeight,showLine:!1,label:V?.label,size:z})})]}),C&&S!==!1?o(Me,{x:e.margin.left+e.xPositions[C.index],y:e.margin.top+($.length>0?Math.min(...$.map(t=>e.yScale(t.value))):e.innerHeight/2),containerWidth:f,children:typeof S=="function"?S(C):o(Ke,{title:C.xLabel,points:C.points})}):null]})}function St({data:f,series:g,x:r,y:i,height:d=240,width:V,size:b="md",grid:z="y",legend:x,tooltip:W=!0,tableView:k=!1,emphasis:P,title:E,description:ee,loading:v=!1,emptyState:te,error:ne=!1,errorState:L,onRetry:_,actions:j,onPointClick:re,curve:oe="monotone",forecastFrom:U,forecastLabel:S,markers:I="auto",connectNulls:ae=!1,referenceLines:R,annotations:B,overlay:D,legendToggle:M=!0,maxPoints:s,brush:se=!1,onBrush:ie,brushLabel:le,sync:h=!0,margin:e,locale:y,plotLabel:F,className:he,...u}){let Y=Ve(),[K,ue]=fe(()=>new Set),T=Z(()=>g.map((a,C)=>({...a,hidden:a.hidden||K.has(a.key),color:Xe(a,C,P)})),[g,K,P]),q=Z(()=>i?.format??(a=>Ye(a,y)),[i?.format,y]),p=Z(()=>r.format??(a=>r.scale==="time"?Pe(a instanceof Date?a:new Date(Je(a)),y):Pe(a,y)),[r.format,r.scale,y]),X=w(a=>{ue(C=>{let t=new Set(C);return t.has(a)?t.delete(a):t.add(a),t})},[]),$=x===void 0?g.length>=2:x!==!1,H=typeof x=="string"?x:"bottom",G=T.filter(a=>!a.hidden).length;return o(He,{title:E,description:ee,height:d,width:V,size:b,loading:v,empty:f.length===0||G===0,emptyState:te,error:ne,errorState:L,onRetry:_,actions:j,tableView:k,legendPosition:H,legend:$?o(We,{items:$e(T,P),position:H,marker:"line",size:b,onToggle:M?X:void 0}):void 0,table:k?o(De,{data:f,series:T,xKey:r.key,xLabel:r.label??r.key,formatX:p,formatValue:q,caption:typeof E=="string"?E:void 0}):void 0,className:he,...u,children:({width:a})=>o(rt,{width:a,height:d,data:f,resolvedSeries:T,x:r,y:i,grid:z,size:b,curve:oe,forecastFrom:U,forecastLabel:S,markers:I,connectNulls:ae,referenceLines:R,annotations:B,annotationsLabel:Y.chartAnnotations,overlay:D,maxPoints:s,brush:se,onBrush:ie,brushLabel:le??Y.chartBrush,syncEnabled:h,margin:e,tooltip:W,onPointClick:re,plotLabel:F,formatValue:q,formatX:p})})}export{St as LineChart};
1
+ "use client";import{memo as Ve,useCallback as x,useMemo as oe,useState as ye}from"react";import{cn as Ae}from"../../lib/cn.js";import{useUILabels as Te}from"../../lib/i18n.js";import{ChartAnnotationLayer as be,describeAnnotations as Be}from"../chart/ChartAnnotations.js";import{ChartAxis as xe}from"../chart/ChartAxis.js";import{ChartBrushLayer as Ee,useChartBrush as He}from"../chart/ChartBrush.js";import{ChartContainer as We}from"../chart/ChartContainer.js";import{ChartGrid as Ie}from"../chart/ChartGrid.js";import{ChartLegend as Ne}from"../chart/ChartLegend.js";import{useChartSync as De}from"../chart/ChartSync.js";import{ChartTableView as Ke}from"../chart/ChartTableView.js";import{ChartTooltip as Me,ChartTooltipContent as Xe}from"../chart/ChartTooltip.js";import{getSeriesLabel as ke,resolveSeriesColor as $e,toLegendItems as Ge}from"../chart/palette.js";import{buildCartesianGeometry as Oe,createCategoryLocator as _e,createPlotContext as ze,splitOverlay as Ue}from"../chart/utils/cartesian.js";import{collectAllValues as je,readNumber as ve}from"../chart/utils/data.js";import{decimatePath as Fe,warnPointBudget as Ye}from"../chart/utils/decimate.js";import{formatAuto as qe,formatXValue as Je}from"../chart/utils/format.js";import{chartCursorTarget as Qe,pressChartMark as Ze}from"../chart/utils/keyboard.js";import{buildLinePath as Pe,isDrawable as et,isolatedPoints as tt}from"../chart/utils/path.js";import{nearestIndex as nt,toKey as re}from"../chart/utils/scales.js";import{extent as rt}from"../chart/utils/ticks.js";import{formatTimeValue as ot}from"../chart/utils/timestamp.js";import{CHART_TOUCH as at}from"../chart/utils/touch.js";import{Fragment as ct,jsx as o,jsxs as T}from"react/jsx-runtime";var st=24,it=10,lt=10,ht=Ve(function({lines:f,showMarkers:r}){return o("g",{children:f.map(i=>T("g",{children:[i.solid?o("path",{d:i.solid,fill:"none",stroke:i.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}):null,i.dashed?o("path",{d:i.dashed,fill:"none",stroke:i.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:"5 4"}):null,(r?i.markers:i.isolated).map(d=>o("circle",{cx:d.x,cy:d.y,r:3,fill:i.color,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},`${d.x}-${d.y}`))]},i.key))})});function ut({width:m,height:f,data:r,resolvedSeries:i,x:d,y:B,grid:y,size:_,curve:C,forecastFrom:D,forecastLabel:k,markers:v,connectNulls:P,referenceLines:ae,annotations:L,annotationsLabel:se,overlay:ie,maxPoints:S,brush:z,onBrush:U,brushLabel:le,syncEnabled:he,margin:j,tooltip:R,onPointClick:w,plotLabel:ue,formatValue:V,formatX:E}){let[K,M]=ye(null),s=K!==null&&K<r.length?K:null,[ce,de]=ye(null),me=De(),h=he?me:null,e=oe(()=>{let t=i.filter(u=>!u.hidden),n=Oe({width:m,height:f,data:r,x:d,y:B,bounds:rt(je(r,t.map(u=>u.key))),margin:j,placement:"point",formatValue:V,formatX:E,extraTop:k?it:0}),l=n.categoryCenters,A=n.valueScale,Q=D===void 0?-1:n.xValues.findIndex(u=>re(u)===re(D)),Le=t.map(u=>{let O=r.map((ne,we)=>{let pe=ve(ne,u.key);return{x:l[we],y:pe===null?Number.NaN:A(pe),defined:pe!==null}}),Ce={connectNulls:P},Z=Q>=0,ge=ne=>S&&S>0?Fe(ne,S):ne,ee=ge(Z?O.slice(0,Q+1):O),te=u.dashed?ge(O):Z?ge(O.slice(Q)):[];S||Ye("LineChart",O.length);let Re=u.dashed?te:Z?[...ee,...te.slice(1)]:ee;return{key:u.key,color:u.color,solid:u.dashed?"":Pe(ee,C,Ce),dashed:u.dashed||Z?Pe(te,C,Ce):"",markers:[...ee,...u.dashed?[]:te].filter(et),isolated:tt(Re,P)}}),Se=r.length>1?n.innerWidth/(r.length-1):0;return{visible:t,locate:_e(n),plot:ze({geometry:n,width:m,height:f,data:r,series:t,formatValue:V,formatX:E}),xValues:n.xValues,xPositions:l,xTicks:n.categoryTicks,yTicks:n.valueTicks,yScale:A,innerWidth:n.innerWidth,innerHeight:n.innerHeight,margin:n.margin,lines:Le,forecastIndex:Q,showMarkers:v==="always"||v==="auto"&&Se>=st&&r.length>1}},[r,i,d,B,m,f,j,C,P,D,k,v,S,V,E]),p=x(t=>e.visible.map(n=>{let l=ve(r[t],n.key);return{seriesKey:n.key,seriesLabel:ke(n),color:n.color,value:l,formattedValue:l===null?"\u2014":V(l),datum:r[t]}}),[r,e.visible,V]),F=h?h.brush:ce,fe=x(t=>{de(t),h?.setBrush(t),U?.(t)},[h,U]),c=He({enabled:z,active:F!==null,centers:e.xPositions,xValues:e.xValues,offset:e.margin.left,orientation:"vertical",onCommit:fe}),Y=x(t=>{if(c.onPointerMove(t),R===!1||r.length===0)return;let n=t.currentTarget.getBoundingClientRect(),l=t.clientX-n.left-e.margin.left,A=nt(e.xPositions,l);M(A>=0?A:null),h?.setHovered(A>=0?e.xValues[A]:null)},[c,R,r.length,e.margin.left,e.xPositions,e.xValues,h]),X=x(()=>{M(null),h?.setHovered(null)},[h]),H=x(()=>{if(!w||s===null)return;let[t]=p(s);t&&w({...t,index:s,x:e.xValues[s]})},[w,s,p,e.xValues]),W=x(t=>{if(r.length===0)return;let n=w&&s!==null&&e.visible.length>0;if(Ze(t,n?H:null))return;c.onKeyDown(t,s);let l=Qe(t.key,s,r.length,"x");l!==void 0&&(t.preventDefault(),M(l),h?.setHovered(l===null?null:e.xValues[l]))},[r.length,s,c,h,e.xValues,e.visible.length,w,H]),q=x(()=>{c.consumedClick()||H()},[c,H]),J=s!==null||!h?.hovered?null:(()=>{let t=re(h.hovered),n=e.xValues.findIndex(l=>re(l)===t);return n<0?null:n})(),b=s??J,$=b===null?null:p(b),I=($??[]).filter(t=>t.value!==null),G=c.dragging??F,a=(()=>{if(!G)return null;let t=e.locate(G.from),n=e.locate(G.to);return t===null||n===null?null:{from:t,to:n}})(),N=Ue(ie),g=s===null||$===null?null:{x:e.xValues[s],xLabel:E(e.xValues[s],s),index:s,points:$};return T(ct,{children:[T("svg",{width:m,height:f,role:"img","aria-label":ue??[e.visible.map(t=>ke(t)).join(", "),Be(L,se)].filter(Boolean).join(". "),tabIndex:0,className:Ae(at,"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",z&&"select-none"),onPointerDown:c.onPointerDown,onPointerMove:Y,onPointerUp:c.onPointerUp,onPointerCancel:c.onPointerUp,onPointerLeave:X,onKeyDown:W,onBlur:X,onClick:q,children:[T("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[o(Ie,{width:e.innerWidth,height:e.innerHeight,horizontal:y==="y"||y==="both"?e.yTicks.map(t=>t.offset):void 0,vertical:y==="x"||y==="both"?e.xTicks.map(t=>t.offset):void 0}),L?o(be,{layer:"under",annotations:L,xAt:e.locate,yAt:e.yScale,width:e.innerWidth,height:e.innerHeight}):null,a?o(Ee,{from:a.from,to:a.to,width:e.innerWidth,height:e.innerHeight,live:c.dragging!==null,label:le}):null,N.under?.(e.plot),ae?.map(t=>{let n=e.yScale(t.value),l=n<lt?n+12:n-4;return T("g",{children:[o("line",{x1:0,y1:n,x2:e.innerWidth,y2:n,stroke:t.color??"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:t.dashed===!1?void 0:"4 4"}),t.label?o("text",{x:e.innerWidth,y:l,textAnchor:"end",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:t.label}):null]},`${t.value}-${t.label??""}`)}),e.forecastIndex>=0?T("g",{children:[o("line",{x1:e.xPositions[e.forecastIndex],y1:0,x2:e.xPositions[e.forecastIndex],y2:e.innerHeight,className:"stroke-gray-300 dark:stroke-gray-600",strokeWidth:1,strokeDasharray:"3 3"}),k?o("text",{x:e.xPositions[e.forecastIndex]+4,y:-2,className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:k}):null]}):null,o(ht,{lines:e.lines,showMarkers:e.showMarkers}),L?o(be,{annotations:L,xAt:e.locate,yAt:e.yScale,width:e.innerWidth,height:e.innerHeight}):null,N.over?.(e.plot),b!==null?T("g",{"aria-hidden":"true",children:[o("line",{x1:e.xPositions[b],y1:0,x2:e.xPositions[b],y2:e.innerHeight,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:1,strokeDasharray:s===null?"3 3":void 0}),I.map(t=>o("circle",{cx:e.xPositions[b],cy:e.yScale(t.value),r:4,fill:t.color,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},t.seriesKey))]}):null]}),o("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:d.hidden?null:o(xe,{orientation:"bottom",ticks:e.xTicks,length:e.innerWidth,label:d.label,size:_})}),o("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:B?.hidden?null:o(xe,{orientation:"left",ticks:e.yTicks,length:e.innerHeight,showLine:!1,label:B?.label,size:_})})]}),g&&R!==!1?o(Me,{x:e.margin.left+e.xPositions[g.index],y:e.margin.top+(I.length>0?Math.min(...I.map(t=>e.yScale(t.value))):e.innerHeight/2),containerWidth:m,children:typeof R=="function"?R(g):o(Xe,{title:g.xLabel,points:g.points})}):null]})}function It({data:m,series:f,x:r,y:i,height:d=240,width:B,size:y="md",grid:_="y",legend:C,tooltip:D=!0,tableView:k=!1,emphasis:v,title:P,description:ae,loading:L=!1,emptyState:se,error:ie=!1,errorState:S,onRetry:z,actions:U,onPointClick:le,curve:he="monotone",forecastFrom:j,forecastLabel:R,markers:w="auto",connectNulls:ue=!1,referenceLines:V,annotations:E,overlay:K,legendToggle:M=!0,maxPoints:s,brush:ce=!1,onBrush:de,brushLabel:me,sync:h=!0,margin:e,locale:p,plotLabel:F,className:fe,...c}){let Y=Te(),[X,H]=ye(()=>new Set),W=oe(()=>f.map((a,N)=>({...a,hidden:a.hidden||X.has(a.key),color:$e(a,N,v)})),[f,X,v]),q=oe(()=>i?.format??(a=>qe(a,p)),[i?.format,p]),J=oe(()=>r.format??(a=>r.scale==="time"?ot(a,p):Je(a,p)),[r.format,r.scale,p]),b=x(a=>{H(N=>{let g=new Set(N);return g.has(a)?g.delete(a):g.add(a),g})},[]),$=C===void 0?f.length>=2:C!==!1,I=typeof C=="string"?C:"bottom",G=W.filter(a=>!a.hidden).length;return o(We,{title:P,description:ae,height:d,width:B,size:y,loading:L,empty:m.length===0||G===0,emptyState:se,error:ie,errorState:S,onRetry:z,actions:U,tableView:k,legendPosition:I,legend:$?o(Ne,{items:Ge(W,v),position:I,marker:"line",size:y,onToggle:M?b:void 0}):void 0,table:k?o(Ke,{data:m,series:W,xKey:r.key,xLabel:r.label??r.key,formatX:J,formatValue:q,caption:typeof P=="string"?P:void 0}):void 0,className:fe,...c,children:({width:a})=>o(ut,{width:a,height:d,data:m,resolvedSeries:W,x:r,y:i,grid:_,size:y,curve:he,forecastFrom:j,forecastLabel:R,markers:w,connectNulls:ue,referenceLines:V,annotations:E,annotationsLabel:Y.chartAnnotations,overlay:K,maxPoints:s,brush:ce,onBrush:de,brushLabel:me??Y.chartBrush,syncEnabled:h,margin:e,tooltip:D,onPointClick:le,plotLabel:F,formatValue:q,formatX:J})})}export{It as LineChart};
@@ -1 +1 @@
1
- "use strict";"use client";var u=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var de=Object.prototype.hasOwnProperty;var ce=(r,t)=>{for(var o in t)u(r,o,{get:t[o],enumerable:!0})},ue=(r,t,o,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of ie(t))!de.call(r,l)&&l!==o&&u(r,l,{get:()=>t[l],enumerable:!(d=ne(t,l))||d.enumerable});return r};var ge=r=>ue(u({},"__esModule",{value:!0}),r);var be={};ce(be,{Modal:()=>N});module.exports=ge(be);var s=require("react"),w=require("../../hooks/useDialogA11y.cjs"),a=require("../../lib/cn.cjs"),k=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime"),me={sm:"max-w-sm",md:"max-w-2xl",lg:"max-w-4xl",xl:"max-w-6xl",full:"max-w-full"},N=(0,s.forwardRef)(({isOpen:r,onClose:t,title:o="Modal Title",children:d,buttonLabel:l,onButtonClick:C,className:L,allowFullScreen:F=!1,showSubmit:g=!0,submitLabel:M,onSubmitClick:S,showCancel:m=!1,cancelLabel:j,onCancelClick:b,buttonsPosition:v="right",showHeaderDivider:D=!0,showFooterDivider:I=!0,description:c,icon:f,size:R="md",reverseButtons:P=!1,headerClassName:B,contentClassName:H,footerClassName:z,titleClassName:E,descriptionClassName:T,submitClassName:W,cancelClassName:$,closeLabel:A,enterFullScreenLabel:O,exitFullScreenLabel:U,"aria-label":V,closeOnEscape:q=!0,trapFocus:G=!0,initialFocus:J,returnFocus:K,lockScroll:Q=!0},X)=>{let[n,Y]=(0,s.useState)(!1),i=(0,k.useUILabels)(),h=(0,s.useId)(),x=`${h}-title`,p=`${h}-description`,{dialogRef:Z,dialogProps:_}=(0,w.useDialogA11y)({open:r,onClose:t,closeOnEscape:q,trapFocus:G,initialFocus:J,returnFocus:K,lockScroll:Q});if(!r)return null;let ee=l??M??i.confirm,te=j??i.cancel,re=A??i.closeModal,ae=n?U??i.exitFullScreen:O??i.enterFullScreen,y=C??S,oe=async()=>{y&&await y(),t()},le=async()=>{b&&await b(),t()};return(0,e.jsx)("div",{className:(0,a.cn)("overflow-y-auto overflow-x-hidden fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm",L),"aria-hidden":!r,children:(0,e.jsx)("div",{className:(0,a.cn)("relative p-4 w-full max-h-full transition-all duration-300",n?"max-w-full h-full p-0":me[R]),ref:X,children:(0,e.jsxs)("div",{..._,ref:Z,"aria-labelledby":o?x:void 0,"aria-label":o?void 0:V,"aria-describedby":c?p:void 0,className:(0,a.cn)("relative bg-white shadow dark:bg-gray-700 border-b-4 transition-all duration-300 focus:outline-none",n?"rounded-none h-full flex flex-col":"rounded-lg"),children:[(0,e.jsxs)("div",{className:(0,a.cn)("flex items-center justify-between p-4 md:p-5 rounded-t",D&&"border-b border-gray-200 dark:border-gray-600",B),children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[f&&(0,e.jsx)("div",{className:"shrink-0 text-gray-500 dark:text-gray-400",children:f}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{id:x,className:(0,a.cn)("text-xl font-semibold text-gray-900 dark:text-white",E),children:o}),c&&(0,e.jsx)("p",{id:p,className:(0,a.cn)("mt-1 text-sm text-gray-500 dark:text-gray-400",T),children:c})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 ms-auto",children:[F&&(0,e.jsx)("button",{type:"button",onClick:()=>Y(se=>!se),className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white","aria-label":ae,children:n?(0,e.jsx)("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M7 1H1v6m16 0V1h-6m0 16h6v-6M1 11v6h6"})}):(0,e.jsx)("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M11 1h6v6M1 11v6h6m0-12L1 1m16 16-6-6"})})}),(0,e.jsxs)("button",{type:"button",onClick:t,className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white",children:[(0,e.jsx)("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"})}),(0,e.jsx)("span",{className:"sr-only",children:re})]})]})]}),(0,e.jsx)("div",{className:(0,a.cn)("p-4 md:p-5 space-y-4",n&&"flex-1 overflow-y-auto",H),children:d}),(g||m)&&(0,e.jsxs)("div",{className:(0,a.cn)("flex items-center gap-2 p-4 md:p-5 rounded-b",I&&"border-t border-gray-200 dark:border-gray-600",v==="right"?"justify-end":v==="center"?"justify-center":"justify-start",P&&"flex-row-reverse",z),children:[m&&(0,e.jsx)("button",{type:"button",onClick:le,className:(0,a.cn)("text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 font-medium rounded-lg text-sm px-5 py-2.5 border border-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:bg-gray-600 dark:hover:text-white",$),children:te}),g&&(0,e.jsx)("button",{type:"button",onClick:oe,className:(0,a.cn)("text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-500 dark:hover:bg-blue-600",W),children:ee})]})]})})})});N.displayName="Modal";0&&(module.exports={Modal});
1
+ "use strict";"use client";var m=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var me=Object.prototype.hasOwnProperty;var ge=(r,t)=>{for(var l in t)m(r,l,{get:t[l],enumerable:!0})},be=(r,t,l,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ue(t))!me.call(r,a)&&a!==l&&m(r,a,{get:()=>t[a],enumerable:!(d=ce(t,a))||d.enumerable});return r};var ve=r=>be(m({},"__esModule",{value:!0}),r);var he={};ge(he,{Modal:()=>F});module.exports=ve(he);var s=require("react"),N=require("react-dom"),C=require("../../hooks/useDialogA11y.cjs"),o=require("../../lib/cn.cjs"),L=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime"),fe={sm:"max-w-sm",md:"max-w-2xl",lg:"max-w-4xl",xl:"max-w-6xl",full:"max-w-full"},F=(0,s.forwardRef)(({isOpen:r,onClose:t,title:l,children:d,buttonLabel:a,onButtonClick:S,className:M,allowFullScreen:D=!1,showSubmit:g=!0,submitLabel:j,onSubmitClick:I,showCancel:b=!1,cancelLabel:P,onCancelClick:v,buttonsPosition:f="right",showHeaderDivider:R=!0,showFooterDivider:B=!0,description:c,icon:h,size:H="md",reverseButtons:z=!1,headerClassName:E,contentClassName:T,footerClassName:W,titleClassName:$,descriptionClassName:A,submitClassName:O,cancelClassName:U,closeLabel:V,enterFullScreenLabel:q,exitFullScreenLabel:G,"aria-label":J,closeOnEscape:K=!0,trapFocus:Q=!0,initialFocus:X,returnFocus:Y,lockScroll:Z=!0},_)=>{let[i,ee]=(0,s.useState)(!1),n=(0,L.useUILabels)(),u=l??n.modalDefaultTitle,x=(0,s.useId)(),p=`${x}-title`,y=`${x}-description`,{dialogRef:te,dialogProps:re}=(0,C.useDialogA11y)({open:r,onClose:t,closeOnEscape:K,trapFocus:Q,initialFocus:X,returnFocus:Y,lockScroll:Z});if(!r)return null;let oe=a??j??n.confirm,ae=P??n.cancel,le=V??n.closeModal,ne=i?G??n.exitFullScreen:q??n.enterFullScreen,w=S??I,se=async()=>{w&&await w(),t()},ie=async()=>{v&&await v(),t()},k=(0,e.jsx)("div",{className:(0,o.cn)("overflow-y-auto overflow-x-hidden fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm",M),"aria-hidden":!r,children:(0,e.jsx)("div",{className:(0,o.cn)("relative p-4 w-full max-h-full transition-all duration-300",i?"max-w-full h-full p-0":fe[H]),ref:_,children:(0,e.jsxs)("div",{...re,ref:te,"aria-labelledby":u?p:void 0,"aria-label":u?void 0:J,"aria-describedby":c?y:void 0,className:(0,o.cn)("relative bg-white shadow dark:bg-gray-700 border-b-4 transition-all duration-300 focus:outline-none",i?"rounded-none h-full flex flex-col":"rounded-lg"),children:[(0,e.jsxs)("div",{className:(0,o.cn)("flex items-center justify-between p-4 md:p-5 rounded-t",R&&"border-b border-gray-200 dark:border-gray-600",E),children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[h&&(0,e.jsx)("div",{className:"shrink-0 text-gray-500 dark:text-gray-400",children:h}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{id:p,className:(0,o.cn)("text-xl font-semibold text-gray-900 dark:text-white",$),children:u}),c&&(0,e.jsx)("p",{id:y,className:(0,o.cn)("mt-1 text-sm text-gray-500 dark:text-gray-400",A),children:c})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 ms-auto",children:[D&&(0,e.jsx)("button",{type:"button",onClick:()=>ee(de=>!de),className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white","aria-label":ne,children:i?(0,e.jsx)("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M7 1H1v6m16 0V1h-6m0 16h6v-6M1 11v6h6"})}):(0,e.jsx)("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M11 1h6v6M1 11v6h6m0-12L1 1m16 16-6-6"})})}),(0,e.jsxs)("button",{type:"button",onClick:t,className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white",children:[(0,e.jsx)("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"})}),(0,e.jsx)("span",{className:"sr-only",children:le})]})]})]}),(0,e.jsx)("div",{className:(0,o.cn)("p-4 md:p-5 space-y-4",i&&"flex-1 overflow-y-auto",T),children:d}),(g||b)&&(0,e.jsxs)("div",{className:(0,o.cn)("flex items-center gap-2 p-4 md:p-5 rounded-b",B&&"border-t border-gray-200 dark:border-gray-600",f==="right"?"justify-end":f==="center"?"justify-center":"justify-start",z&&"flex-row-reverse",W),children:[b&&(0,e.jsx)("button",{type:"button",onClick:ie,className:(0,o.cn)("text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 font-medium rounded-lg text-sm px-5 py-2.5 border border-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:bg-gray-600 dark:hover:text-white",U),children:ae}),g&&(0,e.jsx)("button",{type:"button",onClick:se,className:(0,o.cn)("text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-500 dark:hover:bg-blue-600",O),children:oe})]})]})})});return typeof document<"u"?(0,N.createPortal)(k,document.body):k});F.displayName="Modal";0&&(module.exports={Modal});
@@ -1 +1 @@
1
- "use client";import{forwardRef as ae,useId as oe,useState as le}from"react";import{useDialogA11y as se}from"../../hooks/useDialogA11y.js";import{cn as t}from"../../lib/cn.js";import{useUILabels as ne}from"../../lib/i18n.js";import{jsx as e,jsxs as r}from"react/jsx-runtime";var ie={sm:"max-w-sm",md:"max-w-2xl",lg:"max-w-4xl",xl:"max-w-6xl",full:"max-w-full"},de=ae(({isOpen:s,onClose:l,title:n="Modal Title",children:x,buttonLabel:p,onButtonClick:y,className:w,allowFullScreen:k=!1,showSubmit:d=!0,submitLabel:N,onSubmitClick:C,showCancel:c=!1,cancelLabel:L,onCancelClick:u,buttonsPosition:g="right",showHeaderDivider:F=!0,showFooterDivider:M=!0,description:i,icon:m,size:S="md",reverseButtons:j=!1,headerClassName:D,contentClassName:I,footerClassName:R,titleClassName:P,descriptionClassName:B,submitClassName:H,cancelClassName:z,closeLabel:E,enterFullScreenLabel:T,exitFullScreenLabel:W,"aria-label":$,closeOnEscape:A=!0,trapFocus:O=!0,initialFocus:U,returnFocus:V,lockScroll:q=!0},G)=>{let[a,J]=le(!1),o=ne(),b=oe(),v=`${b}-title`,f=`${b}-description`,{dialogRef:K,dialogProps:Q}=se({open:s,onClose:l,closeOnEscape:A,trapFocus:O,initialFocus:U,returnFocus:V,lockScroll:q});if(!s)return null;let X=p??N??o.confirm,Y=L??o.cancel,Z=E??o.closeModal,_=a?W??o.exitFullScreen:T??o.enterFullScreen,h=y??C,ee=async()=>{h&&await h(),l()},te=async()=>{u&&await u(),l()};return e("div",{className:t("overflow-y-auto overflow-x-hidden fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm",w),"aria-hidden":!s,children:e("div",{className:t("relative p-4 w-full max-h-full transition-all duration-300",a?"max-w-full h-full p-0":ie[S]),ref:G,children:r("div",{...Q,ref:K,"aria-labelledby":n?v:void 0,"aria-label":n?void 0:$,"aria-describedby":i?f:void 0,className:t("relative bg-white shadow dark:bg-gray-700 border-b-4 transition-all duration-300 focus:outline-none",a?"rounded-none h-full flex flex-col":"rounded-lg"),children:[r("div",{className:t("flex items-center justify-between p-4 md:p-5 rounded-t",F&&"border-b border-gray-200 dark:border-gray-600",D),children:[r("div",{className:"flex items-center gap-3",children:[m&&e("div",{className:"shrink-0 text-gray-500 dark:text-gray-400",children:m}),r("div",{children:[e("h3",{id:v,className:t("text-xl font-semibold text-gray-900 dark:text-white",P),children:n}),i&&e("p",{id:f,className:t("mt-1 text-sm text-gray-500 dark:text-gray-400",B),children:i})]})]}),r("div",{className:"flex items-center gap-1 ms-auto",children:[k&&e("button",{type:"button",onClick:()=>J(re=>!re),className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white","aria-label":_,children:a?e("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M7 1H1v6m16 0V1h-6m0 16h6v-6M1 11v6h6"})}):e("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M11 1h6v6M1 11v6h6m0-12L1 1m16 16-6-6"})})}),r("button",{type:"button",onClick:l,className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white",children:[e("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"})}),e("span",{className:"sr-only",children:Z})]})]})]}),e("div",{className:t("p-4 md:p-5 space-y-4",a&&"flex-1 overflow-y-auto",I),children:x}),(d||c)&&r("div",{className:t("flex items-center gap-2 p-4 md:p-5 rounded-b",M&&"border-t border-gray-200 dark:border-gray-600",g==="right"?"justify-end":g==="center"?"justify-center":"justify-start",j&&"flex-row-reverse",R),children:[c&&e("button",{type:"button",onClick:te,className:t("text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 font-medium rounded-lg text-sm px-5 py-2.5 border border-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:bg-gray-600 dark:hover:text-white",z),children:Y}),d&&e("button",{type:"button",onClick:ee,className:t("text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-500 dark:hover:bg-blue-600",H),children:X})]})]})})})});de.displayName="Modal";export{de as Modal};
1
+ "use client";import{forwardRef as le,useId as ne,useState as se}from"react";import{createPortal as ie}from"react-dom";import{useDialogA11y as de}from"../../hooks/useDialogA11y.js";import{cn as t}from"../../lib/cn.js";import{useUILabels as ce}from"../../lib/i18n.js";import{jsx as e,jsxs as r}from"react/jsx-runtime";var ue={sm:"max-w-sm",md:"max-w-2xl",lg:"max-w-4xl",xl:"max-w-6xl",full:"max-w-full"},me=le(({isOpen:n,onClose:l,title:p,children:y,buttonLabel:w,onButtonClick:k,className:N,allowFullScreen:C=!1,showSubmit:d=!0,submitLabel:L,onSubmitClick:F,showCancel:c=!1,cancelLabel:S,onCancelClick:u,buttonsPosition:m="right",showHeaderDivider:M=!0,showFooterDivider:D=!0,description:s,icon:g,size:j="md",reverseButtons:I=!1,headerClassName:P,contentClassName:R,footerClassName:B,titleClassName:H,descriptionClassName:z,submitClassName:E,cancelClassName:T,closeLabel:W,enterFullScreenLabel:$,exitFullScreenLabel:A,"aria-label":O,closeOnEscape:U=!0,trapFocus:V=!0,initialFocus:q,returnFocus:G,lockScroll:J=!0},K)=>{let[a,Q]=se(!1),o=ce(),i=p??o.modalDefaultTitle,b=ne(),v=`${b}-title`,f=`${b}-description`,{dialogRef:X,dialogProps:Y}=de({open:n,onClose:l,closeOnEscape:U,trapFocus:V,initialFocus:q,returnFocus:G,lockScroll:J});if(!n)return null;let Z=w??L??o.confirm,_=S??o.cancel,ee=W??o.closeModal,te=a?A??o.exitFullScreen:$??o.enterFullScreen,h=k??F,re=async()=>{h&&await h(),l()},oe=async()=>{u&&await u(),l()},x=e("div",{className:t("overflow-y-auto overflow-x-hidden fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm",N),"aria-hidden":!n,children:e("div",{className:t("relative p-4 w-full max-h-full transition-all duration-300",a?"max-w-full h-full p-0":ue[j]),ref:K,children:r("div",{...Y,ref:X,"aria-labelledby":i?v:void 0,"aria-label":i?void 0:O,"aria-describedby":s?f:void 0,className:t("relative bg-white shadow dark:bg-gray-700 border-b-4 transition-all duration-300 focus:outline-none",a?"rounded-none h-full flex flex-col":"rounded-lg"),children:[r("div",{className:t("flex items-center justify-between p-4 md:p-5 rounded-t",M&&"border-b border-gray-200 dark:border-gray-600",P),children:[r("div",{className:"flex items-center gap-3",children:[g&&e("div",{className:"shrink-0 text-gray-500 dark:text-gray-400",children:g}),r("div",{children:[e("h3",{id:v,className:t("text-xl font-semibold text-gray-900 dark:text-white",H),children:i}),s&&e("p",{id:f,className:t("mt-1 text-sm text-gray-500 dark:text-gray-400",z),children:s})]})]}),r("div",{className:"flex items-center gap-1 ms-auto",children:[C&&e("button",{type:"button",onClick:()=>Q(ae=>!ae),className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white","aria-label":te,children:a?e("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M7 1H1v6m16 0V1h-6m0 16h6v-6M1 11v6h6"})}):e("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M11 1h6v6M1 11v6h6m0-12L1 1m16 16-6-6"})})}),r("button",{type:"button",onClick:l,className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white",children:[e("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"})}),e("span",{className:"sr-only",children:ee})]})]})]}),e("div",{className:t("p-4 md:p-5 space-y-4",a&&"flex-1 overflow-y-auto",R),children:y}),(d||c)&&r("div",{className:t("flex items-center gap-2 p-4 md:p-5 rounded-b",D&&"border-t border-gray-200 dark:border-gray-600",m==="right"?"justify-end":m==="center"?"justify-center":"justify-start",I&&"flex-row-reverse",B),children:[c&&e("button",{type:"button",onClick:oe,className:t("text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 font-medium rounded-lg text-sm px-5 py-2.5 border border-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:bg-gray-600 dark:hover:text-white",T),children:_}),d&&e("button",{type:"button",onClick:re,className:t("text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-500 dark:hover:bg-blue-600",E),children:Z})]})]})})});return typeof document<"u"?ie(x,document.body):x});me.displayName="Modal";export{me as Modal};
@@ -1 +1 @@
1
- "use strict";"use client";var w=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var F=(e,r)=>{for(var d in r)w(e,d,{get:r[d],enumerable:!0})},$=(e,r,d,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let c of A(r))!_.call(e,c)&&c!==d&&w(e,c,{get:()=>r[c],enumerable:!(s=P(r,c))||s.enumerable});return e};var z=e=>$(w({},"__esModule",{value:!0}),e);var U={};F(U,{Pagination:()=>T});module.exports=z(U);var N=require("react"),u=require("../../lib/cn.cjs"),n=require("react/jsx-runtime");function q(e,r,d,s){let c=d*2+1+s*2+2;if(r<=c)return Array.from({length:r},(t,g)=>g+1);let v=Array.from({length:s},(t,g)=>g+1).filter(t=>t<=r),y=Array.from({length:s},(t,g)=>r-s+1+g).filter(t=>t>=1),b=Math.max(e-d,s+1),i=Math.min(e+d,r-s),h=b>s+2,m=i<r-s-1,a=[];for(let t of v)a.push(t);if(h)a.push("ellipsis");else for(let t=s+1;t<b;t++)a.push(t);for(let t=b;t<=i;t++)a.push(t);if(m)a.push("ellipsis");else for(let t=i+1;t<=r-s;t++)a.push(t);for(let t of y)a.includes(t)||a.push(t);return a}function D({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function H({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}function J({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 19l-7-7 7-7M18 19l-7-7 7-7"})})}function K({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M6 5l7 7-7 7"})})}var O={sm:{button:"h-7 min-w-7 px-1.5 text-xs",icon:"h-3 w-3",gap:"gap-0.5",text:"text-xs"},md:{button:"h-9 min-w-9 px-2.5 text-sm",icon:"h-4 w-4",gap:"gap-1",text:"text-sm"},lg:{button:"h-11 min-w-11 px-3.5 text-base",icon:"h-5 w-5",gap:"gap-1.5",text:"text-base"}},Q={default:{base:"rounded-md font-medium transition-colors",idle:"text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700",active:"bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"},outlined:{base:"rounded-md border font-medium transition-colors",idle:"border-gray-300 text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",active:"border-blue-600 bg-blue-50 text-blue-600 hover:bg-blue-100 dark:border-blue-400 dark:bg-blue-900/30 dark:text-blue-400 dark:hover:bg-blue-900/50",disabled:"border-gray-200 text-gray-300 cursor-not-allowed dark:border-gray-700 dark:text-gray-600"},minimal:{base:"rounded-md font-medium transition-colors",idle:"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200",active:"text-blue-600 font-semibold hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"}};function T({page:e,totalPages:r,onPageChange:d,size:s="md",variant:c="default",showFirstLast:v=!1,siblings:y=1,boundaries:b=1,disabled:i=!1,labels:h,totalItems:m,pageSize:a,pageSizeOptions:t,onPageSizeChange:g,className:M,...B}){let l=O[s],f=Q[c],W=(0,N.useMemo)(()=>q(e,r,y,b),[e,r,y,b]),x=(0,N.useCallback)(o=>{i||o<1||o>r||o===e||d(o)},[i,r,e,d]),C=e<=1,L=e>=r,R=(0,u.cn)("inline-flex items-center justify-center select-none",l.button,f.base),k=(o,p,G,I)=>(0,n.jsx)("button",{type:"button",onClick:o,disabled:i||p,"aria-label":G,"aria-disabled":i||p,className:(0,u.cn)(R,i||p?f.disabled:f.idle),children:I}),j=m!==void 0&&a?(e-1)*a+1:void 0,E=m!==void 0&&a?Math.min(e*a,m):void 0;return(0,n.jsxs)("nav",{"aria-label":"Pagination",className:(0,u.cn)("flex items-center",l.gap,M),...B,children:[m!==void 0&&a&&(0,n.jsxs)("span",{className:(0,u.cn)("mr-2 text-gray-600 dark:text-gray-400 whitespace-nowrap",l.text),children:[j,"\u2013",E," of ",m]}),t&&t.length>0&&g&&(0,n.jsxs)("div",{className:(0,u.cn)("mr-2 flex items-center whitespace-nowrap",l.gap,l.text),children:[(0,n.jsx)("label",{htmlFor:"pagination-page-size",className:"text-gray-600 dark:text-gray-400",children:"Rows:"}),(0,n.jsx)("select",{id:"pagination-page-size",value:a,onChange:o=>g(Number(o.target.value)),disabled:i,className:(0,u.cn)("rounded border border-gray-300 bg-white px-1.5 py-0.5 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200",l.text,i&&"cursor-not-allowed opacity-50"),children:t.map(o=>(0,n.jsx)("option",{value:o,children:o},o))})]}),(0,n.jsxs)("div",{className:(0,u.cn)("flex items-center",l.gap),children:[v&&k(()=>x(1),C,h?.first??"Go to first page",(0,n.jsx)(J,{className:l.icon})),k(()=>x(e-1),C,h?.previous??"Go to previous page",(0,n.jsx)(D,{className:l.icon})),W.map((o,p)=>o==="ellipsis"?(0,n.jsx)("span",{className:(0,u.cn)("inline-flex items-center justify-center select-none",l.button,"text-gray-400 dark:text-gray-500"),"aria-hidden":"true",children:"\u2026"},`ellipsis-${p}`):(0,n.jsx)("button",{type:"button",onClick:()=>x(o),disabled:i,"aria-current":o===e?"page":void 0,"aria-label":`Page ${o}`,className:(0,u.cn)(R,o===e?f.active:i?f.disabled:f.idle),children:o},o)),k(()=>x(e+1),L,h?.next??"Go to next page",(0,n.jsx)(H,{className:l.icon})),v&&k(()=>x(r),L,h?.last??"Go to last page",(0,n.jsx)(K,{className:l.icon}))]})]})}0&&(module.exports={Pagination});
1
+ "use strict";"use client";var L=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var z=(e,r)=>{for(var u in r)L(e,u,{get:r[u],enumerable:!0})},$=(e,r,u,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let c of _(r))!O.call(e,c)&&c!==u&&L(e,c,{get:()=>r[c],enumerable:!(i=F(r,c))||i.enumerable});return e};var q=e=>$(L({},"__esModule",{value:!0}),e);var X={};z(X,{Pagination:()=>V});module.exports=q(X);var C=require("react"),d=require("../../lib/cn.cjs"),y=require("../../lib/i18n.cjs"),n=require("react/jsx-runtime");function D(e,r,u,i){let c=u*2+1+i*2+2;if(r<=c)return Array.from({length:r},(t,g)=>g+1);let k=Array.from({length:i},(t,g)=>g+1).filter(t=>t<=r),N=Array.from({length:i},(t,g)=>r-i+1+g).filter(t=>t>=1),h=Math.max(e-u,i+1),s=Math.min(e+u,r-i),b=h>i+2,p=s<r-i-1,o=[];for(let t of k)o.push(t);if(b)o.push("ellipsis");else for(let t=i+1;t<h;t++)o.push(t);for(let t=h;t<=s;t++)o.push(t);if(p)o.push("ellipsis");else for(let t=s+1;t<=r-i;t++)o.push(t);for(let t of N)o.includes(t)||o.push(t);return o}function G({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function H({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}function J({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 19l-7-7 7-7M18 19l-7-7 7-7"})})}function K({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M6 5l7 7-7 7"})})}var Q={sm:{button:"h-7 min-w-7 px-1.5 text-xs",icon:"h-3 w-3",gap:"gap-0.5",text:"text-xs"},md:{button:"h-9 min-w-9 px-2.5 text-sm",icon:"h-4 w-4",gap:"gap-1",text:"text-sm"},lg:{button:"h-11 min-w-11 px-3.5 text-base",icon:"h-5 w-5",gap:"gap-1.5",text:"text-base"}},T={default:{base:"rounded-md font-medium transition-colors",idle:"text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700",active:"bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"},outlined:{base:"rounded-md border font-medium transition-colors",idle:"border-gray-300 text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",active:"border-blue-600 bg-blue-50 text-blue-600 hover:bg-blue-100 dark:border-blue-400 dark:bg-blue-900/30 dark:text-blue-400 dark:hover:bg-blue-900/50",disabled:"border-gray-200 text-gray-300 cursor-not-allowed dark:border-gray-700 dark:text-gray-600"},minimal:{base:"rounded-md font-medium transition-colors",idle:"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200",active:"text-blue-600 font-semibold hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"}};function V({page:e,totalPages:r,onPageChange:u,size:i="md",variant:c="default",showFirstLast:k=!1,siblings:N=1,boundaries:h=1,disabled:s=!1,labels:b,totalItems:p,pageSize:o,pageSizeOptions:t,onPageSizeChange:g,className:I,...P}){let m=(0,y.useUILabels)(b),l=Q[i],f=T[c],W=(0,C.useMemo)(()=>D(e,r,N,h),[e,r,N,h]),x=(0,C.useCallback)(a=>{s||a<1||a>r||a===e||u(a)},[s,r,e,u]),R=e<=1,M=e>=r,B=(0,d.cn)("inline-flex items-center justify-center select-none",l.button,f.base),w=(a,v,U,A)=>(0,n.jsx)("button",{type:"button",onClick:a,disabled:s||v,"aria-label":U,"aria-disabled":s||v,className:(0,d.cn)(B,s||v?f.disabled:f.idle),children:A}),j=p!==void 0&&o?(e-1)*o+1:void 0,E=p!==void 0&&o?Math.min(e*o,p):void 0;return(0,n.jsxs)("nav",{"aria-label":m.paginationLabel,className:(0,d.cn)("flex items-center",l.gap,I),...P,children:[p!==void 0&&o&&(0,n.jsx)("span",{className:(0,d.cn)("mr-2 text-gray-600 dark:text-gray-400 whitespace-nowrap",l.text),children:(0,y.formatUILabel)(m.paginationRange,{start:j??0,end:E??0,total:p})}),t&&t.length>0&&g&&(0,n.jsxs)("div",{className:(0,d.cn)("mr-2 flex items-center whitespace-nowrap",l.gap,l.text),children:[(0,n.jsx)("label",{htmlFor:"pagination-page-size",className:"text-gray-600 dark:text-gray-400",children:m.paginationRowsPerPage}),(0,n.jsx)("select",{id:"pagination-page-size",value:o,onChange:a=>g(Number(a.target.value)),disabled:s,className:(0,d.cn)("rounded border border-gray-300 bg-white px-1.5 py-0.5 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200",l.text,s&&"cursor-not-allowed opacity-50"),children:t.map(a=>(0,n.jsx)("option",{value:a,children:a},a))})]}),(0,n.jsxs)("div",{className:(0,d.cn)("flex items-center",l.gap),children:[k&&w(()=>x(1),R,b?.first??m.paginationFirst,(0,n.jsx)(J,{className:l.icon})),w(()=>x(e-1),R,b?.previous??m.paginationPrevious,(0,n.jsx)(G,{className:l.icon})),W.map((a,v)=>a==="ellipsis"?(0,n.jsx)("span",{className:(0,d.cn)("inline-flex items-center justify-center select-none",l.button,"text-gray-400 dark:text-gray-500"),"aria-hidden":"true",children:"\u2026"},`ellipsis-${v}`):(0,n.jsx)("button",{type:"button",onClick:()=>x(a),disabled:s,"aria-current":a===e?"page":void 0,"aria-label":(0,y.formatUILabel)(m.paginationPage,{page:a}),className:(0,d.cn)(B,a===e?f.active:s?f.disabled:f.idle),children:a},a)),w(()=>x(e+1),M,b?.next??m.paginationNext,(0,n.jsx)(H,{className:l.icon})),k&&w(()=>x(r),M,b?.last??m.paginationLast,(0,n.jsx)(K,{className:l.icon}))]})]})}0&&(module.exports={Pagination});
@@ -1 +1 @@
1
- "use client";import{useCallback as I,useMemo as P}from"react";import{cn as d}from"../../lib/cn.js";import{jsx as n,jsxs as k}from"react/jsx-runtime";function A(t,a,g,i){let N=g*2+1+i*2+2;if(a<=N)return Array.from({length:a},(e,u)=>u+1);let p=Array.from({length:i},(e,u)=>u+1).filter(e=>e<=a),v=Array.from({length:i},(e,u)=>a-i+1+u).filter(e=>e>=1),m=Math.max(t-g,i+1),s=Math.min(t+g,a-i),b=m>i+2,c=s<a-i-1,o=[];for(let e of p)o.push(e);if(b)o.push("ellipsis");else for(let e=i+1;e<m;e++)o.push(e);for(let e=m;e<=s;e++)o.push(e);if(c)o.push("ellipsis");else for(let e=s+1;e<=a-i;e++)o.push(e);for(let e of v)o.includes(e)||o.push(e);return o}function _({className:t}){return n("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function F({className:t}){return n("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}function $({className:t}){return n("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 19l-7-7 7-7M18 19l-7-7 7-7"})})}function z({className:t}){return n("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M6 5l7 7-7 7"})})}var q={sm:{button:"h-7 min-w-7 px-1.5 text-xs",icon:"h-3 w-3",gap:"gap-0.5",text:"text-xs"},md:{button:"h-9 min-w-9 px-2.5 text-sm",icon:"h-4 w-4",gap:"gap-1",text:"text-sm"},lg:{button:"h-11 min-w-11 px-3.5 text-base",icon:"h-5 w-5",gap:"gap-1.5",text:"text-base"}},D={default:{base:"rounded-md font-medium transition-colors",idle:"text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700",active:"bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"},outlined:{base:"rounded-md border font-medium transition-colors",idle:"border-gray-300 text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",active:"border-blue-600 bg-blue-50 text-blue-600 hover:bg-blue-100 dark:border-blue-400 dark:bg-blue-900/30 dark:text-blue-400 dark:hover:bg-blue-900/50",disabled:"border-gray-200 text-gray-300 cursor-not-allowed dark:border-gray-700 dark:text-gray-600"},minimal:{base:"rounded-md font-medium transition-colors",idle:"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200",active:"text-blue-600 font-semibold hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"}};function K({page:t,totalPages:a,onPageChange:g,size:i="md",variant:N="default",showFirstLast:p=!1,siblings:v=1,boundaries:m=1,disabled:s=!1,labels:b,totalItems:c,pageSize:o,pageSizeOptions:e,onPageSizeChange:u,className:R,...M}){let l=q[i],h=D[N],B=P(()=>A(t,a,v,m),[t,a,v,m]),f=I(r=>{s||r<1||r>a||r===t||g(r)},[s,a,t,g]),w=t<=1,C=t>=a,L=d("inline-flex items-center justify-center select-none",l.button,h.base),y=(r,x,E,G)=>n("button",{type:"button",onClick:r,disabled:s||x,"aria-label":E,"aria-disabled":s||x,className:d(L,s||x?h.disabled:h.idle),children:G}),W=c!==void 0&&o?(t-1)*o+1:void 0,j=c!==void 0&&o?Math.min(t*o,c):void 0;return k("nav",{"aria-label":"Pagination",className:d("flex items-center",l.gap,R),...M,children:[c!==void 0&&o&&k("span",{className:d("mr-2 text-gray-600 dark:text-gray-400 whitespace-nowrap",l.text),children:[W,"\u2013",j," of ",c]}),e&&e.length>0&&u&&k("div",{className:d("mr-2 flex items-center whitespace-nowrap",l.gap,l.text),children:[n("label",{htmlFor:"pagination-page-size",className:"text-gray-600 dark:text-gray-400",children:"Rows:"}),n("select",{id:"pagination-page-size",value:o,onChange:r=>u(Number(r.target.value)),disabled:s,className:d("rounded border border-gray-300 bg-white px-1.5 py-0.5 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200",l.text,s&&"cursor-not-allowed opacity-50"),children:e.map(r=>n("option",{value:r,children:r},r))})]}),k("div",{className:d("flex items-center",l.gap),children:[p&&y(()=>f(1),w,b?.first??"Go to first page",n($,{className:l.icon})),y(()=>f(t-1),w,b?.previous??"Go to previous page",n(_,{className:l.icon})),B.map((r,x)=>r==="ellipsis"?n("span",{className:d("inline-flex items-center justify-center select-none",l.button,"text-gray-400 dark:text-gray-500"),"aria-hidden":"true",children:"\u2026"},`ellipsis-${x}`):n("button",{type:"button",onClick:()=>f(r),disabled:s,"aria-current":r===t?"page":void 0,"aria-label":`Page ${r}`,className:d(L,r===t?h.active:s?h.disabled:h.idle),children:r},r)),y(()=>f(t+1),C,b?.next??"Go to next page",n(F,{className:l.icon})),p&&y(()=>f(a),C,b?.last??"Go to last page",n(z,{className:l.icon}))]})]})}export{K as Pagination};
1
+ "use client";import{useCallback as A,useMemo as F}from"react";import{cn as u}from"../../lib/cn.js";import{formatUILabel as M,useUILabels as _}from"../../lib/i18n.js";import{jsx as n,jsxs as w}from"react/jsx-runtime";function O(t,o,b,s){let N=b*2+1+s*2+2;if(o<=N)return Array.from({length:o},(e,d)=>d+1);let v=Array.from({length:s},(e,d)=>d+1).filter(e=>e<=o),y=Array.from({length:s},(e,d)=>o-s+1+d).filter(e=>e>=1),p=Math.max(t-b,s+1),i=Math.min(t+b,o-s),g=p>s+2,m=i<o-s-1,a=[];for(let e of v)a.push(e);if(g)a.push("ellipsis");else for(let e=s+1;e<p;e++)a.push(e);for(let e=p;e<=i;e++)a.push(e);if(m)a.push("ellipsis");else for(let e=i+1;e<=o-s;e++)a.push(e);for(let e of y)a.includes(e)||a.push(e);return a}function z({className:t}){return n("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function $({className:t}){return n("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}function q({className:t}){return n("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 19l-7-7 7-7M18 19l-7-7 7-7"})})}function D({className:t}){return n("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M6 5l7 7-7 7"})})}var G={sm:{button:"h-7 min-w-7 px-1.5 text-xs",icon:"h-3 w-3",gap:"gap-0.5",text:"text-xs"},md:{button:"h-9 min-w-9 px-2.5 text-sm",icon:"h-4 w-4",gap:"gap-1",text:"text-sm"},lg:{button:"h-11 min-w-11 px-3.5 text-base",icon:"h-5 w-5",gap:"gap-1.5",text:"text-base"}},H={default:{base:"rounded-md font-medium transition-colors",idle:"text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700",active:"bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"},outlined:{base:"rounded-md border font-medium transition-colors",idle:"border-gray-300 text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",active:"border-blue-600 bg-blue-50 text-blue-600 hover:bg-blue-100 dark:border-blue-400 dark:bg-blue-900/30 dark:text-blue-400 dark:hover:bg-blue-900/50",disabled:"border-gray-200 text-gray-300 cursor-not-allowed dark:border-gray-700 dark:text-gray-600"},minimal:{base:"rounded-md font-medium transition-colors",idle:"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200",active:"text-blue-600 font-semibold hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"}};function T({page:t,totalPages:o,onPageChange:b,size:s="md",variant:N="default",showFirstLast:v=!1,siblings:y=1,boundaries:p=1,disabled:i=!1,labels:g,totalItems:m,pageSize:a,pageSizeOptions:e,onPageSizeChange:d,className:B,...I}){let c=_(g),l=G[s],h=H[N],P=F(()=>O(t,o,y,p),[t,o,y,p]),f=A(r=>{i||r<1||r>o||r===t||b(r)},[i,o,t,b]),C=t<=1,L=t>=o,R=u("inline-flex items-center justify-center select-none",l.button,h.base),k=(r,x,E,U)=>n("button",{type:"button",onClick:r,disabled:i||x,"aria-label":E,"aria-disabled":i||x,className:u(R,i||x?h.disabled:h.idle),children:U}),W=m!==void 0&&a?(t-1)*a+1:void 0,j=m!==void 0&&a?Math.min(t*a,m):void 0;return w("nav",{"aria-label":c.paginationLabel,className:u("flex items-center",l.gap,B),...I,children:[m!==void 0&&a&&n("span",{className:u("mr-2 text-gray-600 dark:text-gray-400 whitespace-nowrap",l.text),children:M(c.paginationRange,{start:W??0,end:j??0,total:m})}),e&&e.length>0&&d&&w("div",{className:u("mr-2 flex items-center whitespace-nowrap",l.gap,l.text),children:[n("label",{htmlFor:"pagination-page-size",className:"text-gray-600 dark:text-gray-400",children:c.paginationRowsPerPage}),n("select",{id:"pagination-page-size",value:a,onChange:r=>d(Number(r.target.value)),disabled:i,className:u("rounded border border-gray-300 bg-white px-1.5 py-0.5 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200",l.text,i&&"cursor-not-allowed opacity-50"),children:e.map(r=>n("option",{value:r,children:r},r))})]}),w("div",{className:u("flex items-center",l.gap),children:[v&&k(()=>f(1),C,g?.first??c.paginationFirst,n(q,{className:l.icon})),k(()=>f(t-1),C,g?.previous??c.paginationPrevious,n(z,{className:l.icon})),P.map((r,x)=>r==="ellipsis"?n("span",{className:u("inline-flex items-center justify-center select-none",l.button,"text-gray-400 dark:text-gray-500"),"aria-hidden":"true",children:"\u2026"},`ellipsis-${x}`):n("button",{type:"button",onClick:()=>f(r),disabled:i,"aria-current":r===t?"page":void 0,"aria-label":M(c.paginationPage,{page:r}),className:u(R,r===t?h.active:i?h.disabled:h.idle),children:r},r)),k(()=>f(t+1),L,g?.next??c.paginationNext,n($,{className:l.icon})),v&&k(()=>f(o),L,g?.last??c.paginationLast,n(D,{className:l.icon}))]})]})}export{T as Pagination};
@@ -1 +1 @@
1
- "use strict";"use client";var H=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var de=Object.prototype.hasOwnProperty;var he=(i,t)=>{for(var a in t)H(i,a,{get:t[a],enumerable:!0})},me=(i,t,a,C)=>{if(t&&typeof t=="object"||typeof t=="function")for(let m of ce(t))!de.call(i,m)&&m!==a&&H(i,m,{get:()=>t[m],enumerable:!(C=ue(t,m))||C.enumerable});return i};var ge=i=>me(H({},"__esModule",{value:!0}),i);var ve={};he(ve,{PieChart:()=>Pe,resetPieWarnings:()=>xe});module.exports=ge(ve);var h=require("react"),Z=require("../../lib/i18n.cjs"),ee=require("../chart/ChartContainer.cjs"),te=require("../chart/ChartLegend.cjs"),B=require("../chart/ChartPatterns.cjs"),ae=require("../chart/ChartTableView.cjs"),T=require("../chart/ChartTooltip.cjs"),$=require("../chart/palette.cjs"),N=require("../chart/utils/data.cjs"),x=require("../chart/utils/format.cjs"),oe=require("../chart/utils/path.cjs"),o=require("react/jsx-runtime"),pe=.62,fe=2,be=3,ye=.16,Ce=64,ke=22,U=6,F=!1;function Ae({width:i,height:t,slices:a,variant:C,innerRadius:m,showLabels:k,centerLabel:A,tooltip:P,patterns:w,patternBaseId:M,plotLabel:E,formatValue:L,locale:D,onSliceClick:_}){let[p,v]=(0,h.useState)(null),V=(0,h.useMemo)(()=>{let e=k?Ce:8,n=k?ke:8,l=Math.max(0,Math.min((i-e*2)/2,(t-n*2)/2));return{cx:i/2,cy:t/2,outerRadius:l,inner:C==="donut"?l*(m??pe):(m??0)*l,pad:l>0&&a.length>1?fe/l/2:0}},[i,t,C,m,k,a.length]),{cx:g,cy:b,outerRadius:f,inner:O,pad:S}=V,K=(0,h.useCallback)(e=>{let n=(e.startAngle+e.endAngle)/2,l=Math.sin(n)>=0,d={x:g+Math.sin(n)*(f+4),y:b-Math.cos(n)*(f+4)},y={x:g+Math.sin(n)*(f+14),y:b-Math.cos(n)*(f+14)},I={x:l?y.x+10:y.x-10,y:y.y};return{from:d,elbow:y,end:I,anchor:l?"start":"end"}},[g,b,f]),X=(0,h.useCallback)(e=>{if(a.length===0)return;let n=a.length-1,l=p??0,d=e.key==="ArrowRight"||e.key==="ArrowDown"?Math.min(n,l+1):e.key==="ArrowLeft"||e.key==="ArrowUp"?Math.max(0,l-1):e.key==="Home"?0:e.key==="End"?n:e.key==="Escape"?null:void 0;d!==void 0&&(e.preventDefault(),v(d))},[a.length,p]),r=p===null?null:a[p];return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("svg",{width:i,height:t,role:"img","aria-label":E??a.map(e=>e.label).join(", "),tabIndex:0,className:"touch-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",onPointerLeave:()=>v(null),onBlur:()=>v(null),onKeyDown:X,children:[w?(0,o.jsx)(B.ChartPatternDefs,{id:M,entries:a.map(e=>({slot:e.slot,color:e.color}))}):null,a.map((e,n)=>(0,o.jsx)("path",{d:(0,oe.buildArcPath)({cx:g,cy:b,innerRadius:O,outerRadius:f+(p===n?be:0),startAngle:e.startAngle+S,endAngle:Math.max(e.startAngle+S,e.endAngle-S)}),fill:(0,B.patternFill)(w,M,e.slot,e.color),onPointerEnter:()=>P===!1?void 0:v(n),onClick:()=>_?.({key:e.key,label:e.label,value:e.value,share:e.share})},e.key)),k?a.filter(e=>e.endAngle-e.startAngle>=ye).map(e=>{let{from:n,elbow:l,end:d,anchor:y}=K(e);return(0,o.jsxs)("g",{"aria-hidden":"true",children:[(0,o.jsx)("polyline",{points:`${n.x},${n.y} ${l.x},${l.y} ${d.x},${d.y}`,fill:"none",className:"stroke-gray-300 dark:stroke-gray-600",strokeWidth:1}),(0,o.jsx)("text",{x:y==="start"?d.x+3:d.x-3,y:d.y,textAnchor:y,dominantBaseline:"middle",className:"fill-gray-600 text-[10px] dark:fill-gray-300",children:e.label})]},`label-${e.key}`)}):null,C==="donut"&&A?(0,o.jsxs)("g",{"aria-hidden":"true",children:[(0,o.jsx)("text",{x:g,y:b-(A.label?2:0),textAnchor:"middle",dominantBaseline:"middle",className:"fill-gray-900 text-lg font-semibold dark:fill-gray-100",children:A.value}),A.label?(0,o.jsx)("text",{x:g,y:b+14,textAnchor:"middle",dominantBaseline:"middle",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:A.label}):null]}):null]}),r&&P!==!1?(0,o.jsx)(T.ChartTooltip,{x:g+Math.sin((r.startAngle+r.endAngle)/2)*(f*.7),y:b-Math.cos((r.startAngle+r.endAngle)/2)*(f*.7),containerWidth:i,children:typeof P=="function"?P({seriesKey:r.key,seriesLabel:r.label,color:r.color,value:r.value,formattedValue:L(r.value),datum:{},share:r.share}):(0,o.jsx)(T.ChartTooltipContent,{title:r.label,points:[{seriesKey:r.key,seriesLabel:(0,x.formatPercent)(r.share,{locale:D}),color:r.color,value:r.value,formattedValue:L(r.value),datum:{}}]})}):null]})}function Pe({data:i,x:t,value:a,variant:C="pie",innerRadius:m,maxSlices:k=U,otherLabel:A,sort:P="desc",showLabels:w=!0,centerLabel:M,patterns:E=!1,height:L=260,width:D,size:_="md",legend:p,tooltip:v=!0,tableView:V=!1,title:g,description:b,loading:f=!1,emptyState:O,error:S=!1,errorState:K,onRetry:X,actions:r,locale:e,plotLabel:n,onSliceClick:l,className:d,...y}){let I=(0,Z.useUILabels)(),re=(0,h.useId)(),j=(0,h.useCallback)(u=>(0,x.formatAuto)(u,e),[e]),q=(0,h.useCallback)(u=>t.format?t.format(u,0):(0,x.formatXValue)(u,e),[t,e]),{slices:W,total:ne,rows:le}=(0,h.useMemo)(()=>{let u=i.map((s,c)=>({key:String((0,N.readXValue)(s,t.key,c)),label:q((0,N.readXValue)(s,t.key,c)),value:(0,N.readNumber)(s,a)??0,color:(0,$.getSeriesColor)(c),slot:c,datum:s})),Q=P==="none"?u:[...u].sort((s,c)=>P==="asc"?s.value-c.value:c.value-s.value),R=Q.slice(0,k),Y=Q.slice(k);Y.length>0&&R.push({key:"__other__",label:A??I.chartOther,value:Y.reduce((s,c)=>s+c.value,0),color:$.CHART_MUTED_COLOR,slot:-1,datum:{}}),R.length>U&&!F&&(F=!0,console.warn(`[@synertech/ui] A PieChart is drawing ${R.length} slices. Past ${U} the slices stop being tellable apart: lower \`maxSlices\`, or use a BarChart, which compares lengths rather than angles.`));let z=R.reduce((s,c)=>s+Math.max(0,c.value),0),G=0;return{slices:R.map(s=>{let c=z===0?0:Math.max(0,s.value)/z,ie=G;return G+=c*Math.PI*2,{...s,share:c,startAngle:ie,endAngle:G}}),total:z,rows:R.map(s=>({[t.key]:s.label,[a]:s.value}))}},[i,t.key,a,P,k,A,I.chartOther,q]),se=p===void 0?!0:p!==!1,J=typeof p=="string"?p:"bottom";return(0,o.jsx)(ee.ChartContainer,{title:g,description:b,height:L,width:D,size:_,loading:f,empty:W.length===0||ne===0,emptyState:O,error:S,errorState:K,onRetry:X,actions:r,tableView:V,legendPosition:J,legend:se?(0,o.jsx)(te.ChartLegend,{items:W.map(u=>({key:u.key,label:`${u.label} \xB7 ${(0,x.formatPercent)(u.share,{locale:e})}`,color:u.color,...E?{pattern:u.slot}:{}})),position:J,marker:"rect",size:_}):void 0,table:V?(0,o.jsx)(ae.ChartTableView,{data:le,series:[{key:a,label:t.label??a}],xKey:t.key,xLabel:t.label??t.key,formatValue:j,caption:typeof g=="string"?g:void 0}):void 0,className:d,...y,children:({width:u})=>(0,o.jsx)(Ae,{width:u,height:L,slices:W,variant:C,innerRadius:m,showLabels:w,centerLabel:M,tooltip:v,patterns:E,patternBaseId:re,plotLabel:n,formatValue:j,locale:e,onSliceClick:l})})}function xe(){F=!1}0&&(module.exports={PieChart,resetPieWarnings});
1
+ "use strict";"use client";var F=Object.defineProperty;var he=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var de=Object.prototype.hasOwnProperty;var pe=(s,t)=>{for(var a in t)F(s,a,{get:t[a],enumerable:!0})},ge=(s,t,a,C)=>{if(t&&typeof t=="object"||typeof t=="function")for(let m of me(t))!de.call(s,m)&&m!==a&&F(s,m,{get:()=>t[m],enumerable:!(C=he(t,m))||C.enumerable});return s};var be=s=>ge(F({},"__esModule",{value:!0}),s);var Le={};pe(Le,{PieChart:()=>Re,resetPieWarnings:()=>xe});module.exports=be(Le);var h=require("react"),ee=require("../../lib/i18n.cjs"),te=require("../chart/ChartContainer.cjs"),ae=require("../chart/ChartLegend.cjs"),O=require("../chart/ChartPatterns.cjs"),oe=require("../chart/ChartTableView.cjs"),D=require("../chart/ChartTooltip.cjs"),K=require("../chart/palette.cjs"),V=require("../chart/utils/data.cjs"),L=require("../chart/utils/format.cjs"),ne=require("../chart/utils/keyboard.cjs"),re=require("../chart/utils/path.cjs"),le=require("../chart/utils/touch.cjs"),n=require("react/jsx-runtime"),fe=.62,ye=2,Ce=3,ve=.16,Ae=64,ke=22,j=6,q=!1;function Pe({width:s,height:t,slices:a,variant:C,innerRadius:m,showLabels:v,centerLabel:A,tooltip:k,patterns:I,patternBaseId:T,plotLabel:$,formatValue:M,locale:X,onSliceClick:x}){let[P,N]=(0,h.useState)(null),d=P!==null&&P<a.length?P:null,w=(0,h.useMemo)(()=>{let e=v?Ae:8,o=v?ke:8,u=Math.max(0,Math.min((s-e*2)/2,(t-o*2)/2));return{cx:s/2,cy:t/2,outerRadius:u,inner:C==="donut"?u*(m??fe):(m??0)*u,pad:u>0&&a.length>1?ye/u/2:0}},[s,t,C,m,v,a.length]),{cx:b,cy:f,outerRadius:p,inner:W,pad:E}=w,z=(0,h.useCallback)(e=>{let o=(e.startAngle+e.endAngle)/2,u=Math.sin(o)>=0,g={x:b+Math.sin(o)*(p+4),y:f-Math.cos(o)*(p+4)},y={x:b+Math.sin(o)*(p+14),y:f-Math.cos(o)*(p+14)},B={x:u?y.x+10:y.x-10,y:y.y};return{from:g,elbow:y,end:B,anchor:u?"start":"end"}},[b,f,p]),_=(0,h.useCallback)(e=>{let o=a[e];o&&x?.({key:o.key,label:o.label,value:o.value,share:o.share})},[a,x]),R=(0,h.useCallback)(e=>(0,ne.handleChartKeyDown)(e,{count:a.length,current:d,axis:"both",onMove:N,pick:x&&d!==null?()=>_(d):null}),[a.length,d,x,_]),r=d===null?null:a[d];return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("svg",{width:s,height:t,role:"img","aria-label":$??a.map(e=>e.label).join(", "),tabIndex:0,className:`${le.CHART_TOUCH} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500`,onPointerLeave:()=>N(null),onBlur:()=>N(null),onKeyDown:R,children:[I?(0,n.jsx)(O.ChartPatternDefs,{id:T,entries:a.map(e=>({slot:e.slot,color:e.color}))}):null,a.map((e,o)=>(0,n.jsx)("path",{d:(0,re.buildArcPath)({cx:b,cy:f,innerRadius:W,outerRadius:p+(d===o?Ce:0),startAngle:e.startAngle+E,endAngle:Math.max(e.startAngle+E,e.endAngle-E)}),fill:(0,O.patternFill)(I,T,e.slot,e.color),onPointerEnter:()=>k===!1?void 0:N(o),onClick:()=>_(o)},e.key)),v?a.filter(e=>e.endAngle-e.startAngle>=ve).map(e=>{let{from:o,elbow:u,end:g,anchor:y}=z(e);return(0,n.jsxs)("g",{"aria-hidden":"true",children:[(0,n.jsx)("polyline",{points:`${o.x},${o.y} ${u.x},${u.y} ${g.x},${g.y}`,fill:"none",className:"stroke-gray-300 dark:stroke-gray-600",strokeWidth:1}),(0,n.jsx)("text",{x:y==="start"?g.x+3:g.x-3,y:g.y,textAnchor:y,dominantBaseline:"middle",className:"fill-gray-600 text-[10px] dark:fill-gray-300",children:e.label})]},`label-${e.key}`)}):null,C==="donut"&&A?(0,n.jsxs)("g",{"aria-hidden":"true",children:[(0,n.jsx)("text",{x:b,y:f-(A.label?2:0),textAnchor:"middle",dominantBaseline:"middle",className:"fill-gray-900 text-lg font-semibold dark:fill-gray-100",children:A.value}),A.label?(0,n.jsx)("text",{x:b,y:f+14,textAnchor:"middle",dominantBaseline:"middle",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:A.label}):null]}):null]}),r&&k!==!1?(0,n.jsx)(D.ChartTooltip,{x:b+Math.sin((r.startAngle+r.endAngle)/2)*(p*.7),y:f-Math.cos((r.startAngle+r.endAngle)/2)*(p*.7),containerWidth:s,children:typeof k=="function"?k({seriesKey:r.key,seriesLabel:r.label,color:r.color,value:r.value,formattedValue:M(r.value),datum:{},share:r.share}):(0,n.jsx)(D.ChartTooltipContent,{title:r.label,points:[{seriesKey:r.key,seriesLabel:(0,L.formatPercent)(r.share,{locale:X}),color:r.color,value:r.value,formattedValue:M(r.value),datum:{}}]})}):null]})}function Re({data:s,x:t,value:a,variant:C="pie",innerRadius:m,maxSlices:v=j,otherLabel:A,sort:k="desc",showLabels:I=!0,centerLabel:T,patterns:$=!1,height:M=260,width:X,size:x="md",legend:P,tooltip:N=!0,tableView:d=!1,title:w,description:b,loading:f=!1,emptyState:p,error:W=!1,errorState:E,onRetry:z,actions:_,locale:R,plotLabel:r,onSliceClick:e,className:o,...u}){let g=(0,ee.useUILabels)(),y=(0,h.useId)(),B=(0,h.useCallback)(i=>(0,L.formatAuto)(i,R),[R]),J=(0,h.useCallback)(i=>t.format?t.format(i,0):(0,L.formatXValue)(i,R),[t,R]),{slices:G,total:se,rows:ie}=(0,h.useMemo)(()=>{let i=s.map((l,c)=>({key:String((0,V.readXValue)(l,t.key,c)),label:J((0,V.readXValue)(l,t.key,c)),value:(0,V.readNumber)(l,a)??0,color:(0,K.getSeriesColor)(c),slot:c,datum:l})),Y=k==="none"?i:[...i].sort((l,c)=>k==="asc"?l.value-c.value:c.value-l.value),S=Y.slice(0,v),Z=Y.slice(v);Z.length>0&&S.push({key:"__other__",label:A??g.chartOther,value:Z.reduce((l,c)=>l+c.value,0),color:K.CHART_MUTED_COLOR,slot:-1,datum:{}}),S.length>j&&!q&&(q=!0,console.warn(`[@synertech/ui] A PieChart is drawing ${S.length} slices. Past ${j} the slices stop being tellable apart: lower \`maxSlices\`, or use a BarChart, which compares lengths rather than angles.`));let H=S.reduce((l,c)=>l+Math.max(0,c.value),0),U=0;return{slices:S.map(l=>{let c=H===0?0:Math.max(0,l.value)/H,ce=U;return U+=c*Math.PI*2,{...l,share:c,startAngle:ce,endAngle:U}}),total:H,rows:S.map(l=>({[t.key]:l.label,[a]:l.value}))}},[s,t.key,a,k,v,A,g.chartOther,J]),ue=P===void 0?!0:P!==!1,Q=typeof P=="string"?P:"bottom";return(0,n.jsx)(te.ChartContainer,{title:w,description:b,height:M,width:X,size:x,loading:f,empty:G.length===0||se===0,emptyState:p,error:W,errorState:E,onRetry:z,actions:_,tableView:d,legendPosition:Q,legend:ue?(0,n.jsx)(ae.ChartLegend,{items:G.map(i=>({key:i.key,label:`${i.label} \xB7 ${(0,L.formatPercent)(i.share,{locale:R})}`,color:i.color,...$?{pattern:i.slot}:{}})),position:Q,marker:"rect",size:x}):void 0,table:d?(0,n.jsx)(oe.ChartTableView,{data:ie,series:[{key:a,label:t.label??a}],xKey:t.key,xLabel:t.label??t.key,formatValue:B,caption:typeof w=="string"?w:void 0}):void 0,className:o,...u,children:({width:i})=>(0,n.jsx)(Pe,{width:i,height:M,slices:G,variant:C,innerRadius:m,showLabels:I,centerLabel:T,tooltip:N,patterns:$,patternBaseId:y,plotLabel:r,formatValue:B,locale:R,onSliceClick:e})})}function xe(){q=!1}0&&(module.exports={PieChart,resetPieWarnings});
@@ -1 +1 @@
1
- "use client";import{useCallback as V,useId as ae,useMemo as q,useState as oe}from"react";import{useUILabels as re}from"../../lib/i18n.js";import{ChartContainer as ne}from"../chart/ChartContainer.js";import{ChartLegend as le}from"../chart/ChartLegend.js";import{ChartPatternDefs as se,patternFill as ie}from"../chart/ChartPatterns.js";import{ChartTableView as ue}from"../chart/ChartTableView.js";import{ChartTooltip as ce,ChartTooltipContent as de}from"../chart/ChartTooltip.js";import{CHART_MUTED_COLOR as he,getSeriesColor as me}from"../chart/palette.js";import{readNumber as ge,readXValue as j}from"../chart/utils/data.js";import{formatAuto as pe,formatPercent as J,formatXValue as fe}from"../chart/utils/format.js";import{buildArcPath as be}from"../chart/utils/path.js";import{Fragment as Re,jsx as c,jsxs as _}from"react/jsx-runtime";var ye=.62,Ce=2,ke=3,Ae=.16,Pe=64,xe=22,X=6,W=!1;function ve({width:f,height:n,slices:l,variant:P,innerRadius:x,showLabels:b,centerLabel:y,tooltip:C,patterns:L,patternBaseId:S,plotLabel:N,formatValue:v,locale:I,onSliceClick:w}){let[h,k]=oe(null),M=q(()=>{let e=b?Pe:8,a=b?xe:8,o=Math.max(0,Math.min((f-e*2)/2,(n-a*2)/2));return{cx:f/2,cy:n/2,outerRadius:o,inner:P==="donut"?o*(x??ye):(x??0)*o,pad:o>0&&l.length>1?Ce/o/2:0}},[f,n,P,x,b,l.length]),{cx:d,cy:g,outerRadius:m,inner:B,pad:R}=M,T=V(e=>{let a=(e.startAngle+e.endAngle)/2,o=Math.sin(a)>=0,u={x:d+Math.sin(a)*(m+4),y:g-Math.cos(a)*(m+4)},p={x:d+Math.sin(a)*(m+14),y:g-Math.cos(a)*(m+14)},E={x:o?p.x+10:p.x-10,y:p.y};return{from:u,elbow:p,end:E,anchor:o?"start":"end"}},[d,g,m]),$=V(e=>{if(l.length===0)return;let a=l.length-1,o=h??0,u=e.key==="ArrowRight"||e.key==="ArrowDown"?Math.min(a,o+1):e.key==="ArrowLeft"||e.key==="ArrowUp"?Math.max(0,o-1):e.key==="Home"?0:e.key==="End"?a:e.key==="Escape"?null:void 0;u!==void 0&&(e.preventDefault(),k(u))},[l.length,h]),t=h===null?null:l[h];return _(Re,{children:[_("svg",{width:f,height:n,role:"img","aria-label":N??l.map(e=>e.label).join(", "),tabIndex:0,className:"touch-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",onPointerLeave:()=>k(null),onBlur:()=>k(null),onKeyDown:$,children:[L?c(se,{id:S,entries:l.map(e=>({slot:e.slot,color:e.color}))}):null,l.map((e,a)=>c("path",{d:be({cx:d,cy:g,innerRadius:B,outerRadius:m+(h===a?ke:0),startAngle:e.startAngle+R,endAngle:Math.max(e.startAngle+R,e.endAngle-R)}),fill:ie(L,S,e.slot,e.color),onPointerEnter:()=>C===!1?void 0:k(a),onClick:()=>w?.({key:e.key,label:e.label,value:e.value,share:e.share})},e.key)),b?l.filter(e=>e.endAngle-e.startAngle>=Ae).map(e=>{let{from:a,elbow:o,end:u,anchor:p}=T(e);return _("g",{"aria-hidden":"true",children:[c("polyline",{points:`${a.x},${a.y} ${o.x},${o.y} ${u.x},${u.y}`,fill:"none",className:"stroke-gray-300 dark:stroke-gray-600",strokeWidth:1}),c("text",{x:p==="start"?u.x+3:u.x-3,y:u.y,textAnchor:p,dominantBaseline:"middle",className:"fill-gray-600 text-[10px] dark:fill-gray-300",children:e.label})]},`label-${e.key}`)}):null,P==="donut"&&y?_("g",{"aria-hidden":"true",children:[c("text",{x:d,y:g-(y.label?2:0),textAnchor:"middle",dominantBaseline:"middle",className:"fill-gray-900 text-lg font-semibold dark:fill-gray-100",children:y.value}),y.label?c("text",{x:d,y:g+14,textAnchor:"middle",dominantBaseline:"middle",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:y.label}):null]}):null]}),t&&C!==!1?c(ce,{x:d+Math.sin((t.startAngle+t.endAngle)/2)*(m*.7),y:g-Math.cos((t.startAngle+t.endAngle)/2)*(m*.7),containerWidth:f,children:typeof C=="function"?C({seriesKey:t.key,seriesLabel:t.label,color:t.color,value:t.value,formattedValue:v(t.value),datum:{},share:t.share}):c(de,{title:t.label,points:[{seriesKey:t.key,seriesLabel:J(t.share,{locale:I}),color:t.color,value:t.value,formattedValue:v(t.value),datum:{}}]})}):null]})}function De({data:f,x:n,value:l,variant:P="pie",innerRadius:x,maxSlices:b=X,otherLabel:y,sort:C="desc",showLabels:L=!0,centerLabel:S,patterns:N=!1,height:v=260,width:I,size:w="md",legend:h,tooltip:k=!0,tableView:M=!1,title:d,description:g,loading:m=!1,emptyState:B,error:R=!1,errorState:T,onRetry:$,actions:t,locale:e,plotLabel:a,onSliceClick:o,className:u,...p}){let E=re(),Q=ae(),z=V(s=>pe(s,e),[e]),G=V(s=>n.format?n.format(s,0):fe(s,e),[n,e]),{slices:D,total:Y,rows:Z}=q(()=>{let s=f.map((r,i)=>({key:String(j(r,n.key,i)),label:G(j(r,n.key,i)),value:ge(r,l)??0,color:me(i),slot:i,datum:r})),U=C==="none"?s:[...s].sort((r,i)=>C==="asc"?r.value-i.value:i.value-r.value),A=U.slice(0,b),F=U.slice(b);F.length>0&&A.push({key:"__other__",label:y??E.chartOther,value:F.reduce((r,i)=>r+i.value,0),color:he,slot:-1,datum:{}}),A.length>X&&!W&&(W=!0,console.warn(`[@synertech/ui] A PieChart is drawing ${A.length} slices. Past ${X} the slices stop being tellable apart: lower \`maxSlices\`, or use a BarChart, which compares lengths rather than angles.`));let O=A.reduce((r,i)=>r+Math.max(0,i.value),0),K=0;return{slices:A.map(r=>{let i=O===0?0:Math.max(0,r.value)/O,te=K;return K+=i*Math.PI*2,{...r,share:i,startAngle:te,endAngle:K}}),total:O,rows:A.map(r=>({[n.key]:r.label,[l]:r.value}))}},[f,n.key,l,C,b,y,E.chartOther,G]),ee=h===void 0?!0:h!==!1,H=typeof h=="string"?h:"bottom";return c(ne,{title:d,description:g,height:v,width:I,size:w,loading:m,empty:D.length===0||Y===0,emptyState:B,error:R,errorState:T,onRetry:$,actions:t,tableView:M,legendPosition:H,legend:ee?c(le,{items:D.map(s=>({key:s.key,label:`${s.label} \xB7 ${J(s.share,{locale:e})}`,color:s.color,...N?{pattern:s.slot}:{}})),position:H,marker:"rect",size:w}):void 0,table:M?c(ue,{data:Z,series:[{key:l,label:n.label??l}],xKey:n.key,xLabel:n.label??n.key,formatValue:z,caption:typeof d=="string"?d:void 0}):void 0,className:u,...p,children:({width:s})=>c(ve,{width:s,height:v,slices:D,variant:P,innerRadius:x,showLabels:L,centerLabel:S,tooltip:k,patterns:N,patternBaseId:Q,plotLabel:a,formatValue:z,locale:e,onSliceClick:o})})}function Oe(){W=!1}export{De as PieChart,Oe as resetPieWarnings};
1
+ "use client";import{useCallback as E,useId as ae,useMemo as J,useState as oe}from"react";import{useUILabels as ne}from"../../lib/i18n.js";import{ChartContainer as re}from"../chart/ChartContainer.js";import{ChartLegend as le}from"../chart/ChartLegend.js";import{ChartPatternDefs as se,patternFill as ie}from"../chart/ChartPatterns.js";import{ChartTableView as ue}from"../chart/ChartTableView.js";import{ChartTooltip as ce,ChartTooltipContent as he}from"../chart/ChartTooltip.js";import{CHART_MUTED_COLOR as me,getSeriesColor as de}from"../chart/palette.js";import{readNumber as pe,readXValue as q}from"../chart/utils/data.js";import{formatAuto as ge,formatPercent as Q,formatXValue as be}from"../chart/utils/format.js";import{handleChartKeyDown as fe}from"../chart/utils/keyboard.js";import{buildArcPath as ye}from"../chart/utils/path.js";import{CHART_TOUCH as Ce}from"../chart/utils/touch.js";import{Fragment as Ne,jsx as u,jsxs as $}from"react/jsx-runtime";var ve=.62,Ae=2,ke=3,Pe=.16,Re=64,xe=22,z=6,G=!1;function Le({width:b,height:r,slices:o,variant:x,innerRadius:L,showLabels:f,centerLabel:y,tooltip:C,patterns:_,patternBaseId:V,plotLabel:I,formatValue:N,locale:B,onSliceClick:k}){let[v,P]=oe(null),c=v!==null&&v<o.length?v:null,S=J(()=>{let e=f?Re:8,t=f?xe:8,s=Math.max(0,Math.min((b-e*2)/2,(r-t*2)/2));return{cx:b/2,cy:r/2,outerRadius:s,inner:x==="donut"?s*(L??ve):(L??0)*s,pad:s>0&&o.length>1?Ae/s/2:0}},[b,r,x,L,f,o.length]),{cx:d,cy:p,outerRadius:h,inner:O,pad:M}=S,D=E(e=>{let t=(e.startAngle+e.endAngle)/2,s=Math.sin(t)>=0,m={x:d+Math.sin(t)*(h+4),y:p-Math.cos(t)*(h+4)},g={x:d+Math.sin(t)*(h+14),y:p-Math.cos(t)*(h+14)},T={x:s?g.x+10:g.x-10,y:g.y};return{from:m,elbow:g,end:T,anchor:s?"start":"end"}},[d,p,h]),w=E(e=>{let t=o[e];t&&k?.({key:t.key,label:t.label,value:t.value,share:t.share})},[o,k]),A=E(e=>fe(e,{count:o.length,current:c,axis:"both",onMove:P,pick:k&&c!==null?()=>w(c):null}),[o.length,c,k,w]),a=c===null?null:o[c];return $(Ne,{children:[$("svg",{width:b,height:r,role:"img","aria-label":I??o.map(e=>e.label).join(", "),tabIndex:0,className:`${Ce} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500`,onPointerLeave:()=>P(null),onBlur:()=>P(null),onKeyDown:A,children:[_?u(se,{id:V,entries:o.map(e=>({slot:e.slot,color:e.color}))}):null,o.map((e,t)=>u("path",{d:ye({cx:d,cy:p,innerRadius:O,outerRadius:h+(c===t?ke:0),startAngle:e.startAngle+M,endAngle:Math.max(e.startAngle+M,e.endAngle-M)}),fill:ie(_,V,e.slot,e.color),onPointerEnter:()=>C===!1?void 0:P(t),onClick:()=>w(t)},e.key)),f?o.filter(e=>e.endAngle-e.startAngle>=Pe).map(e=>{let{from:t,elbow:s,end:m,anchor:g}=D(e);return $("g",{"aria-hidden":"true",children:[u("polyline",{points:`${t.x},${t.y} ${s.x},${s.y} ${m.x},${m.y}`,fill:"none",className:"stroke-gray-300 dark:stroke-gray-600",strokeWidth:1}),u("text",{x:g==="start"?m.x+3:m.x-3,y:m.y,textAnchor:g,dominantBaseline:"middle",className:"fill-gray-600 text-[10px] dark:fill-gray-300",children:e.label})]},`label-${e.key}`)}):null,x==="donut"&&y?$("g",{"aria-hidden":"true",children:[u("text",{x:d,y:p-(y.label?2:0),textAnchor:"middle",dominantBaseline:"middle",className:"fill-gray-900 text-lg font-semibold dark:fill-gray-100",children:y.value}),y.label?u("text",{x:d,y:p+14,textAnchor:"middle",dominantBaseline:"middle",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:y.label}):null]}):null]}),a&&C!==!1?u(ce,{x:d+Math.sin((a.startAngle+a.endAngle)/2)*(h*.7),y:p-Math.cos((a.startAngle+a.endAngle)/2)*(h*.7),containerWidth:b,children:typeof C=="function"?C({seriesKey:a.key,seriesLabel:a.label,color:a.color,value:a.value,formattedValue:N(a.value),datum:{},share:a.share}):u(he,{title:a.label,points:[{seriesKey:a.key,seriesLabel:Q(a.share,{locale:B}),color:a.color,value:a.value,formattedValue:N(a.value),datum:{}}]})}):null]})}function We({data:b,x:r,value:o,variant:x="pie",innerRadius:L,maxSlices:f=z,otherLabel:y,sort:C="desc",showLabels:_=!0,centerLabel:V,patterns:I=!1,height:N=260,width:B,size:k="md",legend:v,tooltip:P=!0,tableView:c=!1,title:S,description:d,loading:p=!1,emptyState:h,error:O=!1,errorState:M,onRetry:D,actions:w,locale:A,plotLabel:a,onSliceClick:e,className:t,...s}){let m=ne(),g=ae(),T=E(l=>ge(l,A),[A]),H=E(l=>r.format?r.format(l,0):be(l,A),[r,A]),{slices:K,total:Y,rows:Z}=J(()=>{let l=b.map((n,i)=>({key:String(q(n,r.key,i)),label:H(q(n,r.key,i)),value:pe(n,o)??0,color:de(i),slot:i,datum:n})),F=C==="none"?l:[...l].sort((n,i)=>C==="asc"?n.value-i.value:i.value-n.value),R=F.slice(0,f),j=F.slice(f);j.length>0&&R.push({key:"__other__",label:y??m.chartOther,value:j.reduce((n,i)=>n+i.value,0),color:me,slot:-1,datum:{}}),R.length>z&&!G&&(G=!0,console.warn(`[@synertech/ui] A PieChart is drawing ${R.length} slices. Past ${z} the slices stop being tellable apart: lower \`maxSlices\`, or use a BarChart, which compares lengths rather than angles.`));let X=R.reduce((n,i)=>n+Math.max(0,i.value),0),W=0;return{slices:R.map(n=>{let i=X===0?0:Math.max(0,n.value)/X,te=W;return W+=i*Math.PI*2,{...n,share:i,startAngle:te,endAngle:W}}),total:X,rows:R.map(n=>({[r.key]:n.label,[o]:n.value}))}},[b,r.key,o,C,f,y,m.chartOther,H]),ee=v===void 0?!0:v!==!1,U=typeof v=="string"?v:"bottom";return u(re,{title:S,description:d,height:N,width:B,size:k,loading:p,empty:K.length===0||Y===0,emptyState:h,error:O,errorState:M,onRetry:D,actions:w,tableView:c,legendPosition:U,legend:ee?u(le,{items:K.map(l=>({key:l.key,label:`${l.label} \xB7 ${Q(l.share,{locale:A})}`,color:l.color,...I?{pattern:l.slot}:{}})),position:U,marker:"rect",size:k}):void 0,table:c?u(ue,{data:Z,series:[{key:o,label:r.label??o}],xKey:r.key,xLabel:r.label??r.key,formatValue:T,caption:typeof S=="string"?S:void 0}):void 0,className:t,...s,children:({width:l})=>u(Le,{width:l,height:N,slices:K,variant:x,innerRadius:L,showLabels:_,centerLabel:V,tooltip:P,patterns:I,patternBaseId:g,plotLabel:a,formatValue:T,locale:A,onSliceClick:e})})}function ze(){G=!1}export{We as PieChart,ze as resetPieWarnings};
@@ -1 +1 @@
1
- "use strict";"use client";var N=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var O=(e,t)=>{for(var a in t)N(e,a,{get:t[a],enumerable:!0})},ee=(e,t,a,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _(t))!j.call(e,o)&&o!==a&&N(e,o,{get:()=>t[o],enumerable:!(l=Z(t,o))||l.enumerable});return e};var te=e=>ee(N({},"__esModule",{value:!0}),e);var oe={};O(oe,{RadioButton:()=>E});module.exports=te(oe);var n=require("react"),r=require("../../lib/cn.cjs"),s=require("react/jsx-runtime"),re=e=>({sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"})[e],se=e=>({sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"})[e],ne=(e,t,a,l,o,R,h,i)=>{if(t)return(0,r.cn)("border-2",l?"":"border-red-500",a&&!o?"bg-red-500":"");switch(e){case"filled":return(0,r.cn)("border-2",i?"":"border-gray-300 dark:border-gray-600",a?R?"":"bg-blue-600 border-blue-600 dark:bg-blue-500 dark:border-blue-500":h?"":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700");case"outlined":return(0,r.cn)("border-[3px]",i?"":a?"border-blue-600 dark:border-blue-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800");default:return(0,r.cn)("border-2",i?"":a?"border-blue-600 dark:border-blue-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800")}},ae={},E=(0,n.forwardRef)(({label:e,description:t,value:a,checked:l,defaultChecked:o=!1,onCheckedChange:R,size:h="md",variant:i="default",labelPosition:S="right",error:w=!1,disabled:d=!1,readOnly:g=!1,required:P=!1,checkedColor:b,uncheckedColor:p,borderColor:y,labelColor:v,errorColor:f,dotColor:m,hoverColor:M,focusRingColor:H,showFocusRing:z=!0,className:L,containerClassName:T,...W},$)=>{let[q,D]=(0,n.useState)(o),I=l!==void 0,u=I?l:q,x=(0,n.useId)(),C=typeof w=="string"?w:void 0,k=!!w,F=c=>{if(d||g)return;let B=c.target.checked;I||D(B),R?.(B)},V=(0,n.useMemo)(()=>ne(i,k,u,f,m,b,p,y),[i,k,u,f,m,b,p,y]),A=(0,n.useMemo)(()=>{let c={};return b&&u&&(c.backgroundColor=b,c.borderColor=b),p&&!u&&(c.backgroundColor=p),y&&(c.borderColor=y),c},[b,p,y,u]),G=(0,n.useMemo)(()=>m?{backgroundColor:m}:{},[m]),J=(0,n.useMemo)(()=>v?{color:v}:{},[v]),K=(0,n.useMemo)(()=>f?{color:f}:{},[f]),Q=v?"":"text-gray-700 dark:text-gray-200",U=f?"":"text-red-500",X=M?"":"hover:border-blue-500 dark:hover:border-blue-400",Y=H?"":"focus-visible:ring-blue-500";return(0,s.jsxs)("div",{className:(0,r.cn)("inline-flex flex-col",T),style:ae,children:[(0,s.jsxs)("label",{className:(0,r.cn)("inline-flex items-center cursor-pointer",d&&"opacity-50 cursor-not-allowed",g&&"cursor-default",S==="left"&&"flex-row-reverse"),htmlFor:x,children:[(0,s.jsxs)("div",{className:"relative inline-flex items-center",children:[(0,s.jsx)("input",{ref:$,type:"radio",id:x,value:a,checked:u,onChange:F,disabled:d,readOnly:g,required:P,"aria-invalid":k,"aria-describedby":C?`${x}-error`:void 0,className:"sr-only peer",tabIndex:g?-1:void 0,...W}),(0,s.jsx)("div",{className:(0,r.cn)("rounded-full transition-all duration-200",re(h),V,!d&&!g&&X,!d&&!g&&z&&"peer-focus-visible:ring-2 ring-offset-2",!d&&!g&&z&&Y,L),style:A,children:u&&(0,s.jsx)("div",{className:(0,r.cn)("rounded-full absolute inset-0 m-auto transition-all duration-200",se(h),m?"":i==="outlined"||i==="default"?"bg-blue-600 dark:bg-blue-500":"bg-white"),style:G})})]}),e&&(0,s.jsxs)("span",{className:(0,r.cn)("select-none",S==="left"?"mr-2":"ml-2",Q,d&&"opacity-50"),style:J,children:[e,P&&(0,s.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]})]}),t&&!k&&(0,s.jsx)("p",{className:(0,r.cn)("text-sm text-gray-500 dark:text-gray-400 mt-1",S==="left"?"text-right":"ml-7"),children:t}),C&&(0,s.jsx)("p",{id:`${x}-error`,className:(0,r.cn)("text-sm mt-1",S==="left"?"text-right":"ml-7",U),style:K,children:C})]})});E.displayName="RadioButton";0&&(module.exports={RadioButton});
1
+ "use strict";"use client";var N=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var j=(e,r)=>{for(var s in r)N(e,s,{get:r[s],enumerable:!0})},O=(e,r,s,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Z(r))!_.call(e,a)&&a!==s&&N(e,a,{get:()=>r[a],enumerable:!(i=Y(r,a))||i.enumerable});return e};var ee=e=>O(N({},"__esModule",{value:!0}),e);var ne={};j(ne,{RadioButton:()=>M});module.exports=ee(ne);var y=require("react"),t=require("../../lib/cn.cjs"),o=require("react/jsx-runtime"),re=e=>({sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"})[e],te=e=>({sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"})[e],oe=(e,r,s,i,a,v,c,d)=>{if(r)return(0,t.cn)("border-2",i?"":"border-red-500",s&&!a?"bg-red-500":"");switch(e){case"filled":return(0,t.cn)("border-2",d?"":"border-gray-300 dark:border-gray-600",s?v?"":"bg-blue-600 border-blue-600 dark:bg-blue-500 dark:border-blue-500":c?"":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700");case"outlined":return(0,t.cn)("border-[3px]",d?"":s?"border-blue-600 dark:border-blue-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800");default:return(0,t.cn)("border-2",d?"":s?"border-blue-600 dark:border-blue-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800")}},se={},M=(0,y.forwardRef)(({label:e,description:r,value:s,checked:i,defaultChecked:a=!1,onCheckedChange:v,size:c="md",variant:d="default",labelPosition:b="right",error:C=!1,disabled:u=!1,readOnly:l=!1,required:z=!1,checkedColor:f,uncheckedColor:k,borderColor:x,labelColor:w,errorColor:m,dotColor:p,hoverColor:P,focusRingColor:B,showFocusRing:E=!0,className:H,containerClassName:L,id:T,onClick:D,...F},W)=>{let $=i!==void 0,q=(0,y.useId)(),h=T||q,R=typeof C=="string"?C:void 0,S=!!C,V=n=>{u||l||v?.(n.target.checked)},A=n=>{D?.(n),l&&n.preventDefault()},G=w?"":"text-gray-700 dark:text-gray-200",J=m?"":"text-red-500",K=P?"":"hover:border-blue-500 dark:hover:border-blue-400",Q=B?"":"focus-visible:ring-blue-500",I=n=>{let g={};return f&&n&&(g.backgroundColor=f,g.borderColor=f),k&&!n&&(g.backgroundColor=k),x&&(g.borderColor=x),(0,o.jsx)("div",{className:(0,t.cn)("rounded-full transition-all duration-200",re(c),oe(d,S,n,m,p,f,k,x),!u&&!l&&K,!u&&!l&&E&&"peer-focus-visible:ring-2 ring-offset-2",!u&&!l&&E&&Q,H,n?"hidden peer-checked:block":"peer-checked:hidden"),style:g,children:n&&(0,o.jsx)("div",{className:(0,t.cn)("rounded-full absolute inset-0 m-auto transition-all duration-200",te(c),p?"":d==="outlined"||d==="default"?"bg-blue-600 dark:bg-blue-500":"bg-white"),style:p?{backgroundColor:p}:void 0})})},U=w?{color:w}:{},X=m?{color:m}:{};return(0,o.jsxs)("div",{className:(0,t.cn)("inline-flex flex-col",L),style:se,children:[(0,o.jsxs)("label",{className:(0,t.cn)("inline-flex items-center cursor-pointer",u&&"opacity-50 cursor-not-allowed",l&&"cursor-default",b==="left"&&"flex-row-reverse"),htmlFor:h,children:[(0,o.jsxs)("div",{className:"relative inline-flex items-center",children:[(0,o.jsx)("input",{ref:W,type:"radio",id:h,value:s,...$?{checked:i}:{defaultChecked:a},onChange:V,onClick:A,disabled:u,readOnly:l,required:z,"aria-invalid":S,"aria-describedby":R?`${h}-error`:void 0,className:"sr-only peer",tabIndex:l?-1:void 0,...F}),I(!1),I(!0)]}),e&&(0,o.jsxs)("span",{className:(0,t.cn)("select-none",b==="left"?"mr-2":"ml-2",G,u&&"opacity-50"),style:U,children:[e,z&&(0,o.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]})]}),r&&!S&&(0,o.jsx)("p",{className:(0,t.cn)("text-sm text-gray-500 dark:text-gray-400 mt-1",b==="left"?"text-right":"ml-7"),children:r}),R&&(0,o.jsx)("p",{id:`${h}-error`,className:(0,t.cn)("text-sm mt-1",b==="left"?"text-right":"ml-7",J),style:X,children:R})]})});M.displayName="RadioButton";0&&(module.exports={RadioButton});
@@ -1 +1 @@
1
- "use client";import{useState as Y,useId as Z,useMemo as m,forwardRef as _}from"react";import{cn as e}from"../../lib/cn.js";import{jsx as c,jsxs as k}from"react/jsx-runtime";var j=t=>({sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"})[t],O=t=>({sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"})[t],ee=(t,i,l,p,R,w,y,r)=>{if(i)return e("border-2",p?"":"border-red-500",l&&!R?"bg-red-500":"");switch(t){case"filled":return e("border-2",r?"":"border-gray-300 dark:border-gray-600",l?w?"":"bg-blue-600 border-blue-600 dark:bg-blue-500 dark:border-blue-500":y?"":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700");case"outlined":return e("border-[3px]",r?"":l?"border-blue-600 dark:border-blue-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800");default:return e("border-2",r?"":l?"border-blue-600 dark:border-blue-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800")}},te={},re=_(({label:t,description:i,value:l,checked:p,defaultChecked:R=!1,onCheckedChange:w,size:y="md",variant:r="default",labelPosition:h="right",error:C=!1,disabled:s=!1,readOnly:n=!1,required:P=!1,checkedColor:d,uncheckedColor:b,borderColor:f,labelColor:S,errorColor:g,dotColor:u,hoverColor:E,focusRingColor:M,showFocusRing:z=!0,className:H,containerClassName:L,...T},W)=>{let[$,q]=Y(R),I=p!==void 0,a=I?p:$,v=Z(),N=typeof C=="string"?C:void 0,x=!!C,D=o=>{if(s||n)return;let B=o.target.checked;I||q(B),w?.(B)},F=m(()=>ee(r,x,a,g,u,d,b,f),[r,x,a,g,u,d,b,f]),V=m(()=>{let o={};return d&&a&&(o.backgroundColor=d,o.borderColor=d),b&&!a&&(o.backgroundColor=b),f&&(o.borderColor=f),o},[d,b,f,a]),A=m(()=>u?{backgroundColor:u}:{},[u]),G=m(()=>S?{color:S}:{},[S]),J=m(()=>g?{color:g}:{},[g]),K=S?"":"text-gray-700 dark:text-gray-200",Q=g?"":"text-red-500",U=E?"":"hover:border-blue-500 dark:hover:border-blue-400",X=M?"":"focus-visible:ring-blue-500";return k("div",{className:e("inline-flex flex-col",L),style:te,children:[k("label",{className:e("inline-flex items-center cursor-pointer",s&&"opacity-50 cursor-not-allowed",n&&"cursor-default",h==="left"&&"flex-row-reverse"),htmlFor:v,children:[k("div",{className:"relative inline-flex items-center",children:[c("input",{ref:W,type:"radio",id:v,value:l,checked:a,onChange:D,disabled:s,readOnly:n,required:P,"aria-invalid":x,"aria-describedby":N?`${v}-error`:void 0,className:"sr-only peer",tabIndex:n?-1:void 0,...T}),c("div",{className:e("rounded-full transition-all duration-200",j(y),F,!s&&!n&&U,!s&&!n&&z&&"peer-focus-visible:ring-2 ring-offset-2",!s&&!n&&z&&X,H),style:V,children:a&&c("div",{className:e("rounded-full absolute inset-0 m-auto transition-all duration-200",O(y),u?"":r==="outlined"||r==="default"?"bg-blue-600 dark:bg-blue-500":"bg-white"),style:A})})]}),t&&k("span",{className:e("select-none",h==="left"?"mr-2":"ml-2",K,s&&"opacity-50"),style:G,children:[t,P&&c("span",{className:"text-red-500 ml-1",children:"*"})]})]}),i&&!x&&c("p",{className:e("text-sm text-gray-500 dark:text-gray-400 mt-1",h==="left"?"text-right":"ml-7"),children:i}),N&&c("p",{id:`${v}-error`,className:e("text-sm mt-1",h==="left"?"text-right":"ml-7",Q),style:J,children:N})]})});re.displayName="RadioButton";export{re as RadioButton};
1
+ "use client";import{useId as U,forwardRef as X}from"react";import{cn as e}from"../../lib/cn.js";import{jsx as i,jsxs as h}from"react/jsx-runtime";var Y=t=>({sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"})[t],Z=t=>({sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"})[t],_=(t,a,l,u,y,v,g,s)=>{if(a)return e("border-2",u?"":"border-red-500",l&&!y?"bg-red-500":"");switch(t){case"filled":return e("border-2",s?"":"border-gray-300 dark:border-gray-600",l?v?"":"bg-blue-600 border-blue-600 dark:bg-blue-500 dark:border-blue-500":g?"":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700");case"outlined":return e("border-[3px]",s?"":l?"border-blue-600 dark:border-blue-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800");default:return e("border-2",s?"":l?"border-blue-600 dark:border-blue-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800")}},j={},O=X(({label:t,description:a,value:l,checked:u,defaultChecked:y=!1,onCheckedChange:v,size:g="md",variant:s="default",labelPosition:c="right",error:C=!1,disabled:n=!1,readOnly:o=!1,required:N=!1,checkedColor:b,uncheckedColor:k,borderColor:x,labelColor:w,errorColor:f,dotColor:m,hoverColor:I,focusRingColor:M,showFocusRing:z=!0,className:P,containerClassName:B,id:H,onClick:L,...T},D)=>{let F=u!==void 0,W=U(),p=H||W,R=typeof C=="string"?C:void 0,S=!!C,$=r=>{n||o||v?.(r.target.checked)},q=r=>{L?.(r),o&&r.preventDefault()},V=w?"":"text-gray-700 dark:text-gray-200",A=f?"":"text-red-500",G=I?"":"hover:border-blue-500 dark:hover:border-blue-400",J=M?"":"focus-visible:ring-blue-500",E=r=>{let d={};return b&&r&&(d.backgroundColor=b,d.borderColor=b),k&&!r&&(d.backgroundColor=k),x&&(d.borderColor=x),i("div",{className:e("rounded-full transition-all duration-200",Y(g),_(s,S,r,f,m,b,k,x),!n&&!o&&G,!n&&!o&&z&&"peer-focus-visible:ring-2 ring-offset-2",!n&&!o&&z&&J,P,r?"hidden peer-checked:block":"peer-checked:hidden"),style:d,children:r&&i("div",{className:e("rounded-full absolute inset-0 m-auto transition-all duration-200",Z(g),m?"":s==="outlined"||s==="default"?"bg-blue-600 dark:bg-blue-500":"bg-white"),style:m?{backgroundColor:m}:void 0})})},K=w?{color:w}:{},Q=f?{color:f}:{};return h("div",{className:e("inline-flex flex-col",B),style:j,children:[h("label",{className:e("inline-flex items-center cursor-pointer",n&&"opacity-50 cursor-not-allowed",o&&"cursor-default",c==="left"&&"flex-row-reverse"),htmlFor:p,children:[h("div",{className:"relative inline-flex items-center",children:[i("input",{ref:D,type:"radio",id:p,value:l,...F?{checked:u}:{defaultChecked:y},onChange:$,onClick:q,disabled:n,readOnly:o,required:N,"aria-invalid":S,"aria-describedby":R?`${p}-error`:void 0,className:"sr-only peer",tabIndex:o?-1:void 0,...T}),E(!1),E(!0)]}),t&&h("span",{className:e("select-none",c==="left"?"mr-2":"ml-2",V,n&&"opacity-50"),style:K,children:[t,N&&i("span",{className:"text-red-500 ml-1",children:"*"})]})]}),a&&!S&&i("p",{className:e("text-sm text-gray-500 dark:text-gray-400 mt-1",c==="left"?"text-right":"ml-7"),children:a}),R&&i("p",{id:`${p}-error`,className:e("text-sm mt-1",c==="left"?"text-right":"ml-7",A),style:Q,children:R})]})});O.displayName="RadioButton";export{O as RadioButton};
@@ -1 +1 @@
1
- "use strict";"use client";var te=Object.defineProperty;var he=Object.getOwnPropertyDescriptor;var fe=Object.getOwnPropertyNames;var ge=Object.prototype.hasOwnProperty;var ye=(s,o)=>{for(var r in o)te(s,r,{get:o[r],enumerable:!0})},pe=(s,o,r,v)=>{if(o&&typeof o=="object"||typeof o=="function")for(let d of fe(o))!ge.call(s,d)&&d!==r&&te(s,d,{get:()=>o[d],enumerable:!(v=he(o,d))||v.enumerable});return s};var be=s=>pe(te({},"__esModule",{value:!0}),s);var Ve={};ye(Ve,{ScatterChart:()=>ke,resetScatterWarnings:()=>Pe});module.exports=be(Ve);var g=require("react"),re=require("../chart/ChartAxis.cjs"),se=require("../chart/ChartContainer.cjs"),le=require("../chart/ChartGrid.cjs"),ce=require("../chart/ChartLegend.cjs"),ue=require("../chart/ChartTableView.cjs"),U=require("../chart/ChartTooltip.cjs"),C=require("../chart/palette.cjs"),H=require("../chart/utils/cartesian.cjs"),D=require("../chart/utils/data.cjs"),j=require("../chart/utils/decimate.cjs"),G=require("../chart/utils/format.cjs"),F=require("../chart/utils/scales.cjs"),ne=require("../chart/utils/ticks.cjs"),i=require("react/jsx-runtime"),xe=4.5,Ce=48,ie=!1,ve=(0,g.memo)(function({points:o}){return(0,i.jsx)("g",{children:o.map(r=>(0,i.jsx)("circle",{cx:r.cx,cy:r.cy,r:r.r,fill:r.color,fillOpacity:.85,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},`${r.seriesKey}-${r.index}`))})});function Se({width:s,height:o,data:r,resolvedSeries:v,x:d,y:X,grid:V,size:N,bubble:y,trendLine:O,quadrants:K,pointRadius:M,overlay:E,maxPoints:R,margin:Y,tooltip:T,onPointClick:I,plotLabel:J,formatValue:S,formatX:w}){let[t,z]=(0,g.useState)(null),e=(0,g.useMemo)(()=>{let a=v.filter(c=>!c.hidden),$=a.map(c=>c.key),l=(0,H.buildCartesianGeometry)({width:s,height:o,data:r,x:{...d,scale:d.scale==="time"?"time":"linear"},y:X,bounds:(0,ne.extent)((0,D.collectAllValues)(r,$)),margin:Y,formatValue:S,formatX:w}),k=y?(0,D.collectAllValues)(r,[y.key]):[],A=y?(0,ne.extent)(k):null,[x,L]=y?.range??[4,14],W=c=>{if(!y||!A)return M;let m=(0,D.readNumber)(c,y.key);if(m===null)return x;let[p,b]=A,P=b===p?1:(m-p)/(b-p);return Math.sqrt(x*x+P*(L*L-x*x))},q=[],f=[];a.forEach(c=>{let m=[];r.forEach((p,b)=>{let P=(0,D.readNumber)(p,c.key),n=l.categoryPositions[b];P===null||!Number.isFinite(n)||m.push({seriesKey:c.key,seriesLabel:(0,C.getSeriesLabel)(c),color:c.color,index:b,cx:n,cy:l.valueScale(P),r:W(p),xValue:(0,F.toNumber)(l.xValues[b]),yValue:P})}),R||(0,j.warnPointBudget)("ScatterChart",m.length),f.push(...m),q.push(...R&&R>0?(0,j.sampleEvenly)(m,R):m)});let B=null;if(O&&f.length>1){let c=f.length,m=f.reduce((h,u)=>h+u.xValue,0),p=f.reduce((h,u)=>h+u.yValue,0),b=f.reduce((h,u)=>h+u.xValue*u.yValue,0),P=f.reduce((h,u)=>h+u.xValue*u.xValue,0),n=c*P-m*m;if(n!==0){let h=(c*b-m*p)/n,u=(p-h*m)/c,oe=f.map(ee=>ee.xValue),[de,me]=[Math.min(...oe),Math.max(...oe)],ae=f.map(ee=>ee.cx);B={x1:Math.min(...ae),y1:l.valueScale(h*de+u),x2:Math.max(...ae),y2:l.valueScale(h*me+u)}}}return{visible:a,points:q,plot:(0,H.createPlotContext)({geometry:l,width:s,height:o,data:r,series:a,formatValue:S,formatX:w}),trend:B,xTicks:l.categoryTicks,yTicks:l.valueTicks,valueScale:l.valueScale,positions:l.categoryPositions,innerWidth:l.innerWidth,innerHeight:l.innerHeight,margin:l.margin,xValues:l.xValues}},[r,v,d,X,s,o,Y,y,O,M,R,S,w]),Q=(0,g.useCallback)(a=>{if(T===!1||e.points.length===0)return;let $=a.currentTarget.getBoundingClientRect(),l=a.clientX-$.left-e.margin.left,k=a.clientY-$.top-e.margin.top,A=null,x=Ce;for(let L of e.points){let W=Math.hypot(L.cx-l,L.cy-k);W<x&&(x=W,A=L)}z(A)},[T,e.points,e.margin]),Z=(0,g.useCallback)(()=>{if(!I||!t)return;let a=r[t.index];a&&I({seriesKey:t.seriesKey,seriesLabel:t.seriesLabel,color:t.color,value:t.yValue,formattedValue:S(t.yValue),datum:a,index:t.index,x:e.xValues[t.index]})},[I,t,S,r,e.xValues]),_=(0,H.splitOverlay)(E);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("svg",{width:s,height:o,role:"img","aria-label":J??e.visible.map(a=>(0,C.getSeriesLabel)(a)).join(", "),tabIndex:0,className:"touch-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",onPointerMove:Q,onPointerLeave:()=>z(null),onBlur:()=>z(null),onClick:Z,children:[(0,i.jsxs)("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[(0,i.jsx)(le.ChartGrid,{width:e.innerWidth,height:e.innerHeight,horizontal:V==="y"||V==="both"?e.yTicks.map(a=>a.offset):void 0,vertical:V==="x"||V==="both"?e.xTicks.map(a=>a.offset):void 0}),K?.y!==void 0?(0,i.jsx)("line",{x1:0,y1:e.valueScale(K.y),x2:e.innerWidth,y2:e.valueScale(K.y),stroke:"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:"4 4"}):null,_.under?.(e.plot),e.trend?(0,i.jsx)("line",{x1:e.trend.x1,y1:e.trend.y1,x2:e.trend.x2,y2:e.trend.y2,stroke:"var(--color-chart-muted)",strokeWidth:1.5,strokeDasharray:"4 4"}):null,(0,i.jsx)(ve,{points:e.points}),_.over?.(e.plot),t?(0,i.jsx)("circle",{cx:t.cx,cy:t.cy,r:t.r+3,fill:"none",stroke:t.color,strokeWidth:2,"aria-hidden":"true"}):null]}),(0,i.jsx)("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:d.hidden?null:(0,i.jsx)(re.ChartAxis,{orientation:"bottom",ticks:e.xTicks,length:e.innerWidth,label:d.label,size:N})}),(0,i.jsx)("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:X?.hidden?null:(0,i.jsx)(re.ChartAxis,{orientation:"left",ticks:e.yTicks,length:e.innerHeight,showLine:!1,label:X?.label,size:N})})]}),t&&r[t.index]&&T!==!1?(0,i.jsx)(U.ChartTooltip,{x:e.margin.left+t.cx,y:e.margin.top+t.cy,containerWidth:s,children:typeof T=="function"?T({x:e.xValues[t.index],xLabel:w(e.xValues[t.index],t.index),index:t.index,points:[{seriesKey:t.seriesKey,seriesLabel:t.seriesLabel,color:t.color,value:t.yValue,formattedValue:S(t.yValue),datum:r[t.index]}]}):(0,i.jsx)(U.ChartTooltipContent,{title:`${d.label??d.key} ${w(e.xValues[t.index],t.index)}`,points:[{seriesKey:t.seriesKey,seriesLabel:t.seriesLabel,color:t.color,value:t.yValue,formattedValue:S(t.yValue),datum:r[t.index]}]})}):null]})}function ke({data:s,series:o,x:r,y:v,height:d=280,width:X,size:V="md",grid:N="both",legend:y,tooltip:O=!0,tableView:K=!1,emphasis:M,title:E,description:R,loading:Y=!1,emptyState:T,error:I=!1,errorState:J,onRetry:S,actions:w,onPointClick:t,bubble:z,trendLine:e=!1,quadrants:Q,pointRadius:Z=xe,overlay:_,legendToggle:a=!0,maxPoints:$,margin:l,locale:k,plotLabel:A,className:x,...L}){let[W,q]=(0,g.useState)(()=>new Set);o.length>C.CHART_ALL_PAIRS_LIMIT&&!ie&&(ie=!0,console.warn(`[@synertech/ui] A ScatterChart was given ${o.length} series. Any two marks can sit side by side here, and only the first ${C.CHART_ALL_PAIRS_LIMIT} palette slots stay tellable apart under that test: facet the chart instead.`));let f=(0,g.useMemo)(()=>o.map((n,h)=>({...n,hidden:n.hidden||W.has(n.key),color:(0,C.resolveSeriesColor)(n,h,M)})),[o,W,M]),B=(0,g.useMemo)(()=>v?.format??(n=>(0,G.formatAuto)(n,k)),[v?.format,k]),c=(0,g.useMemo)(()=>r.format??(n=>r.scale==="time"?(0,G.formatXValue)(n instanceof Date?n:new Date((0,F.toNumber)(n)),k):(0,G.formatAuto)((0,F.toNumber)(n),k)),[r.format,r.scale,k]),m=(0,g.useCallback)(n=>{q(h=>{let u=new Set(h);return u.has(n)?u.delete(n):u.add(n),u})},[]),p=y===void 0?o.length>=2:y!==!1,b=typeof y=="string"?y:"bottom",P=f.filter(n=>!n.hidden).length;return(0,i.jsx)(se.ChartContainer,{title:E,description:R,height:d,width:X,size:V,loading:Y,empty:s.length===0||P===0,emptyState:T,error:I,errorState:J,onRetry:S,actions:w,tableView:K,legendPosition:b,legend:p?(0,i.jsx)(ce.ChartLegend,{items:(0,C.toLegendItems)(f,M),position:b,marker:"dot",size:V,onToggle:a?m:void 0}):void 0,table:K?(0,i.jsx)(ue.ChartTableView,{data:s,series:f,xKey:r.key,xLabel:r.label??r.key,formatX:c,formatValue:B,caption:typeof E=="string"?E:void 0}):void 0,className:x,...L,children:({width:n})=>(0,i.jsx)(Se,{width:n,height:d,data:s,resolvedSeries:f,x:r,y:v,grid:N,size:V,bubble:z,trendLine:e,quadrants:Q,pointRadius:Z,overlay:_,maxPoints:$,margin:l,tooltip:O,onPointClick:t,plotLabel:A,formatValue:B,formatX:c})})}function Pe(){ie=!1}0&&(module.exports={ScatterChart,resetScatterWarnings});
1
+ "use strict";"use client";var ne=Object.defineProperty;var Ce=Object.getOwnPropertyDescriptor;var ke=Object.getOwnPropertyNames;var ve=Object.prototype.hasOwnProperty;var Se=(s,o)=>{for(var r in o)ne(s,r,{get:o[r],enumerable:!0})},Pe=(s,o,r,C)=>{if(o&&typeof o=="object"||typeof o=="function")for(let f of ke(o))!ve.call(s,f)&&f!==r&&ne(s,f,{get:()=>o[f],enumerable:!(C=Ce(o,f))||C.enumerable});return s};var Ve=s=>Pe(ne({},"__esModule",{value:!0}),s);var Me={};Se(Me,{ScatterChart:()=>Ae,resetScatterWarnings:()=>Ie});module.exports=Ve(Me);var p=require("react"),oe=require("../chart/ChartAxis.cjs"),de=require("../chart/ChartContainer.cjs"),me=require("../chart/ChartGrid.cjs"),he=require("../chart/ChartLegend.cjs"),fe=require("../chart/ChartTableView.cjs"),J=require("../chart/ChartTooltip.cjs"),w=require("../chart/palette.cjs"),O=require("../chart/utils/cartesian.cjs"),G=require("../chart/utils/data.cjs"),Q=require("../chart/utils/decimate.cjs"),ae=require("../chart/utils/format.cjs"),X=require("../chart/utils/keyboard.cjs"),ge=require("../chart/utils/scales.cjs"),ie=require("../chart/utils/ticks.cjs"),ye=require("../chart/utils/timestamp.cjs"),pe=require("../chart/utils/touch.cjs"),i=require("react/jsx-runtime"),Re=4.5,we=48,se=!1;function ue(s){return`${s.index}:${s.seriesKey}`}function Le(s,o){return s.reduce((r,C)=>Math.abs(C.cx-o)<Math.abs(r.cx-o)?C:r)}var Te=(0,p.memo)(function({points:o}){return(0,i.jsx)("g",{children:o.map(r=>(0,i.jsx)("circle",{cx:r.cx,cy:r.cy,r:r.r,fill:r.color,fillOpacity:.85,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},`${r.seriesKey}-${r.index}`))})});function Ke({width:s,height:o,data:r,resolvedSeries:C,x:f,y:E,grid:T,size:N,bubble:k,trendLine:Y,quadrants:$,pointRadius:W,overlay:z,maxPoints:K,margin:_,tooltip:A,onPointClick:I,plotLabel:Z,formatValue:L,formatX:M}){let[U,D]=(0,p.useState)(null),t=(0,p.useMemo)(()=>{let a=C.filter(c=>!c.hidden),m=a.map(c=>c.key),l=(0,O.buildCartesianGeometry)({width:s,height:o,data:r,x:{...f,scale:f.scale==="time"?"time":"linear"},y:E,bounds:(0,ie.extent)((0,G.collectAllValues)(r,m)),margin:_,formatValue:L,formatX:M}),V=k?(0,G.collectAllValues)(r,[k.key]):[],R=k?(0,ie.extent)(V):null,[u,h]=k?.range??[4,14],d=c=>{if(!k||!R)return W;let g=(0,G.readNumber)(c,k.key);if(g===null)return u;let[n,x]=R,y=x===n?1:(g-n)/(x-n);return Math.sqrt(u*u+y*(h*h-u*u))},P=[],v=[],F=[];a.forEach(c=>{let g=[];r.forEach((x,y)=>{let H=(0,G.readNumber)(x,c.key),b=l.categoryPositions[y];H===null||!Number.isFinite(b)||g.push({seriesKey:c.key,seriesLabel:(0,w.getSeriesLabel)(c),color:c.color,index:y,cx:b,cy:l.valueScale(H),r:d(x),xValue:l.toCategoryNumber(l.xValues[y]),yValue:H})}),K||(0,Q.warnPointBudget)("ScatterChart",g.length);let n=K&&K>0?(0,Q.sampleEvenly)(g,K):g;v.push(...g),P.push(...n),n.length>0&&F.push([...n].sort((x,y)=>x.cx-y.cx||x.index-y.index))});let j=null;if(Y&&v.length>1){let c=v.length,g=v.reduce((b,S)=>b+S.xValue,0),n=v.reduce((b,S)=>b+S.yValue,0),x=v.reduce((b,S)=>b+S.xValue*S.yValue,0),y=v.reduce((b,S)=>b+S.xValue*S.xValue,0),H=c*y-g*g;if(H!==0){let b=(c*x-g*n)/H,S=(n-b*g)/c,le=v.map(re=>re.xValue),[xe,be]=[Math.min(...le),Math.max(...le)],ce=v.map(re=>re.cx);j={x1:Math.min(...ce),y1:l.valueScale(b*xe+S),x2:Math.max(...ce),y2:l.valueScale(b*be+S)}}}return{visible:a,points:P,tracks:F,marks:new Map(P.map(c=>[ue(c),c])),plot:(0,O.createPlotContext)({geometry:l,width:s,height:o,data:r,series:a,formatValue:L,formatX:M}),trend:j,xTicks:l.categoryTicks,yTicks:l.valueTicks,valueScale:l.valueScale,positions:l.categoryPositions,innerWidth:l.innerWidth,innerHeight:l.innerHeight,margin:l.margin,xValues:l.xValues}},[r,C,f,E,s,o,_,k,Y,W,K,L,M]),e=U===null?null:t.marks.get(ue(U))??null,ee=(0,p.useCallback)(a=>{if(A===!1||t.points.length===0)return;let m=a.currentTarget.getBoundingClientRect(),l=a.clientX-m.left-t.margin.left,V=a.clientY-m.top-t.margin.top,R=null,u=we;for(let h of t.points){let d=Math.hypot(h.cx-l,h.cy-V);d<u&&(u=d,R=h)}D(R)},[A,t.points,t.margin]),B=(0,p.useCallback)(()=>{if(!I||!e)return;let a=r[e.index];a&&I({seriesKey:e.seriesKey,seriesLabel:e.seriesLabel,color:e.color,value:e.yValue,formattedValue:L(e.yValue),datum:a,index:e.index,x:t.xValues[e.index]})},[I,e,L,r,t.xValues]),te=(0,p.useCallback)(a=>{let{tracks:m}=t;if(m.length===0||(0,X.pressChartMark)(a,I&&e?B:null))return;let l=e?m.findIndex(P=>P[0].seriesKey===e.seriesKey):-1,V=l<0?null:m[l],R=V&&e?V.indexOf(e):-1,u=V&&R>=0?{track:V,trackIndex:l,markIndex:R}:null,h=u?.track??m[0],d;switch(a.key){case"ArrowRight":d=h[(0,X.stepChartCursor)(u?.markIndex??null,1,h.length)];break;case"ArrowLeft":d=h[(0,X.stepChartCursor)(u?.markIndex??null,-1,h.length)];break;case"ArrowDown":case"ArrowUp":{if(!u||!e){d=h[0];break}let P=(0,X.stepChartCursor)(u.trackIndex,a.key==="ArrowDown"?1:-1,m.length);d=P===u.trackIndex?e:Le(m[P],e.cx);break}case"Home":d=h[0];break;case"End":d=h[h.length-1];break;case"Escape":d=null;break;default:return}a.preventDefault(),D(d)},[t,e,I,B]),q=(0,O.splitOverlay)(z);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("svg",{width:s,height:o,role:"img","aria-label":Z??t.visible.map(a=>(0,w.getSeriesLabel)(a)).join(", "),tabIndex:0,className:`${pe.CHART_TOUCH} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500`,onPointerMove:ee,onPointerLeave:()=>D(null),onKeyDown:te,onBlur:()=>D(null),onClick:B,children:[(0,i.jsxs)("g",{transform:`translate(${t.margin.left}, ${t.margin.top})`,children:[(0,i.jsx)(me.ChartGrid,{width:t.innerWidth,height:t.innerHeight,horizontal:T==="y"||T==="both"?t.yTicks.map(a=>a.offset):void 0,vertical:T==="x"||T==="both"?t.xTicks.map(a=>a.offset):void 0}),$?.y!==void 0?(0,i.jsx)("line",{x1:0,y1:t.valueScale($.y),x2:t.innerWidth,y2:t.valueScale($.y),stroke:"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:"4 4"}):null,q.under?.(t.plot),t.trend?(0,i.jsx)("line",{x1:t.trend.x1,y1:t.trend.y1,x2:t.trend.x2,y2:t.trend.y2,stroke:"var(--color-chart-muted)",strokeWidth:1.5,strokeDasharray:"4 4"}):null,(0,i.jsx)(Te,{points:t.points}),q.over?.(t.plot),e?(0,i.jsx)("circle",{cx:e.cx,cy:e.cy,r:e.r+3,fill:"none",stroke:e.color,strokeWidth:2,"aria-hidden":"true"}):null]}),(0,i.jsx)("g",{transform:`translate(${t.margin.left}, ${t.margin.top+t.innerHeight})`,children:f.hidden?null:(0,i.jsx)(oe.ChartAxis,{orientation:"bottom",ticks:t.xTicks,length:t.innerWidth,label:f.label,size:N})}),(0,i.jsx)("g",{transform:`translate(${t.margin.left}, ${t.margin.top})`,children:E?.hidden?null:(0,i.jsx)(oe.ChartAxis,{orientation:"left",ticks:t.yTicks,length:t.innerHeight,showLine:!1,label:E?.label,size:N})})]}),e&&r[e.index]&&A!==!1?(0,i.jsx)(J.ChartTooltip,{x:t.margin.left+e.cx,y:t.margin.top+e.cy,containerWidth:s,children:typeof A=="function"?A({x:t.xValues[e.index],xLabel:M(t.xValues[e.index],e.index),index:e.index,points:[{seriesKey:e.seriesKey,seriesLabel:e.seriesLabel,color:e.color,value:e.yValue,formattedValue:L(e.yValue),datum:r[e.index]}]}):(0,i.jsx)(J.ChartTooltipContent,{title:`${f.label??f.key} ${M(t.xValues[e.index],e.index)}`,points:[{seriesKey:e.seriesKey,seriesLabel:e.seriesLabel,color:e.color,value:e.yValue,formattedValue:L(e.yValue),datum:r[e.index]}]})}):null]})}function Ae({data:s,series:o,x:r,y:C,height:f=280,width:E,size:T="md",grid:N="both",legend:k,tooltip:Y=!0,tableView:$=!1,emphasis:W,title:z,description:K,loading:_=!1,emptyState:A,error:I=!1,errorState:Z,onRetry:L,actions:M,onPointClick:U,bubble:D,trendLine:t=!1,quadrants:e,pointRadius:ee=Re,overlay:B,legendToggle:te=!0,maxPoints:q,margin:a,locale:m,plotLabel:l,className:V,...R}){let[u,h]=(0,p.useState)(()=>new Set);o.length>w.CHART_ALL_PAIRS_LIMIT&&!se&&(se=!0,console.warn(`[@synertech/ui] A ScatterChart was given ${o.length} series. Any two marks can sit side by side here, and only the first ${w.CHART_ALL_PAIRS_LIMIT} palette slots stay tellable apart under that test: facet the chart instead.`));let d=(0,p.useMemo)(()=>o.map((n,x)=>({...n,hidden:n.hidden||u.has(n.key),color:(0,w.resolveSeriesColor)(n,x,W)})),[o,u,W]),P=(0,p.useMemo)(()=>C?.format??(n=>(0,ae.formatAuto)(n,m)),[C?.format,m]),v=(0,p.useMemo)(()=>r.format??(n=>r.scale==="time"?(0,ye.formatTimeValue)(n,m):(0,ae.formatAuto)((0,ge.toNumber)(n),m)),[r.format,r.scale,m]),F=(0,p.useCallback)(n=>{h(x=>{let y=new Set(x);return y.has(n)?y.delete(n):y.add(n),y})},[]),j=k===void 0?o.length>=2:k!==!1,c=typeof k=="string"?k:"bottom",g=d.filter(n=>!n.hidden).length;return(0,i.jsx)(de.ChartContainer,{title:z,description:K,height:f,width:E,size:T,loading:_,empty:s.length===0||g===0,emptyState:A,error:I,errorState:Z,onRetry:L,actions:M,tableView:$,legendPosition:c,legend:j?(0,i.jsx)(he.ChartLegend,{items:(0,w.toLegendItems)(d,W),position:c,marker:"dot",size:T,onToggle:te?F:void 0}):void 0,table:$?(0,i.jsx)(fe.ChartTableView,{data:s,series:d,xKey:r.key,xLabel:r.label??r.key,formatX:v,formatValue:P,caption:typeof z=="string"?z:void 0}):void 0,className:V,...R,children:({width:n})=>(0,i.jsx)(Ke,{width:n,height:f,data:s,resolvedSeries:d,x:r,y:C,grid:N,size:T,bubble:D,trendLine:t,quadrants:e,pointRadius:ee,overlay:B,maxPoints:q,margin:a,tooltip:Y,onPointClick:U,plotLabel:l,formatValue:P,formatX:v})})}function Ie(){se=!1}0&&(module.exports={ScatterChart,resetScatterWarnings});
@@ -1 +1 @@
1
- "use client";import{memo as ue,useCallback as U,useMemo as N,useState as se}from"react";import{ChartAxis as ee}from"../chart/ChartAxis.js";import{ChartContainer as de}from"../chart/ChartContainer.js";import{ChartGrid as me}from"../chart/ChartGrid.js";import{ChartLegend as he}from"../chart/ChartLegend.js";import{ChartTableView as fe}from"../chart/ChartTableView.js";import{ChartTooltip as ge,ChartTooltipContent as ye}from"../chart/ChartTooltip.js";import{CHART_ALL_PAIRS_LIMIT as te,getSeriesLabel as re,resolveSeriesColor as pe,toLegendItems as be}from"../chart/palette.js";import{buildCartesianGeometry as xe,createPlotContext as Ce,splitOverlay as ve}from"../chart/utils/cartesian.js";import{collectAllValues as ne,readNumber as ie}from"../chart/utils/data.js";import{sampleEvenly as Se,warnPointBudget as ke}from"../chart/utils/decimate.js";import{formatAuto as oe,formatXValue as Pe}from"../chart/utils/format.js";import{toNumber as j}from"../chart/utils/scales.js";import{extent as ae}from"../chart/utils/ticks.js";import{Fragment as we,jsx as l,jsxs as F}from"react/jsx-runtime";var Ve=4.5,Le=48,J=!1,Re=ue(function({points:m}){return l("g",{children:m.map(r=>l("circle",{cx:r.cx,cy:r.cy,r:r.r,fill:r.color,fillOpacity:.85,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},`${r.seriesKey}-${r.index}`))})});function Te({width:y,height:m,data:r,resolvedSeries:w,x:p,y:A,grid:S,size:E,bubble:h,trendLine:I,quadrants:W,pointRadius:X,overlay:M,maxPoints:P,margin:z,tooltip:V,onPointClick:$,plotLabel:O,formatValue:x,formatX:L}){let[t,D]=se(null),e=N(()=>{let i=w.filter(a=>!a.hidden),K=i.map(a=>a.key),o=xe({width:y,height:m,data:r,x:{...p,scale:p.scale==="time"?"time":"linear"},y:A,bounds:ae(ne(r,K)),margin:z,formatValue:x,formatX:L}),C=h?ne(r,[h.key]):[],R=h?ae(C):null,[b,k]=h?.range??[4,14],T=a=>{if(!h||!R)return X;let c=ie(a,h.key);if(c===null)return b;let[f,g]=R,v=g===f?1:(c-f)/(g-f);return Math.sqrt(b*b+v*(k*k-b*b))},G=[],d=[];i.forEach(a=>{let c=[];r.forEach((f,g)=>{let v=ie(f,a.key),n=o.categoryPositions[g];v===null||!Number.isFinite(n)||c.push({seriesKey:a.key,seriesLabel:re(a),color:a.color,index:g,cx:n,cy:o.valueScale(v),r:T(f),xValue:j(o.xValues[g]),yValue:v})}),P||ke("ScatterChart",c.length),d.push(...c),G.push(...P&&P>0?Se(c,P):c)});let H=null;if(I&&d.length>1){let a=d.length,c=d.reduce((u,s)=>u+s.xValue,0),f=d.reduce((u,s)=>u+s.yValue,0),g=d.reduce((u,s)=>u+s.xValue*s.yValue,0),v=d.reduce((u,s)=>u+s.xValue*s.xValue,0),n=a*v-c*c;if(n!==0){let u=(a*g-c*f)/n,s=(f-u*c)/a,Q=d.map(q=>q.xValue),[le,ce]=[Math.min(...Q),Math.max(...Q)],Z=d.map(q=>q.cx);H={x1:Math.min(...Z),y1:o.valueScale(u*le+s),x2:Math.max(...Z),y2:o.valueScale(u*ce+s)}}}return{visible:i,points:G,plot:Ce({geometry:o,width:y,height:m,data:r,series:i,formatValue:x,formatX:L}),trend:H,xTicks:o.categoryTicks,yTicks:o.valueTicks,valueScale:o.valueScale,positions:o.categoryPositions,innerWidth:o.innerWidth,innerHeight:o.innerHeight,margin:o.margin,xValues:o.xValues}},[r,w,p,A,y,m,z,h,I,X,P,x,L]),Y=U(i=>{if(V===!1||e.points.length===0)return;let K=i.currentTarget.getBoundingClientRect(),o=i.clientX-K.left-e.margin.left,C=i.clientY-K.top-e.margin.top,R=null,b=Le;for(let k of e.points){let T=Math.hypot(k.cx-o,k.cy-C);T<b&&(b=T,R=k)}D(R)},[V,e.points,e.margin]),_=U(()=>{if(!$||!t)return;let i=r[t.index];i&&$({seriesKey:t.seriesKey,seriesLabel:t.seriesLabel,color:t.color,value:t.yValue,formattedValue:x(t.yValue),datum:i,index:t.index,x:e.xValues[t.index]})},[$,t,x,r,e.xValues]),B=ve(M);return F(we,{children:[F("svg",{width:y,height:m,role:"img","aria-label":O??e.visible.map(i=>re(i)).join(", "),tabIndex:0,className:"touch-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",onPointerMove:Y,onPointerLeave:()=>D(null),onBlur:()=>D(null),onClick:_,children:[F("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[l(me,{width:e.innerWidth,height:e.innerHeight,horizontal:S==="y"||S==="both"?e.yTicks.map(i=>i.offset):void 0,vertical:S==="x"||S==="both"?e.xTicks.map(i=>i.offset):void 0}),W?.y!==void 0?l("line",{x1:0,y1:e.valueScale(W.y),x2:e.innerWidth,y2:e.valueScale(W.y),stroke:"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:"4 4"}):null,B.under?.(e.plot),e.trend?l("line",{x1:e.trend.x1,y1:e.trend.y1,x2:e.trend.x2,y2:e.trend.y2,stroke:"var(--color-chart-muted)",strokeWidth:1.5,strokeDasharray:"4 4"}):null,l(Re,{points:e.points}),B.over?.(e.plot),t?l("circle",{cx:t.cx,cy:t.cy,r:t.r+3,fill:"none",stroke:t.color,strokeWidth:2,"aria-hidden":"true"}):null]}),l("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:p.hidden?null:l(ee,{orientation:"bottom",ticks:e.xTicks,length:e.innerWidth,label:p.label,size:E})}),l("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:A?.hidden?null:l(ee,{orientation:"left",ticks:e.yTicks,length:e.innerHeight,showLine:!1,label:A?.label,size:E})})]}),t&&r[t.index]&&V!==!1?l(ge,{x:e.margin.left+t.cx,y:e.margin.top+t.cy,containerWidth:y,children:typeof V=="function"?V({x:e.xValues[t.index],xLabel:L(e.xValues[t.index],t.index),index:t.index,points:[{seriesKey:t.seriesKey,seriesLabel:t.seriesLabel,color:t.color,value:t.yValue,formattedValue:x(t.yValue),datum:r[t.index]}]}):l(ye,{title:`${p.label??p.key} ${L(e.xValues[t.index],t.index)}`,points:[{seriesKey:t.seriesKey,seriesLabel:t.seriesLabel,color:t.color,value:t.yValue,formattedValue:x(t.yValue),datum:r[t.index]}]})}):null]})}function Oe({data:y,series:m,x:r,y:w,height:p=280,width:A,size:S="md",grid:E="both",legend:h,tooltip:I=!0,tableView:W=!1,emphasis:X,title:M,description:P,loading:z=!1,emptyState:V,error:$=!1,errorState:O,onRetry:x,actions:L,onPointClick:t,bubble:D,trendLine:e=!1,quadrants:Y,pointRadius:_=Ve,overlay:B,legendToggle:i=!0,maxPoints:K,margin:o,locale:C,plotLabel:R,className:b,...k}){let[T,G]=se(()=>new Set);m.length>te&&!J&&(J=!0,console.warn(`[@synertech/ui] A ScatterChart was given ${m.length} series. Any two marks can sit side by side here, and only the first ${te} palette slots stay tellable apart under that test: facet the chart instead.`));let d=N(()=>m.map((n,u)=>({...n,hidden:n.hidden||T.has(n.key),color:pe(n,u,X)})),[m,T,X]),H=N(()=>w?.format??(n=>oe(n,C)),[w?.format,C]),a=N(()=>r.format??(n=>r.scale==="time"?Pe(n instanceof Date?n:new Date(j(n)),C):oe(j(n),C)),[r.format,r.scale,C]),c=U(n=>{G(u=>{let s=new Set(u);return s.has(n)?s.delete(n):s.add(n),s})},[]),f=h===void 0?m.length>=2:h!==!1,g=typeof h=="string"?h:"bottom",v=d.filter(n=>!n.hidden).length;return l(de,{title:M,description:P,height:p,width:A,size:S,loading:z,empty:y.length===0||v===0,emptyState:V,error:$,errorState:O,onRetry:x,actions:L,tableView:W,legendPosition:g,legend:f?l(he,{items:be(d,X),position:g,marker:"dot",size:S,onToggle:i?c:void 0}):void 0,table:W?l(fe,{data:y,series:d,xKey:r.key,xLabel:r.label??r.key,formatX:a,formatValue:H,caption:typeof M=="string"?M:void 0}):void 0,className:b,...k,children:({width:n})=>l(Te,{width:n,height:p,data:y,resolvedSeries:d,x:r,y:w,grid:E,size:S,bubble:D,trendLine:e,quadrants:Y,pointRadius:_,overlay:B,maxPoints:K,margin:o,tooltip:I,onPointClick:t,plotLabel:R,formatValue:H,formatX:a})})}function Ye(){J=!1}export{Oe as ScatterChart,Ye as resetScatterWarnings};
1
+ "use client";import{memo as fe,useCallback as _,useMemo as U,useState as de}from"react";import{ChartAxis as ne}from"../chart/ChartAxis.js";import{ChartContainer as ge}from"../chart/ChartContainer.js";import{ChartGrid as ye}from"../chart/ChartGrid.js";import{ChartLegend as pe}from"../chart/ChartLegend.js";import{ChartTableView as xe}from"../chart/ChartTableView.js";import{ChartTooltip as be,ChartTooltipContent as Ce}from"../chart/ChartTooltip.js";import{CHART_ALL_PAIRS_LIMIT as oe,getSeriesLabel as ae,resolveSeriesColor as ke,toLegendItems as ve}from"../chart/palette.js";import{buildCartesianGeometry as Se,createPlotContext as Pe,splitOverlay as Ve}from"../chart/utils/cartesian.js";import{collectAllValues as ie,readNumber as se}from"../chart/utils/data.js";import{sampleEvenly as Re,warnPointBudget as we}from"../chart/utils/decimate.js";import{formatAuto as le}from"../chart/utils/format.js";import{pressChartMark as Le,stepChartCursor as Q}from"../chart/utils/keyboard.js";import{toNumber as Te}from"../chart/utils/scales.js";import{extent as ce}from"../chart/utils/ticks.js";import{formatTimeValue as Ke}from"../chart/utils/timestamp.js";import{CHART_TOUCH as Ae}from"../chart/utils/touch.js";import{Fragment as De,jsx as d,jsxs as Z}from"react/jsx-runtime";var Ie=4.5,Me=48,ee=!1;function ue(m){return`${m.index}:${m.seriesKey}`}function Ee(m,h){return m.reduce((r,V)=>Math.abs(V.cx-h)<Math.abs(r.cx-h)?V:r)}var $e=fe(function({points:h}){return d("g",{children:h.map(r=>d("circle",{cx:r.cx,cy:r.cy,r:r.r,fill:r.color,fillOpacity:.85,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},`${r.seriesKey}-${r.index}`))})});function We({width:m,height:h,data:r,resolvedSeries:V,x:v,y:I,grid:w,size:X,bubble:x,trendLine:G,quadrants:M,pointRadius:E,overlay:D,maxPoints:L,margin:O,tooltip:T,onPointClick:K,plotLabel:q,formatValue:R,formatX:A}){let[z,$]=de(null),t=U(()=>{let o=V.filter(i=>!i.hidden),c=o.map(i=>i.key),a=Se({width:m,height:h,data:r,x:{...v,scale:v.scale==="time"?"time":"linear"},y:I,bounds:ce(ie(r,c)),margin:O,formatValue:R,formatX:A}),S=x?ie(r,[x.key]):[],P=x?ce(S):null,[s,u]=x?.range??[4,14],l=i=>{if(!x||!P)return E;let f=se(i,x.key);if(f===null)return s;let[n,y]=P,g=y===n?1:(f-n)/(y-n);return Math.sqrt(s*s+g*(u*u-s*s))},k=[],b=[],N=[];o.forEach(i=>{let f=[];r.forEach((y,g)=>{let W=se(y,i.key),p=a.categoryPositions[g];W===null||!Number.isFinite(p)||f.push({seriesKey:i.key,seriesLabel:ae(i),color:i.color,index:g,cx:p,cy:a.valueScale(W),r:l(y),xValue:a.toCategoryNumber(a.xValues[g]),yValue:W})}),L||we("ScatterChart",f.length);let n=L&&L>0?Re(f,L):f;b.push(...f),k.push(...n),n.length>0&&N.push([...n].sort((y,g)=>y.cx-g.cx||y.index-g.index))});let Y=null;if(G&&b.length>1){let i=b.length,f=b.reduce((p,C)=>p+C.xValue,0),n=b.reduce((p,C)=>p+C.yValue,0),y=b.reduce((p,C)=>p+C.xValue*C.yValue,0),g=b.reduce((p,C)=>p+C.xValue*C.xValue,0),W=i*g-f*f;if(W!==0){let p=(i*y-f*n)/W,C=(n-p*f)/i,te=b.map(J=>J.xValue),[me,he]=[Math.min(...te),Math.max(...te)],re=b.map(J=>J.cx);Y={x1:Math.min(...re),y1:a.valueScale(p*me+C),x2:Math.max(...re),y2:a.valueScale(p*he+C)}}}return{visible:o,points:k,tracks:N,marks:new Map(k.map(i=>[ue(i),i])),plot:Pe({geometry:a,width:m,height:h,data:r,series:o,formatValue:R,formatX:A}),trend:Y,xTicks:a.categoryTicks,yTicks:a.valueTicks,valueScale:a.valueScale,positions:a.categoryPositions,innerWidth:a.innerWidth,innerHeight:a.innerHeight,margin:a.margin,xValues:a.xValues}},[r,V,v,I,m,h,O,x,G,E,L,R,A]),e=z===null?null:t.marks.get(ue(z))??null,F=_(o=>{if(T===!1||t.points.length===0)return;let c=o.currentTarget.getBoundingClientRect(),a=o.clientX-c.left-t.margin.left,S=o.clientY-c.top-t.margin.top,P=null,s=Me;for(let u of t.points){let l=Math.hypot(u.cx-a,u.cy-S);l<s&&(s=l,P=u)}$(P)},[T,t.points,t.margin]),H=_(()=>{if(!K||!e)return;let o=r[e.index];o&&K({seriesKey:e.seriesKey,seriesLabel:e.seriesLabel,color:e.color,value:e.yValue,formattedValue:R(e.yValue),datum:o,index:e.index,x:t.xValues[e.index]})},[K,e,R,r,t.xValues]),j=_(o=>{let{tracks:c}=t;if(c.length===0||Le(o,K&&e?H:null))return;let a=e?c.findIndex(k=>k[0].seriesKey===e.seriesKey):-1,S=a<0?null:c[a],P=S&&e?S.indexOf(e):-1,s=S&&P>=0?{track:S,trackIndex:a,markIndex:P}:null,u=s?.track??c[0],l;switch(o.key){case"ArrowRight":l=u[Q(s?.markIndex??null,1,u.length)];break;case"ArrowLeft":l=u[Q(s?.markIndex??null,-1,u.length)];break;case"ArrowDown":case"ArrowUp":{if(!s||!e){l=u[0];break}let k=Q(s.trackIndex,o.key==="ArrowDown"?1:-1,c.length);l=k===s.trackIndex?e:Ee(c[k],e.cx);break}case"Home":l=u[0];break;case"End":l=u[u.length-1];break;case"Escape":l=null;break;default:return}o.preventDefault(),$(l)},[t,e,K,H]),B=Ve(D);return Z(De,{children:[Z("svg",{width:m,height:h,role:"img","aria-label":q??t.visible.map(o=>ae(o)).join(", "),tabIndex:0,className:`${Ae} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500`,onPointerMove:F,onPointerLeave:()=>$(null),onKeyDown:j,onBlur:()=>$(null),onClick:H,children:[Z("g",{transform:`translate(${t.margin.left}, ${t.margin.top})`,children:[d(ye,{width:t.innerWidth,height:t.innerHeight,horizontal:w==="y"||w==="both"?t.yTicks.map(o=>o.offset):void 0,vertical:w==="x"||w==="both"?t.xTicks.map(o=>o.offset):void 0}),M?.y!==void 0?d("line",{x1:0,y1:t.valueScale(M.y),x2:t.innerWidth,y2:t.valueScale(M.y),stroke:"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:"4 4"}):null,B.under?.(t.plot),t.trend?d("line",{x1:t.trend.x1,y1:t.trend.y1,x2:t.trend.x2,y2:t.trend.y2,stroke:"var(--color-chart-muted)",strokeWidth:1.5,strokeDasharray:"4 4"}):null,d($e,{points:t.points}),B.over?.(t.plot),e?d("circle",{cx:e.cx,cy:e.cy,r:e.r+3,fill:"none",stroke:e.color,strokeWidth:2,"aria-hidden":"true"}):null]}),d("g",{transform:`translate(${t.margin.left}, ${t.margin.top+t.innerHeight})`,children:v.hidden?null:d(ne,{orientation:"bottom",ticks:t.xTicks,length:t.innerWidth,label:v.label,size:X})}),d("g",{transform:`translate(${t.margin.left}, ${t.margin.top})`,children:I?.hidden?null:d(ne,{orientation:"left",ticks:t.yTicks,length:t.innerHeight,showLine:!1,label:I?.label,size:X})})]}),e&&r[e.index]&&T!==!1?d(be,{x:t.margin.left+e.cx,y:t.margin.top+e.cy,containerWidth:m,children:typeof T=="function"?T({x:t.xValues[e.index],xLabel:A(t.xValues[e.index],e.index),index:e.index,points:[{seriesKey:e.seriesKey,seriesLabel:e.seriesLabel,color:e.color,value:e.yValue,formattedValue:R(e.yValue),datum:r[e.index]}]}):d(Ce,{title:`${v.label??v.key} ${A(t.xValues[e.index],e.index)}`,points:[{seriesKey:e.seriesKey,seriesLabel:e.seriesLabel,color:e.color,value:e.yValue,formattedValue:R(e.yValue),datum:r[e.index]}]})}):null]})}function tt({data:m,series:h,x:r,y:V,height:v=280,width:I,size:w="md",grid:X="both",legend:x,tooltip:G=!0,tableView:M=!1,emphasis:E,title:D,description:L,loading:O=!1,emptyState:T,error:K=!1,errorState:q,onRetry:R,actions:A,onPointClick:z,bubble:$,trendLine:t=!1,quadrants:e,pointRadius:F=Ie,overlay:H,legendToggle:j=!0,maxPoints:B,margin:o,locale:c,plotLabel:a,className:S,...P}){let[s,u]=de(()=>new Set);h.length>oe&&!ee&&(ee=!0,console.warn(`[@synertech/ui] A ScatterChart was given ${h.length} series. Any two marks can sit side by side here, and only the first ${oe} palette slots stay tellable apart under that test: facet the chart instead.`));let l=U(()=>h.map((n,y)=>({...n,hidden:n.hidden||s.has(n.key),color:ke(n,y,E)})),[h,s,E]),k=U(()=>V?.format??(n=>le(n,c)),[V?.format,c]),b=U(()=>r.format??(n=>r.scale==="time"?Ke(n,c):le(Te(n),c)),[r.format,r.scale,c]),N=_(n=>{u(y=>{let g=new Set(y);return g.has(n)?g.delete(n):g.add(n),g})},[]),Y=x===void 0?h.length>=2:x!==!1,i=typeof x=="string"?x:"bottom",f=l.filter(n=>!n.hidden).length;return d(ge,{title:D,description:L,height:v,width:I,size:w,loading:O,empty:m.length===0||f===0,emptyState:T,error:K,errorState:q,onRetry:R,actions:A,tableView:M,legendPosition:i,legend:Y?d(pe,{items:ve(l,E),position:i,marker:"dot",size:w,onToggle:j?N:void 0}):void 0,table:M?d(xe,{data:m,series:l,xKey:r.key,xLabel:r.label??r.key,formatX:b,formatValue:k,caption:typeof D=="string"?D:void 0}):void 0,className:S,...P,children:({width:n})=>d(We,{width:n,height:v,data:m,resolvedSeries:l,x:r,y:V,grid:X,size:w,bubble:$,trendLine:t,quadrants:e,pointRadius:F,overlay:H,maxPoints:B,margin:o,tooltip:G,onPointClick:z,plotLabel:a,formatValue:k,formatX:b})})}function rt(){ee=!1}export{tt as ScatterChart,rt as resetScatterWarnings};