@synertech/ui 0.51.0 → 0.53.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.
- package/.claude/skills/use-synertech-ui/SKILL.md +304 -153
- package/README.md +27 -19
- package/dist/components/advance-detachable/AdvanceDetachable.cjs +1 -1
- package/dist/components/advance-detachable/AdvanceDetachable.js +1 -1
- package/dist/components/area-chart/AreaChart.cjs +1 -1
- package/dist/components/area-chart/AreaChart.js +1 -1
- package/dist/components/avatar/Avatar.cjs +1 -1
- package/dist/components/avatar/Avatar.js +1 -1
- package/dist/components/avatar/AvatarImage.cjs +1 -0
- package/dist/components/avatar/AvatarImage.js +1 -0
- package/dist/components/banner/Banner.cjs +1 -1
- package/dist/components/banner/Banner.js +1 -1
- package/dist/components/bar-chart/BarChart.cjs +1 -1
- package/dist/components/bar-chart/BarChart.js +1 -1
- package/dist/components/box-plot/BoxPlot.cjs +1 -1
- package/dist/components/box-plot/BoxPlot.js +1 -1
- package/dist/components/breadcrumb/Breadcrumb.cjs +1 -1
- package/dist/components/breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/bullet-chart/BulletChart.cjs +1 -1
- package/dist/components/bullet-chart/BulletChart.js +1 -1
- package/dist/components/calendar/Calendar.cjs +1 -1
- package/dist/components/calendar/Calendar.js +1 -1
- package/dist/components/candlestick-chart/CandlestickChart.cjs +1 -1
- package/dist/components/candlestick-chart/CandlestickChart.js +1 -1
- package/dist/components/card/Card.cjs +1 -1
- package/dist/components/card/Card.js +1 -1
- package/dist/components/chart/ChartAnnotations.cjs +1 -1
- package/dist/components/chart/ChartAnnotations.js +1 -1
- package/dist/components/chart/ChartBrush.cjs +1 -1
- package/dist/components/chart/ChartBrush.js +1 -1
- package/dist/components/chart/ChartContainer.cjs +1 -1
- package/dist/components/chart/ChartContainer.js +1 -1
- package/dist/components/chart/ChartExportButton.cjs +1 -1
- package/dist/components/chart/ChartExportButton.js +1 -1
- package/dist/components/chart/ChartPatterns.cjs +1 -1
- package/dist/components/chart/ChartPatterns.js +1 -1
- package/dist/components/chart/ChartPlotClip.cjs +1 -0
- package/dist/components/chart/ChartPlotClip.js +1 -0
- package/dist/components/chart/ChartSync.cjs +1 -1
- package/dist/components/chart/ChartSync.js +1 -1
- package/dist/components/chart/ChartTableView.cjs +1 -1
- package/dist/components/chart/ChartTableView.js +1 -1
- package/dist/components/chart/exportSource.cjs +1 -0
- package/dist/components/chart/exportSource.js +1 -0
- package/dist/components/chart/palette.cjs +1 -1
- package/dist/components/chart/palette.js +1 -1
- package/dist/components/chart/useChartSize.cjs +1 -1
- package/dist/components/chart/useChartSize.js +1 -1
- package/dist/components/chart/utils/bins.cjs +1 -1
- package/dist/components/chart/utils/bins.js +1 -1
- package/dist/components/chart/utils/cartesian.cjs +1 -1
- package/dist/components/chart/utils/cartesian.js +1 -1
- package/dist/components/chart/utils/export.cjs +7 -1
- package/dist/components/chart/utils/export.js +7 -1
- package/dist/components/chart/utils/format.cjs +1 -1
- package/dist/components/chart/utils/format.js +1 -1
- package/dist/components/chart/utils/keyboard.cjs +1 -1
- package/dist/components/chart/utils/keyboard.js +1 -1
- package/dist/components/chart/utils/period.cjs +1 -1
- package/dist/components/chart/utils/period.js +1 -1
- package/dist/components/chart/utils/regression.cjs +1 -0
- package/dist/components/chart/utils/regression.js +1 -0
- package/dist/components/chart/utils/stack.cjs +1 -1
- package/dist/components/chart/utils/stack.js +1 -1
- package/dist/components/chart/utils/ticks.cjs +1 -1
- package/dist/components/chart/utils/ticks.js +1 -1
- package/dist/components/checkbox/Checkbox.cjs +1 -1
- package/dist/components/checkbox/Checkbox.js +1 -1
- package/dist/components/checkbox/CheckboxGroup.cjs +1 -1
- package/dist/components/checkbox/CheckboxGroup.js +1 -1
- package/dist/components/circular-progress/CircularProgress.cjs +1 -1
- package/dist/components/circular-progress/CircularProgress.js +1 -1
- package/dist/components/datagrid/DataGrid.cjs +1 -1
- package/dist/components/datagrid/DataGrid.js +1 -1
- package/dist/components/date-picker/DatePicker.cjs +1 -0
- package/dist/components/date-picker/DatePicker.js +1 -0
- package/dist/components/date-picker/DateRangePicker.cjs +1 -0
- package/dist/components/date-picker/DateRangePicker.js +1 -0
- package/dist/components/date-picker/date-field.cjs +1 -0
- package/dist/components/date-picker/date-field.js +1 -0
- package/dist/components/date-picker/date-input.cjs +1 -0
- package/dist/components/date-picker/date-input.js +1 -0
- package/dist/components/date-picker/index.cjs +1 -0
- package/dist/components/date-picker/index.js +1 -0
- package/dist/components/detachable/Detachable.cjs +1 -1
- package/dist/components/detachable/Detachable.js +1 -1
- package/dist/components/detachable/popup-window.cjs +1 -0
- package/dist/components/detachable/popup-window.js +1 -0
- package/dist/components/device-mockup/DeviceMockup.cjs +1 -1
- package/dist/components/device-mockup/DeviceMockup.js +1 -1
- package/dist/components/divider/Divider.cjs +1 -1
- package/dist/components/divider/Divider.js +1 -1
- package/dist/components/dumbbell-chart/DumbbellChart.cjs +1 -1
- package/dist/components/dumbbell-chart/DumbbellChart.js +1 -1
- package/dist/components/file-selector/FileSelector.cjs +1 -1
- package/dist/components/file-selector/FileSelector.js +1 -1
- package/dist/components/footer/FooterBottom.cjs +1 -1
- package/dist/components/footer/FooterBottom.js +1 -1
- package/dist/components/form/form-field/FormField.cjs +1 -0
- package/dist/components/form/form-field/FormField.js +1 -0
- package/dist/components/form/form-field/index.cjs +1 -0
- package/dist/components/form/form-field/index.js +1 -0
- package/dist/components/form/index.cjs +1 -1
- package/dist/components/form/index.js +1 -1
- package/dist/components/form/input/Input.cjs +1 -1
- package/dist/components/form/input/Input.js +1 -1
- package/dist/components/form/mention-input/MentionInput.cjs +5 -4
- package/dist/components/form/mention-input/MentionInput.js +5 -4
- package/dist/components/form/number-input/NumberInput.cjs +1 -1
- package/dist/components/form/number-input/NumberInput.js +1 -1
- package/dist/components/form/shared/InputWrapper.cjs +1 -1
- package/dist/components/form/shared/InputWrapper.js +1 -1
- package/dist/components/form/shared/field-error.cjs +1 -0
- package/dist/components/form/shared/field-error.js +1 -0
- package/dist/components/form/shared/inputStyles.cjs +1 -1
- package/dist/components/form/shared/inputStyles.js +1 -1
- package/dist/components/funnel-chart/FunnelChart.cjs +1 -1
- package/dist/components/funnel-chart/FunnelChart.js +1 -1
- package/dist/components/gantt-chart/GanttChart.cjs +1 -1
- package/dist/components/gantt-chart/GanttChart.js +1 -1
- package/dist/components/header/Header.cjs +1 -1
- package/dist/components/header/Header.js +1 -1
- package/dist/components/heat-map/Heatmap.cjs +1 -1
- package/dist/components/heat-map/Heatmap.js +1 -1
- package/dist/components/help-button/HelpButton.cjs +4 -12
- package/dist/components/help-button/HelpButton.js +4 -12
- package/dist/components/help-button/MarkdownEditor.cjs +1 -1
- package/dist/components/help-button/MarkdownEditor.js +1 -1
- package/dist/components/image-uploader/ImageUploader.cjs +1 -1
- package/dist/components/image-uploader/ImageUploader.js +1 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/line-chart/LineChart.cjs +1 -1
- package/dist/components/line-chart/LineChart.js +1 -1
- package/dist/components/pagination/Pagination.cjs +1 -1
- package/dist/components/pagination/Pagination.js +1 -1
- package/dist/components/pie-chart/PieChart.cjs +1 -1
- package/dist/components/pie-chart/PieChart.js +1 -1
- package/dist/components/popover/Popover.cjs +1 -0
- package/dist/components/popover/Popover.js +1 -0
- package/dist/components/popover/PopoverClose.cjs +1 -0
- package/dist/components/popover/PopoverClose.js +1 -0
- package/dist/components/popover/PopoverContent.cjs +1 -0
- package/dist/components/popover/PopoverContent.js +1 -0
- package/dist/components/popover/PopoverTrigger.cjs +1 -0
- package/dist/components/popover/PopoverTrigger.js +1 -0
- package/dist/components/popover/index.cjs +1 -0
- package/dist/components/popover/index.js +1 -0
- package/dist/components/progress-bar/ProgressBar.cjs +1 -1
- package/dist/components/progress-bar/ProgressBar.js +1 -1
- package/dist/components/radio-button/RadioButton.cjs +1 -1
- package/dist/components/radio-button/RadioButton.js +1 -1
- package/dist/components/scatter-chart/ScatterChart.cjs +1 -1
- package/dist/components/scatter-chart/ScatterChart.js +1 -1
- package/dist/components/scatter-chart/index.cjs +1 -1
- package/dist/components/scatter-chart/index.js +1 -1
- package/dist/components/schema-editor/SchemaEditor.cjs +1 -1
- package/dist/components/schema-editor/SchemaEditor.js +1 -1
- package/dist/components/schema-editor/canvas/GridLayer.cjs +1 -1
- package/dist/components/schema-editor/canvas/GridLayer.js +1 -1
- package/dist/components/schema-editor/relations/SchemaRelationRenderer.cjs +1 -1
- package/dist/components/schema-editor/relations/SchemaRelationRenderer.js +1 -1
- package/dist/components/schema-editor/tables/SchemaTableRenderer.cjs +1 -1
- package/dist/components/schema-editor/tables/SchemaTableRenderer.js +1 -1
- package/dist/components/schema-editor/utils/sql-export.cjs +4 -4
- package/dist/components/schema-editor/utils/sql-export.js +7 -7
- package/dist/components/select/Select.cjs +1 -1
- package/dist/components/select/Select.js +1 -1
- package/dist/components/slider/Slider.cjs +1 -1
- package/dist/components/slider/Slider.js +1 -1
- package/dist/components/sparkline/Sparkline.cjs +1 -1
- package/dist/components/sparkline/Sparkline.js +1 -1
- package/dist/components/table/TableRow.cjs +1 -1
- package/dist/components/table/TableRow.js +1 -1
- package/dist/components/tooltip/Tooltip.cjs +1 -1
- package/dist/components/tooltip/Tooltip.js +1 -1
- package/dist/components/waterfall-chart/WaterfallChart.cjs +1 -1
- package/dist/components/waterfall-chart/WaterfallChart.js +1 -1
- package/dist/components/workflow-editor/WorkflowEditor.cjs +1 -1
- package/dist/components/workflow-editor/WorkflowEditor.js +1 -1
- package/dist/components/workflow-editor/canvas/GridLayer.cjs +1 -1
- package/dist/components/workflow-editor/canvas/GridLayer.js +1 -1
- package/dist/index.d.cts +2961 -2272
- package/dist/index.d.ts +2961 -2272
- package/dist/lib/accept.cjs +1 -0
- package/dist/lib/accept.js +1 -0
- package/dist/lib/css-value.cjs +1 -0
- package/dist/lib/css-value.js +1 -0
- package/dist/lib/ui-labels.cjs +1 -1
- package/dist/lib/ui-labels.js +1 -1
- package/dist/styles-no-preflight.css +10419 -0
- package/dist/styles.css +463 -41
- package/package.json +9 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{memo as Ae,useCallback as x,useMemo as re,useState as ye}from"react";import{cn as Te}from"../../lib/cn.js";import{useUILabels as Be,useUILocale as Ee}from"../../lib/i18n.js";import{ChartAnnotationLayer as xe,describeAnnotations as He}from"../chart/ChartAnnotations.js";import{ChartAxis as ke}from"../chart/ChartAxis.js";import{ChartBrushLayer as We,useChartBrush as Ie}from"../chart/ChartBrush.js";import{ChartContainer as Ne}from"../chart/ChartContainer.js";import{ChartGrid as De}from"../chart/ChartGrid.js";import{ChartLegend as Ke}from"../chart/ChartLegend.js";import{useChartSync as Me}from"../chart/ChartSync.js";import{ChartTableView as Xe}from"../chart/ChartTableView.js";import{ChartTooltip as Ge,ChartTooltipContent as Oe}from"../chart/ChartTooltip.js";import{getSeriesLabel as ve,resolveSeriesColor as $e,toLegendItems as _e}from"../chart/palette.js";import{buildCartesianGeometry as ze,createCategoryLocator as Ue,createPlotContext as je,splitOverlay as Fe}from"../chart/utils/cartesian.js";import{collectAllValues as Ye,readNumber as Pe}from"../chart/utils/data.js";import{decimatePath as qe,warnPointBudget as Je}from"../chart/utils/decimate.js";import{formatAuto as Qe,formatXValue as Ze}from"../chart/utils/format.js";import{chartCursorTarget as et,pressChartMark as tt}from"../chart/utils/keyboard.js";import{buildLinePath as Le,isDrawable as nt,isolatedPoints as rt}from"../chart/utils/path.js";import{nearestIndex as ot,toKey as ne}from"../chart/utils/scales.js";import{extent as at}from"../chart/utils/ticks.js";import{formatTimeValue as st}from"../chart/utils/timestamp.js";import{CHART_TOUCH as it}from"../chart/utils/touch.js";import{Fragment as mt,jsx as o,jsxs as E}from"react/jsx-runtime";var lt=24,ht=10,ut=10,ct=Ae(function({lines:m,showMarkers:r}){return o("g",{children:m.map(i=>E("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((f,y)=>o("circle",{cx:f.x,cy:f.y,r:3,fill:i.color,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},y))]},i.key))})});function dt({width:d,height:m,data:r,resolvedSeries:i,x:f,y,grid:C,size:j,curve:b,forecastFrom:N,forecastLabel:k,markers:v,connectNulls:P,referenceLines:oe,annotations:L,annotationsLabel:ae,overlay:se,maxPoints:S,brush:F,onBrush:Y,brushLabel:ie,syncEnabled:le,margin:q,tooltip:R,onPointClick:w,plotLabel:he,formatValue:V,formatX:H}){let[D,K]=ye(null),s=D!==null&&D<r.length?D:null,[ue,ce]=ye(null),de=Me(),h=le?de:null,e=re(()=>{let t=i.filter(u=>!u.hidden),n=ze({width:d,height:m,data:r,x:f,y,bounds:at(Ye(r,t.map(u=>u.key))),margin:q,placement:"point",formatValue:V,formatX:H,extraTop:k?ht:0}),l=n.categoryCenters,B=n.valueScale,Z=N===void 0?-1:n.xValues.findIndex(u=>ne(u)===ne(N)),Se=t.map(u=>{let _=r.map((te,Ve)=>{let pe=Pe(te,u.key);return{x:l[Ve],y:pe===null?Number.NaN:B(pe),defined:pe!==null}}),Ce={connectNulls:P},ee=Z>=0,ge=te=>S&&S>0?qe(te,S):te,z=u.dashed?[]:ge(ee?_.slice(0,Z+1):_),U=u.dashed?ge(_):ee?ge(_.slice(Z)):[];S||Je("LineChart",_.length);let we=z[z.length-1],be=u.dashed?U:ee?[...z,...U[0]===we?U.slice(1):U]:z;return{key:u.key,color:u.color,solid:u.dashed?"":Le(z,b,Ce),dashed:u.dashed||ee?Le(U,b,Ce):"",markers:be.filter(nt),isolated:rt(be,P)}}),Re=r.length>1?n.innerWidth/(r.length-1):0;return{visible:t,locate:Ue(n),plot:je({geometry:n,width:d,height:m,data:r,series:t,formatValue:V,formatX:H}),xValues:n.xValues,xPositions:l,xTicks:n.categoryTicks,yTicks:n.valueTicks,yScale:B,innerWidth:n.innerWidth,innerHeight:n.innerHeight,margin:n.margin,lines:Se,forecastIndex:Z,showMarkers:v==="always"||v==="auto"&&Re>=lt&&r.length>1}},[r,i,f,y,d,m,q,b,P,N,k,v,S,V,H]),M=x(t=>e.visible.map(n=>{let l=Pe(r[t],n.key);return{seriesKey:n.key,seriesLabel:ve(n),color:n.color,value:l,formattedValue:l===null?"\u2014":V(l),datum:r[t]}}),[r,e.visible,V]),J=h?h.brush:ue,me=x(t=>{ce(t),h?.setBrush(t),Y?.(t)},[h,Y]),c=Ie({enabled:F,active:J!==null,centers:e.xPositions,xValues:e.xValues,offset:e.margin.left,orientation:"vertical",onCommit:me}),A=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,B=ot(e.xPositions,l);K(B>=0?B:null),h?.setHovered(B>=0?e.xValues[B]:null)},[c,R,r.length,e.margin.left,e.xPositions,e.xValues,h]),X=x(()=>{K(null),h?.setHovered(null)},[h]),T=x(()=>{if(!w||s===null)return;let[t]=M(s);t&&w({...t,index:s,x:e.xValues[s]})},[w,s,M,e.xValues]),fe=x(t=>{if(r.length===0)return;let n=w&&s!==null&&e.visible.length>0;if(tt(t,n?T:null))return;c.onKeyDown(t,s);let l=et(t.key,s,r.length,"x");l!==void 0&&(t.preventDefault(),K(l),h?.setHovered(l===null?null:e.xValues[l]))},[r.length,s,c,h,e.xValues,e.visible.length,w,T]),W=x(()=>{c.consumedClick()||T()},[c,T]),Q=s!==null||!h?.hovered?null:(()=>{let t=ne(h.hovered),n=e.xValues.findIndex(l=>ne(l)===t);return n<0?null:n})(),g=s??Q,G=g===null?null:M(g),O=(G??[]).filter(t=>t.value!==null),I=c.dragging??J,$=(()=>{if(!I)return null;let t=e.locate(I.from),n=e.locate(I.to);return t===null||n===null?null:{from:t,to:n}})(),a=Fe(se),p=s===null||G===null?null:{x:e.xValues[s],xLabel:H(e.xValues[s],s),index:s,points:G};return E(mt,{children:[E("svg",{width:d,height:m,role:"img","aria-label":he??[e.visible.map(t=>ve(t)).join(", "),He(L,ae)].filter(Boolean).join(". "),tabIndex:0,className:Te(it,"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500",F&&"select-none"),onPointerDown:c.onPointerDown,onPointerMove:A,onPointerUp:c.onPointerUp,onPointerCancel:c.onPointerUp,onPointerLeave:X,onKeyDown:fe,onBlur:X,onClick:W,children:[E("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[o(De,{width:e.innerWidth,height:e.innerHeight,horizontal:C==="y"||C==="both"?e.yTicks.map(t=>t.offset):void 0,vertical:C==="x"||C==="both"?e.xTicks.map(t=>t.offset):void 0}),L?o(xe,{layer:"under",annotations:L,xAt:e.locate,yAt:e.yScale,width:e.innerWidth,height:e.innerHeight}):null,$?o(We,{from:$.from,to:$.to,width:e.innerWidth,height:e.innerHeight,live:c.dragging!==null,label:ie}):null,a.under?.(e.plot),oe?.map(t=>{let n=e.yScale(t.value),l=n<ut?n+12:n-4;return E("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?E("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(ct,{lines:e.lines,showMarkers:e.showMarkers}),L?o(xe,{annotations:L,xAt:e.locate,yAt:e.yScale,width:e.innerWidth,height:e.innerHeight}):null,a.over?.(e.plot),g!==null?E("g",{"aria-hidden":"true",children:[o("line",{x1:e.xPositions[g],y1:0,x2:e.xPositions[g],y2:e.innerHeight,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:1,strokeDasharray:s===null?"3 3":void 0}),O.map(t=>o("circle",{cx:e.xPositions[g],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:f.hidden?null:o(ke,{orientation:"bottom",ticks:e.xTicks,length:e.innerWidth,label:f.label,size:j})}),o("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:y?.hidden?null:o(ke,{orientation:"left",ticks:e.yTicks,length:e.innerHeight,showLine:!1,label:y?.label,size:j})})]}),p&&R!==!1?o(Ge,{x:e.margin.left+e.xPositions[p.index],y:e.margin.top+(O.length>0?Math.min(...O.map(t=>e.yScale(t.value))):e.innerHeight/2),containerWidth:d,children:typeof R=="function"?R(p):o(Oe,{title:p.xLabel,points:p.points})}):null]})}function Dt({data:d,series:m,x:r,y:i,height:f=240,width:y,size:C="md",grid:j="y",legend:b,tooltip:N=!0,tableView:k=!1,emphasis:v,title:P,description:oe,loading:L=!1,emptyState:ae,error:se=!1,errorState:S,onRetry:F,actions:Y,onPointClick:ie,curve:le="monotone",forecastFrom:q,forecastLabel:R,markers:w="auto",connectNulls:he=!1,referenceLines:V,annotations:H,overlay:D,legendToggle:K=!0,maxPoints:s,brush:ue=!1,onBrush:ce,brushLabel:de,sync:h=!0,margin:e,locale:M,plotLabel:J,className:me,...c}){let A=Ee(M),X=Be(),[T,fe]=ye(()=>new Set),W=re(()=>m.map((a,p)=>({...a,hidden:a.hidden||T.has(a.key),color:$e(a,p,v)})),[m,T,v]),Q=re(()=>i?.format??(a=>Qe(a,A)),[i?.format,A]),g=re(()=>r.format??(a=>r.scale==="time"?st(a,A):Ze(a,A)),[r.format,r.scale,A]),G=x(a=>{fe(p=>{let t=new Set(p);return t.has(a)?t.delete(a):t.add(a),t})},[]),O=b===void 0?m.length>=2:b!==!1,I=typeof b=="string"?b:"bottom",$=W.filter(a=>!a.hidden).length;return o(Ne,{title:P,description:oe,height:f,width:y,size:C,loading:L,empty:d.length===0||$===0,emptyState:ae,error:se,errorState:S,onRetry:F,actions:Y,tableView:k,legendPosition:I,legend:O?o(Ke,{items:_e(W,v),position:I,marker:"line",size:C,onToggle:K?G:void 0}):void 0,table:k?o(Xe,{data:d,series:W,xKey:r.key,xLabel:r.label??r.key,formatX:g,formatValue:Q,caption:typeof P=="string"?P:void 0}):void 0,className:me,...c,children:({width:a})=>o(dt,{width:a,height:f,data:d,resolvedSeries:W,x:r,y:i,grid:j,size:C,curve:le,forecastFrom:q,forecastLabel:R,markers:w,connectNulls:he,referenceLines:V,annotations:H,annotationsLabel:X.chartAnnotations,overlay:D,maxPoints:s,brush:ue,onBrush:ce,brushLabel:de??X.chartBrush,syncEnabled:h,margin:e,tooltip:N,onPointClick:ie,plotLabel:J,formatValue:Q,formatX:g})})}export{Dt as LineChart};
|
|
1
|
+
"use client";import{memo as Ie,useCallback as R,useMemo as z,useState as ve}from"react";import{cn as Ne}from"../../lib/cn.js";import{useUILabels as Me,useUILocale as De}from"../../lib/i18n.js";import{ChartAnnotationLayer as Se,describeAnnotations as Ke}from"../chart/ChartAnnotations.js";import{ChartAxis as we}from"../chart/ChartAxis.js";import{ChartBrushLayer as Xe,locateBrush as Ge,useChartBrush as Oe}from"../chart/ChartBrush.js";import{ChartContainer as _e}from"../chart/ChartContainer.js";import{ChartGrid as $e}from"../chart/ChartGrid.js";import{ChartLegend as Ue}from"../chart/ChartLegend.js";import{useChartSync as je}from"../chart/ChartSync.js";import{ChartTableView as ze}from"../chart/ChartTableView.js";import{ChartTooltip as Fe,ChartTooltipContent as Ye}from"../chart/ChartTooltip.js";import{CHART_SURFACE_COLOR as Be,getSeriesLabel as Re,resolveSeriesColor as qe,toLegendItems as Je}from"../chart/palette.js";import{annotationValues as Qe,buildCartesianGeometry as Ze,createCategoryLocator as et,createPlotContext as tt,createSpanLocator as nt,plotPointer as rt,splitOverlay as ot,widenBounds as at}from"../chart/utils/cartesian.js";import{collectAllValues as st,readNumber as Ve}from"../chart/utils/data.js";import{decimatePath as it,warnPointBudget as lt}from"../chart/utils/decimate.js";import{formatAuto as ut,formatExact as ct,formatXValue as ht}from"../chart/utils/format.js";import{chartCursorTarget as dt,pressChartMark as mt}from"../chart/utils/keyboard.js";import{buildLinePath as Ae,isDrawable as ft,isolatedPoints as gt}from"../chart/utils/path.js";import{nearestIndex as Ee,toKey as ue}from"../chart/utils/scales.js";import{extent as pt}from"../chart/utils/ticks.js";import{formatTimeValue as yt,toTimestamp as Te}from"../chart/utils/timestamp.js";import{CHART_TOUCH as bt}from"../chart/utils/touch.js";import{Fragment as wt,jsx as o,jsxs as W}from"react/jsx-runtime";var Ct=6,xt=24,vt=10,kt=10,ke=!1;function qt(){ke=!1}function Pt(d,g){let n=ue(g),s=d.findIndex(p=>ue(p)===n);if(s>=0)return s;let m=Te(g);return m===null?-1:d.findIndex(p=>{let y=Te(p);return y!==null&&y>=m})}var Lt=Ie(function({lines:g,showMarkers:n}){return o("g",{children:g.map(s=>W("g",{children:[s.solid?o("path",{d:s.solid,fill:"none",stroke:s.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}):null,s.dashed?o("path",{d:s.dashed,fill:"none",stroke:s.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:"5 4"}):null,(n?s.markers:s.isolated).map((m,p)=>o("circle",{cx:m.x,cy:m.y,r:3,fill:s.color,strokeWidth:2,stroke:Be},p))]},s.key))})});function St({width:d,height:g,data:n,resolvedSeries:s,x:m,y:p,grid:y,size:F,curve:P,forecastFrom:V,forecastLabel:A,markers:E,connectNulls:T,referenceLines:D,annotations:v,annotationsLabel:ce,overlay:he,maxPoints:B,brush:Y,onBrush:q,brushLabel:de,syncEnabled:me,margin:J,tooltip:H,onPointClick:k,plotLabel:fe,formatValue:K,formatExact:Q,formatX:I,locale:Z}){let[X,G]=ve(null),l=X!==null&&X<n.length?X:null,[ge,pe]=ve(null),ye=je(),u=me?ye:null,e=z(()=>{let t=s.filter(h=>!h.hidden),r=Ze({locale:Z,width:d,height:g,data:n,x:m,y:p,bounds:at(pt(st(n,t.map(h=>h.key))),Qe(n,m.key,D,v)),margin:J,placement:"point",formatValue:K,formatX:I,extraTop:A?vt:0}),i=r.categoryCenters,c=r.valueScale,S=V===void 0?-1:Pt(r.xValues,V);V!==void 0&&S<0&&n.length>0&&!ke&&(ke=!0,console.warn(`[@synertech/ui] LineChart was given \`forecastFrom\` = ${String(V)}, which no row is on or after. Nothing is drawn as a forecast: pass the x value of the first projected row, in the form the rows carry it.`));let se=t.map(h=>{let $=n.map((le,We)=>{let xe=Ve(le,h.key);return{x:i[We],y:xe===null?Number.NaN:c(xe),defined:xe!==null}}),Pe={connectNulls:T},ie=S>=0,be=le=>B&&B>0?it(le,B):le,U=h.dashed?[]:be(ie?$.slice(0,S+1):$),j=h.dashed?be($):ie?be($.slice(S)):[];B||lt("LineChart",$.length);let He=U[U.length-1],Le=h.dashed?j:ie?[...U,...j[0]===He?j.slice(1):j]:U;return{key:h.key,color:h.color,solid:h.dashed?"":Ae(U,P,Pe),dashed:h.dashed||ie?Ae(j,P,Pe):"",markers:Le.filter(ft),isolated:gt(Le,T)}}),w=n.length>1?r.innerWidth/(n.length-1):0;return{visible:t,locate:et(r),span:nt(r),plot:tt({geometry:r,width:d,height:g,data:n,series:t,formatValue:K,formatX:I}),xValues:r.xValues,xPositions:i,xTicks:r.categoryTicks,yTicks:r.valueTicks,yScale:c,innerWidth:r.innerWidth,innerHeight:r.innerHeight,margin:r.margin,lines:se,forecastIndex:S,showMarkers:E==="always"||E==="auto"&&w>=xt&&n.length>1}},[Z,n,s,m,p,d,g,J,P,T,V,A,E,B,D,v,K,I]),O=R(t=>e.visible.map(r=>{let i=Ve(n[t],r.key);return{seriesKey:r.key,seriesLabel:Re(r),color:r.color,value:i,formattedValue:i===null?"\u2014":Q(i),datum:n[t]}}),[n,e.visible,Q]),ee=u?u.brush:ge,C=R(t=>{pe(t),u?.setBrush(t),q?.(t)},[u,q]),f=Oe({enabled:Y,active:ee!==null,centers:e.xPositions,xValues:e.xValues,offset:e.margin.left,orientation:"vertical",onCommit:C}),te=R(t=>{if(f.onPointerMove(t),H===!1||n.length===0)return;let r=t.currentTarget.getBoundingClientRect(),i=t.clientX-r.left-e.margin.left,c=Ee(e.xPositions,i);G(c>=0?c:null),u?.setHovered(c>=0?e.xValues[c]:null)},[f,H,n.length,e.margin.left,e.xPositions,e.xValues,u]),ne=R(()=>{G(null),u?.setHovered(null)},[u]),b=R((t,r)=>{if(!k)return;let i=O(t),c=i.filter(w=>w.value!==null),S=w=>r===null?0:Math.abs(e.yScale(w.value)-r.y),se=c.length>0?c.reduce((w,h)=>S(h)<S(w)?h:w):i[0];se&&k({...se,index:t,x:e.xValues[t]})},[k,O,e.yScale,e.xValues]),Ce=R(t=>{if(n.length===0)return;let r=k&&l!==null&&e.visible.length>0;if(mt(t,r?()=>b(l,null):null))return;let i=f.onKeyDown(t,l),c=dt(t.key,l,n.length,"x");if(c===void 0){i&&t.preventDefault();return}t.preventDefault(),G(c),u?.setHovered(c===null?null:e.xValues[c])},[n.length,l,f,u,e.xValues,e.visible.length,k,b]),re=R(t=>{if(f.consumedClick()||!k||n.length===0)return;let r=rt(t,e),i=l??(r===null?-1:Ee(e.xPositions,r.x));i<0||b(i,r)},[f,k,n.length,e,l,b]),oe=l!==null||u===null||u.hovered===null?null:(()=>{let t=ue(u.hovered),r=e.xValues.findIndex(i=>ue(i)===t);return r<0?null:r})(),L=l??oe,_=L===null?null:O(L),N=(_??[]).filter(t=>t.value!==null),ae=f.dragging??ee,a=ae?Ge(ae,e.xValues,e.xPositions,e.locate):null,M=ot(he),x=l===null||_===null?null:{x:e.xValues[l],xLabel:I(e.xValues[l],l),index:l,points:_};return W(wt,{children:[W("svg",{width:d,height:g,role:"img","aria-label":fe??[e.visible.map(t=>Re(t)).join(", "),Ke(v,ce)].filter(Boolean).join(". "),tabIndex:0,className:Ne(bt,"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500",Y&&"select-none"),onPointerDown:f.onPointerDown,onPointerMove:te,onPointerUp:f.onPointerUp,onPointerCancel:f.onPointerUp,onPointerLeave:ne,onKeyDown:Ce,onBlur:ne,onClick:re,children:[W("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[o($e,{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}),v?o(Se,{layer:"under",annotations:v,xAt:e.locate,spanAt:e.span,yAt:e.yScale,width:e.innerWidth,height:e.innerHeight}):null,a?o(Xe,{from:a.from,to:a.to,width:e.innerWidth,height:e.innerHeight,live:f.dragging!==null,label:de,minSpan:Ct}):null,M.under?.(e.plot),D?.map(t=>{let r=e.yScale(t.value),i=r<kt?r+12:r-4;return W("g",{children:[o("line",{x1:0,y1:r,x2:e.innerWidth,y2:r,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:i,textAnchor:"end",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:t.label}):null]},`${t.value}-${t.label??""}`)}),e.forecastIndex>=0?W("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"}),A?o("text",{x:e.xPositions[e.forecastIndex]+4,y:-2,className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:A}):null]}):null,o(Lt,{lines:e.lines,showMarkers:e.showMarkers}),v?o(Se,{annotations:v,xAt:e.locate,yAt:e.yScale,width:e.innerWidth,height:e.innerHeight}):null,M.over?.(e.plot),L!==null?W("g",{"aria-hidden":"true",children:[o("line",{x1:e.xPositions[L],y1:0,x2:e.xPositions[L],y2:e.innerHeight,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:1,strokeDasharray:l===null?"3 3":void 0}),N.map(t=>o("circle",{cx:e.xPositions[L],cy:e.yScale(t.value),r:4,fill:t.color,strokeWidth:2,stroke:Be},t.seriesKey))]}):null]}),o("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:m.hidden?null:o(we,{orientation:"bottom",ticks:e.xTicks,length:e.innerWidth,label:m.label,size:F})}),o("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:p?.hidden?null:o(we,{orientation:"left",ticks:e.yTicks,length:e.innerHeight,showLine:!1,label:p?.label,size:F})})]}),x&&H!==!1?o(Fe,{x:e.margin.left+e.xPositions[x.index],y:e.margin.top+(N.length>0?Math.min(...N.map(t=>e.yScale(t.value))):e.innerHeight/2),containerWidth:d,children:typeof H=="function"?H(x):o(Ye,{title:x.xLabel,points:x.points})}):null]})}function Jt({data:d,series:g,x:n,y:s,height:m=240,width:p,size:y="md",grid:F="y",legend:P,tooltip:V=!0,tableView:A=!1,emphasis:E,title:T,description:D,loading:v=!1,emptyState:ce,error:he=!1,errorState:B,onRetry:Y,actions:q,onPointClick:de,curve:me="monotone",forecastFrom:J,forecastLabel:H,markers:k="auto",connectNulls:fe=!1,referenceLines:K,annotations:Q,overlay:I,legendToggle:Z=!0,maxPoints:X,brush:G=!1,onBrush:l,brushLabel:ge,sync:pe=!0,margin:ye,locale:u,plotLabel:e,className:O,...ee}){let C=De(u),f=Me(),[te,ne]=ve(()=>new Set),b=z(()=>g.map((a,M)=>({...a,hidden:a.hidden||te.has(a.key),color:qe(a,M,E)})),[g,te,E]),Ce=z(()=>s?.format??(a=>ut(a,C)),[s?.format,C]),re=z(()=>s?.format??(a=>ct(a,C)),[s?.format,C]),oe=z(()=>n.format??(a=>n.scale==="time"?yt(a,C):ht(a,C)),[n.format,n.scale,C]),L=R(a=>{ne(M=>{let x=new Set(M);return x.has(a)?x.delete(a):x.add(a),x})},[]),_=P===void 0?g.length>=2:P!==!1,N=typeof P=="string"?P:"bottom",ae=b.filter(a=>!a.hidden).length;return o(_e,{title:T,description:D,height:m,width:p,size:y,loading:v,empty:d.length===0||ae===0,emptyState:ce,error:he,errorState:B,onRetry:Y,actions:q,exportSource:{data:d,series:b,xKey:n.key,xLabel:n.label??n.key,formatX:n.format},tableView:A,legendPosition:N,legend:_?o(Ue,{items:Je(b,E),position:N,marker:"line",size:y,onToggle:Z?L:void 0}):void 0,table:A?o(ze,{data:d,series:b,xKey:n.key,xLabel:n.label??n.key,formatX:oe,formatValue:re,caption:typeof T=="string"?T:void 0}):void 0,className:O,...ee,children:({width:a})=>o(St,{locale:C,width:a,height:m,data:d,resolvedSeries:b,x:n,y:s,grid:F,size:y,curve:me,forecastFrom:J,forecastLabel:H,markers:k,connectNulls:fe,referenceLines:K,annotations:Q,annotationsLabel:f.chartAnnotations,overlay:I,maxPoints:X,brush:G,onBrush:l,brushLabel:ge??f.chartBrush,syncEnabled:pe,margin:ye,tooltip:V,onPointClick:de,plotLabel:e,formatValue:Ce,formatExact:re,formatX:oe})})}export{Jt as LineChart,qt as resetLineChartWarnings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var L=Object.defineProperty;var
|
|
1
|
+
"use strict";"use client";var L=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var D=(t,r)=>{for(var o in r)L(t,o,{get:r[o],enumerable:!0})},G=(t,r,o,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of q(r))!z.call(t,i)&&i!==o&&L(t,i,{get:()=>r[i],enumerable:!(n=$(r,i))||n.enumerable});return t};var H=t=>G(L({},"__esModule",{value:!0}),t);var Z={};D(Z,{Pagination:()=>Y});module.exports=H(Z);var x=require("react"),d=require("../../lib/cn.cjs"),M=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime");function J(t,r,o,n){let i=(f,l)=>Array.from({length:Math.max(0,l-f+1)},(p,m)=>f+m);if(r<=n*2+o*2+3)return i(1,r);let b=Math.max(Math.min(t-o,r-n-o*2-1),n+2),v=Math.min(Math.max(t+o,n+o*2+2),r-n-1);return[...i(1,n),b>n+2?"ellipsis":n+1,...i(b,v),v<r-n-1?"ellipsis":r-n,...i(r-n+1,r)]}function K({className:t}){return(0,e.jsx)("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function Q({className:t}){return(0,e.jsx)("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}function S({className:t}){return(0,e.jsx)("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 19l-7-7 7-7M18 19l-7-7 7-7"})})}function T({className:t}){return(0,e.jsx)("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M6 5l7 7-7 7"})})}var V={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"}},X={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-synertech-primary-600 text-synertech-on-primary hover:bg-synertech-primary-700",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-synertech-primary-600 bg-synertech-primary-50 text-synertech-primary-600 hover:bg-synertech-primary-100 dark:border-synertech-primary-400 dark:bg-synertech-primary-900/30 dark:text-synertech-primary-400 dark:hover:bg-synertech-primary-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-synertech-primary-600 font-semibold hover:text-synertech-primary-700 dark:text-synertech-primary-400 dark:hover:text-synertech-primary-300",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"}};function Y({page:t,totalPages:r,onPageChange:o,size:n="md",variant:i="default",showFirstLast:b=!1,siblings:v=1,boundaries:f=1,disabled:l=!1,labels:p,totalItems:m,pageSize:y,pageSizeOptions:w,onPageSizeChange:R,className:j,...U}){let g=(0,M.useUILabels)(p),s=V[n],h=X[i],P=(0,x.useId)(),u=Math.max(0,Math.floor(r)||0),c=Math.min(Math.max(1,Math.floor(t)||1),Math.max(1,u)),F=(0,x.useMemo)(()=>J(c,u,v,f),[c,u,v,f]),k=(0,x.useCallback)(a=>{l||a<1||a>u||a===c||o(a)},[l,u,c,o]),I=c<=1,B=c>=u,W=(0,d.cn)("inline-flex items-center justify-center select-none",s.button,h.base),C=(a,N,A,_)=>(0,e.jsx)("button",{type:"button",onClick:a,disabled:l||N,"aria-label":A,"aria-disabled":l||N,className:(0,d.cn)(W,l||N?h.disabled:h.idle),children:_}),E=m!==void 0&&y?Math.min((c-1)*y+1,m):void 0,O=m!==void 0&&y?Math.min(c*y,m):void 0;return(0,e.jsxs)("nav",{"aria-label":g.paginationLabel,className:(0,d.cn)("flex items-center",s.gap,j),...U,children:[m!==void 0&&y&&(0,e.jsx)("span",{className:(0,d.cn)("mr-2 text-gray-600 dark:text-gray-400 whitespace-nowrap",s.text),children:(0,M.formatUILabel)(g.paginationRange,{start:E??0,end:O??0,total:m})}),w&&w.length>0&&R&&(0,e.jsxs)("div",{className:(0,d.cn)("mr-2 flex items-center whitespace-nowrap",s.gap,s.text),children:[(0,e.jsx)("label",{htmlFor:P,className:"text-gray-600 dark:text-gray-400",children:g.paginationRowsPerPage}),(0,e.jsx)("select",{id:P,value:y,onChange:a=>R(Number(a.target.value)),disabled:l,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",s.text,l&&"cursor-not-allowed opacity-50"),children:w.map(a=>(0,e.jsx)("option",{value:a,children:a},a))})]}),(0,e.jsxs)("div",{className:(0,d.cn)("flex items-center",s.gap),children:[b&&C(()=>k(1),I,p?.first??g.paginationFirst,(0,e.jsx)(S,{className:s.icon})),C(()=>k(c-1),I,p?.previous??g.paginationPrevious,(0,e.jsx)(K,{className:s.icon})),F.map((a,N)=>a==="ellipsis"?(0,e.jsx)("span",{className:(0,d.cn)("inline-flex items-center justify-center select-none",s.button,"text-gray-500 dark:text-gray-400"),"aria-hidden":"true",children:"\u2026"},`ellipsis-${N}`):(0,e.jsx)("button",{type:"button",onClick:()=>k(a),disabled:l,"aria-current":a===c?"page":void 0,"aria-label":(0,M.formatUILabel)(g.paginationPage,{page:a}),className:(0,d.cn)(W,a===c?h.active:l?h.disabled:h.idle),children:a},a)),C(()=>k(c+1),B,p?.next??g.paginationNext,(0,e.jsx)(Q,{className:s.icon})),b&&C(()=>k(u),B,p?.last??g.paginationLast,(0,e.jsx)(T,{className:s.icon}))]})]})}0&&(module.exports={Pagination});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useCallback as
|
|
1
|
+
"use client";import{useCallback as _,useId as $,useMemo as q}from"react";import{cn as c}from"../../lib/cn.js";import{formatUILabel as B,useUILabels as z}from"../../lib/i18n.js";import{jsx as t,jsxs as C}from"react/jsx-runtime";function D(a,s,l,r){let u=(v,i)=>Array.from({length:Math.max(0,i-v+1)},(p,d)=>v+d);if(s<=r*2+l*2+3)return u(1,s);let x=Math.max(Math.min(a-l,s-r-l*2-1),r+2),b=Math.min(Math.max(a+l,r+l*2+2),s-r-1);return[...u(1,r),x>r+2?"ellipsis":r+1,...u(x,b),b<s-r-1?"ellipsis":s-r,...u(s-r+1,s)]}function G({className:a}){return t("svg",{className:a,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:t("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function H({className:a}){return t("svg",{className:a,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:t("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}function J({className:a}){return t("svg",{className:a,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:t("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 19l-7-7 7-7M18 19l-7-7 7-7"})})}function K({className:a}){return t("svg",{className:a,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:t("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"}},S={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-synertech-primary-600 text-synertech-on-primary hover:bg-synertech-primary-700",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-synertech-primary-600 bg-synertech-primary-50 text-synertech-primary-600 hover:bg-synertech-primary-100 dark:border-synertech-primary-400 dark:bg-synertech-primary-900/30 dark:text-synertech-primary-400 dark:hover:bg-synertech-primary-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-synertech-primary-600 font-semibold hover:text-synertech-primary-700 dark:text-synertech-primary-400 dark:hover:text-synertech-primary-300",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"}};function Y({page:a,totalPages:s,onPageChange:l,size:r="md",variant:u="default",showFirstLast:x=!1,siblings:b=1,boundaries:v=1,disabled:i=!1,labels:p,totalItems:d,pageSize:y,pageSizeOptions:M,onPageSizeChange:w,className:W,...j}){let m=z(p),n=Q[r],h=S[u],L=$(),g=Math.max(0,Math.floor(s)||0),o=Math.min(Math.max(1,Math.floor(a)||1),Math.max(1,g)),U=q(()=>D(o,g,b,v),[o,g,b,v]),f=_(e=>{i||e<1||e>g||e===o||l(e)},[i,g,o,l]),R=o<=1,P=o>=g,I=c("inline-flex items-center justify-center select-none",n.button,h.base),N=(e,k,O,A)=>t("button",{type:"button",onClick:e,disabled:i||k,"aria-label":O,"aria-disabled":i||k,className:c(I,i||k?h.disabled:h.idle),children:A}),F=d!==void 0&&y?Math.min((o-1)*y+1,d):void 0,E=d!==void 0&&y?Math.min(o*y,d):void 0;return C("nav",{"aria-label":m.paginationLabel,className:c("flex items-center",n.gap,W),...j,children:[d!==void 0&&y&&t("span",{className:c("mr-2 text-gray-600 dark:text-gray-400 whitespace-nowrap",n.text),children:B(m.paginationRange,{start:F??0,end:E??0,total:d})}),M&&M.length>0&&w&&C("div",{className:c("mr-2 flex items-center whitespace-nowrap",n.gap,n.text),children:[t("label",{htmlFor:L,className:"text-gray-600 dark:text-gray-400",children:m.paginationRowsPerPage}),t("select",{id:L,value:y,onChange:e=>w(Number(e.target.value)),disabled:i,className:c("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",n.text,i&&"cursor-not-allowed opacity-50"),children:M.map(e=>t("option",{value:e,children:e},e))})]}),C("div",{className:c("flex items-center",n.gap),children:[x&&N(()=>f(1),R,p?.first??m.paginationFirst,t(J,{className:n.icon})),N(()=>f(o-1),R,p?.previous??m.paginationPrevious,t(G,{className:n.icon})),U.map((e,k)=>e==="ellipsis"?t("span",{className:c("inline-flex items-center justify-center select-none",n.button,"text-gray-500 dark:text-gray-400"),"aria-hidden":"true",children:"\u2026"},`ellipsis-${k}`):t("button",{type:"button",onClick:()=>f(e),disabled:i,"aria-current":e===o?"page":void 0,"aria-label":B(m.paginationPage,{page:e}),className:c(I,e===o?h.active:i?h.disabled:h.idle),children:e},e)),N(()=>f(o+1),P,p?.next??m.paginationNext,t(H,{className:n.icon})),x&&N(()=>f(g),P,p?.last??m.paginationLast,t(K,{className:n.icon}))]})]})}export{Y as Pagination};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var J=Object.defineProperty;var ve=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var ke=Object.prototype.hasOwnProperty;var Pe=(i,a)=>{for(var o in a)J(i,o,{get:a[o],enumerable:!0})},Re=(i,a,o,x)=>{if(a&&typeof a=="object"||typeof a=="function")for(let h of Ae(a))!ke.call(i,h)&&h!==o&&J(i,h,{get:()=>a[h],enumerable:!(x=ve(a,h))||x.enumerable});return i};var Le=i=>Re(J({},"__esModule",{value:!0}),i);var Oe={};Pe(Oe,{PieChart:()=>Te,resetPieWarnings:()=>Ve});module.exports=Le(Oe);var m=require("react"),K=require("../../lib/i18n.cjs"),se=require("../chart/ChartContainer.cjs"),ie=require("../chart/ChartLegend.cjs"),D=require("../chart/ChartPatterns.cjs"),ce=require("../chart/ChartTableView.cjs"),X=require("../chart/ChartTooltip.cjs"),A=require("../chart/palette.cjs"),T=require("../chart/utils/data.cjs"),P=require("../chart/utils/format.cjs"),ue=require("../chart/utils/keyboard.cjs"),de=require("../chart/utils/path.cjs"),me=require("../chart/utils/touch.cjs"),l=require("react/jsx-runtime"),Se=.62,Me=2,Ne=3,Ee=.16,_e=64,we=22,Q=6,Y=!1;function Ie({width:i,height:a,slices:o,variant:x,innerRadius:h,showLabels:R,centerLabel:v,tooltip:k,patterns:L,patternBaseId:V,plotLabel:H,formatValue:E,locale:O,onSliceClick:S}){let[M,g]=(0,m.useState)(null),b=M!==null&&M<o.length?M:null,$=(0,m.useMemo)(()=>{let t=R?_e:8,n=R?we:8,u=Math.max(0,Math.min((i-t*2)/2,(a-n*2)/2));return{cx:i/2,cy:a/2,outerRadius:u,inner:x==="donut"?u*(h??Se):(h??0)*u,pad:u>0&&o.length>1?Me/u/2:0}},[i,a,x,h,R,o.length]),{cx:p,cy:y,outerRadius:f,inner:W,pad:_}=$,z=(0,m.useCallback)(t=>{let n=(t.startAngle+t.endAngle)/2,u=Math.sin(n)>=0,C={x:p+Math.sin(n)*(f+4),y:y-Math.cos(n)*(f+4)},d={x:p+Math.sin(n)*(f+14),y:y-Math.cos(n)*(f+14)},I={x:u?d.x+10:d.x-10,y:d.y};return{from:C,elbow:d,end:I,anchor:u?"start":"end"}},[p,y,f]),w=(0,m.useCallback)(t=>{let n=o[t];n&&S?.({key:n.key,label:n.label,value:n.value,share:n.share})},[o,S]),G=(0,m.useCallback)(t=>(0,ue.handleChartKeyDown)(t,{count:o.length,current:b,axis:"both",onMove:g,pick:S&&b!==null?()=>w(b):null}),[o.length,b,S,w]),s=b===null?null:o[b];return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("svg",{width:i,height:a,role:"img","aria-label":H??o.map(t=>t.label).join(", "),tabIndex:0,className:`${me.CHART_TOUCH} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500`,onPointerLeave:()=>g(null),onBlur:()=>g(null),onKeyDown:G,children:[L?(0,l.jsx)(D.ChartPatternDefs,{id:V,entries:o.map(t=>({slot:t.slot,color:t.color}))}):null,o.map((t,n)=>(0,l.jsx)("path",{d:(0,de.buildArcPath)({cx:p,cy:y,innerRadius:W,outerRadius:f+(b===n?Ne:0),startAngle:t.startAngle+_,endAngle:Math.max(t.startAngle+_,t.endAngle-_)}),fill:(0,D.patternFill)(L,V,t.slot,t.color),onPointerEnter:()=>k===!1?void 0:g(n),onClick:()=>w(n)},t.key)),R?o.filter(t=>t.endAngle-t.startAngle>=Ee).map(t=>{let{from:n,elbow:u,end:C,anchor:d}=z(t);return(0,l.jsxs)("g",{"aria-hidden":"true",children:[(0,l.jsx)("polyline",{points:`${n.x},${n.y} ${u.x},${u.y} ${C.x},${C.y}`,fill:"none",className:"stroke-gray-300 dark:stroke-gray-600",strokeWidth:1}),(0,l.jsx)("text",{x:d==="start"?C.x+3:C.x-3,y:C.y,textAnchor:d,dominantBaseline:"middle",className:"fill-gray-600 text-[10px] dark:fill-gray-300",children:t.label})]},`label-${t.key}`)}):null,x==="donut"&&v?(0,l.jsxs)("g",{"aria-hidden":"true",children:[(0,l.jsx)("text",{x:p,y:y-(v.label?2:0),textAnchor:"middle",dominantBaseline:"middle",className:"fill-gray-900 text-lg font-semibold dark:fill-gray-100",children:v.value}),v.label?(0,l.jsx)("text",{x:p,y:y+14,textAnchor:"middle",dominantBaseline:"middle",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:v.label}):null]}):null]}),s&&k!==!1?(0,l.jsx)(X.ChartTooltip,{x:p+Math.sin((s.startAngle+s.endAngle)/2)*(f*.7),y:y-Math.cos((s.startAngle+s.endAngle)/2)*(f*.7),containerWidth:i,children:typeof k=="function"?k({seriesKey:s.key,seriesLabel:s.label,color:s.color,value:s.value,formattedValue:E(s.value),datum:{},share:s.share}):(0,l.jsx)(X.ChartTooltipContent,{title:s.label,points:[{seriesKey:s.key,seriesLabel:(0,P.formatPercent)(s.share,{locale:O}),color:s.color,value:s.value,formattedValue:E(s.value),datum:{}}]})}):null]})}function Te({data:i,x:a,value:o,valueLabel:x,variant:h="pie",innerRadius:R,maxSlices:v=Q,otherLabel:k,sort:L="desc",showLabels:V=!0,centerLabel:H,patterns:E=!1,height:O=260,width:S,size:M="md",legend:g,tooltip:b=!0,tableView:$=!1,title:p,description:y,loading:f=!1,emptyState:W,error:_=!1,errorState:z,onRetry:w,actions:G,locale:s,plotLabel:t,onSliceClick:n,className:u,...C}){let d=(0,K.useUILocale)(s),I=(0,K.useUILabels)(),he=(0,m.useId)(),ee=(0,m.useCallback)(c=>(0,P.formatAuto)(c,d),[d]),te=(0,m.useCallback)(c=>a.format?a.format(c,0):(0,P.formatXValue)(c,d),[a,d]),{slices:U,total:pe,rows:ae}=(0,m.useMemo)(()=>{let c=i.map((e,r)=>({key:String((0,T.readXValue)(e,a.key,r)),label:te((0,T.readXValue)(e,a.key,r)),value:(0,T.readNumber)(e,o)??0,index:r,datum:e})),B=L==="none"?c:[...c].sort((e,r)=>L==="asc"?e.value-r.value:r.value-e.value),F=Math.max(1,Math.floor(v)),re=B.length>F,Z=re?B.slice(0,F-1):B,le=re?B.slice(F-1):[],ge=new Set(Z.filter(e=>e.index<A.CHART_PALETTE_SIZE).map(e=>e.index)),be=Array.from({length:A.CHART_PALETTE_SIZE},(e,r)=>r).filter(e=>!ge.has(e)),ye=Z.filter(e=>e.index>=A.CHART_PALETTE_SIZE).sort((e,r)=>e.index-r.index),Ce=new Map(ye.map((e,r)=>[e.index,be[r]??e.index])),N=Z.map(e=>{let r=Ce.get(e.index)??e.index;return{...e,slot:r,color:(0,A.getSeriesColor)(r)}});le.length>0&&N.push({key:"__other__",label:k??I.chartOther,value:le.reduce((e,r)=>e+Math.max(0,r.value),0),index:-1,color:A.CHART_MUTED_COLOR,slot:-1,datum:{}}),N.length>Q&&!Y&&(Y=!0,console.warn(`[@synertech/ui] A PieChart is drawing ${N.length} slices. Past ${Q} the slices stop being tellable apart: lower \`maxSlices\`, or use a BarChart, which compares lengths rather than angles.`));let j=N.reduce((e,r)=>e+Math.max(0,r.value),0),q=0;return{slices:N.map(e=>{let r=j===0?0:Math.max(0,e.value)/j,xe=q;return q+=r*Math.PI*2,{...e,share:r,startAngle:xe,endAngle:q}}),total:j,rows:N.map(e=>({[a.key]:e.label,[o]:e.value}))}},[i,a.key,o,L,v,k,I.chartOther,te]),oe=[{key:o,label:x??I.chartValue}],fe=g===void 0?!0:g!==!1,ne=typeof g=="string"?g:"bottom";return(0,l.jsx)(se.ChartContainer,{title:p,description:y,height:O,width:S,size:M,loading:f,empty:U.length===0||pe===0,emptyState:W,error:_,errorState:z,onRetry:w,actions:G,exportSource:{data:ae,series:oe,xKey:a.key,xLabel:a.label??a.key},tableView:$,legendPosition:ne,legend:fe?(0,l.jsx)(ie.ChartLegend,{items:U.map(c=>({key:c.key,label:`${c.label} \xB7 ${(0,P.formatPercent)(c.share,{locale:d})}`,color:c.color,...E?{pattern:c.slot}:{}})),position:ne,marker:"rect",size:M}):void 0,table:$?(0,l.jsx)(ce.ChartTableView,{data:ae,series:oe,xKey:a.key,xLabel:a.label??a.key,formatValue:ee,caption:typeof p=="string"?p:void 0}):void 0,className:u,...C,children:({width:c})=>(0,l.jsx)(Ie,{width:c,height:O,slices:U,variant:h,innerRadius:R,showLabels:V,centerLabel:H,tooltip:b,patterns:E,patternBaseId:he,plotLabel:t,formatValue:ee,locale:d,onSliceClick:n})})}function Ve(){Y=!1}0&&(module.exports={PieChart,resetPieWarnings});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useCallback as
|
|
1
|
+
"use client";import{useCallback as _,useId as he,useMemo as oe,useState as pe}from"react";import{useUILabels as fe,useUILocale as ge}from"../../lib/i18n.js";import{ChartContainer as be}from"../chart/ChartContainer.js";import{ChartLegend as ye}from"../chart/ChartLegend.js";import{ChartPatternDefs as Ce,patternFill as xe}from"../chart/ChartPatterns.js";import{ChartTableView as ve}from"../chart/ChartTableView.js";import{ChartTooltip as Ae,ChartTooltipContent as ke}from"../chart/ChartTooltip.js";import{CHART_MUTED_COLOR as Pe,CHART_PALETTE_SIZE as U,getSeriesColor as Re}from"../chart/palette.js";import{readNumber as Le,readXValue as ae}from"../chart/utils/data.js";import{formatAuto as Se,formatPercent as ne,formatXValue as Me}from"../chart/utils/format.js";import{handleChartKeyDown as Ne}from"../chart/utils/keyboard.js";import{buildArcPath as Ee}from"../chart/utils/path.js";import{CHART_TOUCH as _e}from"../chart/utils/touch.js";import{Fragment as Ke,jsx as u,jsxs as O}from"react/jsx-runtime";var we=.62,Ie=2,Te=3,Ve=.16,Oe=64,$e=22,F=6,Z=!1;function Be({width:b,height:r,slices:l,variant:R,innerRadius:L,showLabels:x,centerLabel:y,tooltip:C,patterns:v,patternBaseId:w,plotLabel:$,formatValue:S,locale:I,onSliceClick:A}){let[k,h]=pe(null),p=k!==null&&k<l.length?k:null,T=oe(()=>{let t=x?Oe:8,a=x?$e:8,i=Math.max(0,Math.min((b-t*2)/2,(r-a*2)/2));return{cx:b/2,cy:r/2,outerRadius:i,inner:R==="donut"?i*(L??we):(L??0)*i,pad:i>0&&l.length>1?Ie/i/2:0}},[b,r,R,L,x,l.length]),{cx:d,cy:f,outerRadius:m,inner:B,pad:M}=T,K=_(t=>{let a=(t.startAngle+t.endAngle)/2,i=Math.sin(a)>=0,g={x:d+Math.sin(a)*(m+4),y:f-Math.cos(a)*(m+4)},c={x:d+Math.sin(a)*(m+14),y:f-Math.cos(a)*(m+14)},E={x:i?c.x+10:c.x-10,y:c.y};return{from:g,elbow:c,end:E,anchor:i?"start":"end"}},[d,f,m]),N=_(t=>{let a=l[t];a&&A?.({key:a.key,label:a.label,value:a.value,share:a.share})},[l,A]),D=_(t=>Ne(t,{count:l.length,current:p,axis:"both",onMove:h,pick:A&&p!==null?()=>N(p):null}),[l.length,p,A,N]),n=p===null?null:l[p];return O(Ke,{children:[O("svg",{width:b,height:r,role:"img","aria-label":$??l.map(t=>t.label).join(", "),tabIndex:0,className:`${_e} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500`,onPointerLeave:()=>h(null),onBlur:()=>h(null),onKeyDown:D,children:[v?u(Ce,{id:w,entries:l.map(t=>({slot:t.slot,color:t.color}))}):null,l.map((t,a)=>u("path",{d:Ee({cx:d,cy:f,innerRadius:B,outerRadius:m+(p===a?Te:0),startAngle:t.startAngle+M,endAngle:Math.max(t.startAngle+M,t.endAngle-M)}),fill:xe(v,w,t.slot,t.color),onPointerEnter:()=>C===!1?void 0:h(a),onClick:()=>N(a)},t.key)),x?l.filter(t=>t.endAngle-t.startAngle>=Ve).map(t=>{let{from:a,elbow:i,end:g,anchor:c}=K(t);return O("g",{"aria-hidden":"true",children:[u("polyline",{points:`${a.x},${a.y} ${i.x},${i.y} ${g.x},${g.y}`,fill:"none",className:"stroke-gray-300 dark:stroke-gray-600",strokeWidth:1}),u("text",{x:c==="start"?g.x+3:g.x-3,y:g.y,textAnchor:c,dominantBaseline:"middle",className:"fill-gray-600 text-[10px] dark:fill-gray-300",children:t.label})]},`label-${t.key}`)}):null,R==="donut"&&y?O("g",{"aria-hidden":"true",children:[u("text",{x:d,y:f-(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:f+14,textAnchor:"middle",dominantBaseline:"middle",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:y.label}):null]}):null]}),n&&C!==!1?u(Ae,{x:d+Math.sin((n.startAngle+n.endAngle)/2)*(m*.7),y:f-Math.cos((n.startAngle+n.endAngle)/2)*(m*.7),containerWidth:b,children:typeof C=="function"?C({seriesKey:n.key,seriesLabel:n.label,color:n.color,value:n.value,formattedValue:S(n.value),datum:{},share:n.share}):u(ke,{title:n.label,points:[{seriesKey:n.key,seriesLabel:ne(n.share,{locale:I}),color:n.color,value:n.value,formattedValue:S(n.value),datum:{}}]})}):null]})}function et({data:b,x:r,value:l,valueLabel:R,variant:L="pie",innerRadius:x,maxSlices:y=F,otherLabel:C,sort:v="desc",showLabels:w=!0,centerLabel:$,patterns:S=!1,height:I=260,width:A,size:k="md",legend:h,tooltip:p=!0,tableView:T=!1,title:d,description:f,loading:m=!1,emptyState:B,error:M=!1,errorState:K,onRetry:N,actions:D,locale:n,plotLabel:t,onSliceClick:a,className:i,...g}){let c=ge(n),E=fe(),re=he(),j=_(s=>Se(s,c),[c]),q=_(s=>r.format?r.format(s,0):Me(s,c),[r,c]),{slices:X,total:le,rows:J}=oe(()=>{let s=b.map((e,o)=>({key:String(ae(e,r.key,o)),label:q(ae(e,r.key,o)),value:Le(e,l)??0,index:o,datum:e})),V=v==="none"?s:[...s].sort((e,o)=>v==="asc"?e.value-o.value:o.value-e.value),H=Math.max(1,Math.floor(y)),ee=V.length>H,W=ee?V.slice(0,H-1):V,te=ee?V.slice(H-1):[],ie=new Set(W.filter(e=>e.index<U).map(e=>e.index)),ce=Array.from({length:U},(e,o)=>o).filter(e=>!ie.has(e)),ue=W.filter(e=>e.index>=U).sort((e,o)=>e.index-o.index),de=new Map(ue.map((e,o)=>[e.index,ce[o]??e.index])),P=W.map(e=>{let o=de.get(e.index)??e.index;return{...e,slot:o,color:Re(o)}});te.length>0&&P.push({key:"__other__",label:C??E.chartOther,value:te.reduce((e,o)=>e+Math.max(0,o.value),0),index:-1,color:Pe,slot:-1,datum:{}}),P.length>F&&!Z&&(Z=!0,console.warn(`[@synertech/ui] A PieChart is drawing ${P.length} slices. Past ${F} the slices stop being tellable apart: lower \`maxSlices\`, or use a BarChart, which compares lengths rather than angles.`));let z=P.reduce((e,o)=>e+Math.max(0,o.value),0),G=0;return{slices:P.map(e=>{let o=z===0?0:Math.max(0,e.value)/z,me=G;return G+=o*Math.PI*2,{...e,share:o,startAngle:me,endAngle:G}}),total:z,rows:P.map(e=>({[r.key]:e.label,[l]:e.value}))}},[b,r.key,l,v,y,C,E.chartOther,q]),Q=[{key:l,label:R??E.chartValue}],se=h===void 0?!0:h!==!1,Y=typeof h=="string"?h:"bottom";return u(be,{title:d,description:f,height:I,width:A,size:k,loading:m,empty:X.length===0||le===0,emptyState:B,error:M,errorState:K,onRetry:N,actions:D,exportSource:{data:J,series:Q,xKey:r.key,xLabel:r.label??r.key},tableView:T,legendPosition:Y,legend:se?u(ye,{items:X.map(s=>({key:s.key,label:`${s.label} \xB7 ${ne(s.share,{locale:c})}`,color:s.color,...S?{pattern:s.slot}:{}})),position:Y,marker:"rect",size:k}):void 0,table:T?u(ve,{data:J,series:Q,xKey:r.key,xLabel:r.label??r.key,formatValue:j,caption:typeof d=="string"?d:void 0}):void 0,className:i,...g,children:({width:s})=>u(Be,{width:s,height:I,slices:X,variant:L,innerRadius:x,showLabels:w,centerLabel:$,tooltip:p,patterns:S,patternBaseId:re,plotLabel:t,formatValue:j,locale:c,onSliceClick:a})})}function tt(){Z=!1}export{et as PieChart,tt as resetPieWarnings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";"use client";var c=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var V=(t,o)=>{for(var r in o)c(t,r,{get:o[r],enumerable:!0})},h=(t,o,r,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of E(o))!M.call(t,n)&&n!==r&&c(t,n,{get:()=>o[n],enumerable:!(l=I(o,n))||l.enumerable});return t};var w=t=>h(c({},"__esModule",{value:!0}),t);var N={};V(N,{Popover:()=>b,usePopoverContext:()=>y});module.exports=w(N);var e=require("react"),P=require("react/jsx-runtime"),v=(0,e.createContext)(null);function y(t){let o=(0,e.useContext)(v);if(!o)throw new Error(`${t} must be used within <Popover>`);return o}function b({open:t,defaultOpen:o=!1,onOpenChange:r,closeOnEscape:l=!0,closeOnClickOutside:n=!0,children:g}){let[C,x]=(0,e.useState)(o),u=t!==void 0,s=u?t:C,[p,O]=(0,e.useState)(!1);(0,e.useEffect)(()=>O(!0),[]);let m=(0,e.useRef)(null),i=(0,e.useId)(),d=(0,e.useId)(),f=(0,e.useCallback)(a=>{a!==s&&(u||x(a),r?.(a))},[s,u,r]),R=(0,e.useMemo)(()=>({open:s,setOpen:f,triggerRef:m,triggerId:i,contentId:d,closeOnEscape:l,closeOnClickOutside:n,mounted:p}),[s,f,i,d,l,n,p]);return(0,P.jsx)(v.Provider,{value:R,children:g})}b.displayName="Popover";0&&(module.exports={Popover,usePopoverContext});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{createContext as m,useCallback as R,useContext as I,useEffect as E,useId as d,useMemo as M,useRef as V,useState as f}from"react";import{jsx as w}from"react/jsx-runtime";var v=m(null);function N(e){let o=I(v);if(!o)throw new Error(`${e} must be used within <Popover>`);return o}function h({open:e,defaultOpen:o=!1,onOpenChange:l,closeOnEscape:s=!0,closeOnClickOutside:u=!0,children:b}){let[P,g]=f(o),n=e!==void 0,t=n?e:P,[a,C]=f(!1);E(()=>C(!0),[]);let x=V(null),c=d(),p=d(),i=R(r=>{r!==t&&(n||g(r),l?.(r))},[t,n,l]),O=M(()=>({open:t,setOpen:i,triggerRef:x,triggerId:c,contentId:p,closeOnEscape:s,closeOnClickOutside:u,mounted:a}),[t,i,c,p,s,u,a]);return w(v.Provider,{value:O,children:b})}h.displayName="Popover";export{h as Popover,N as usePopoverContext};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";"use client";var c=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var x=(t,e)=>{for(var n in e)c(t,n,{get:e[n],enumerable:!0})},h=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of k(e))!M.call(t,o)&&o!==n&&c(t,o,{get:()=>e[o],enumerable:!(r=E(e,o))||r.enumerable});return t};var L=t=>h(c({},"__esModule",{value:!0}),t);var R={};x(R,{PopoverClose:()=>v});module.exports=L(R);var l=require("react"),p=require("./Popover.cjs"),m=require("../../lib/i18n.cjs"),f=require("../../lib/cn.cjs"),i=require("react/jsx-runtime"),P=(0,i.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})});function v({asChild:t=!1,children:e,className:n,onClick:r,...o}){let{setOpen:y,triggerRef:g}=(0,p.usePopoverContext)("PopoverClose"),b=(0,m.useUILabels)(),d=()=>{y(!1),g.current?.focus()};if(t&&(0,l.isValidElement)(e)){let s=e,C=s.props.onClick;return(0,l.cloneElement)(s,{...o,onClick:u=>{C?.(u),r?.(u),u.defaultPrevented||d()}})}let a=e==null;return(0,i.jsx)("button",{type:"button",...o,"aria-label":o["aria-label"]??(a?b.popoverClose:void 0),onClick:s=>{r?.(s),s.defaultPrevented||d()},className:(0,f.cn)("inline-flex cursor-pointer items-center justify-center rounded-md transition-colors","text-gray-500 hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-gray-200","focus:outline-none focus-visible:ring-2 focus-visible:ring-synertech-primary-500",a?"h-8 w-8":"px-3 py-1.5 text-sm font-medium",n),children:a?P:e})}v.displayName="PopoverClose";0&&(module.exports={PopoverClose});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{cloneElement as f,isValidElement as v}from"react";import{usePopoverContext as y}from"./Popover.js";import{useUILabels as g}from"../../lib/i18n.js";import{cn as b}from"../../lib/cn.js";import{jsx as s}from"react/jsx-runtime";var C=s("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})});function E({asChild:a=!1,children:e,className:u,onClick:i,...o}){let{setOpen:c,triggerRef:d}=y("PopoverClose"),p=g(),l=()=>{c(!1),d.current?.focus()};if(a&&v(e)){let t=e,m=t.props.onClick;return f(t,{...o,onClick:r=>{m?.(r),i?.(r),r.defaultPrevented||l()}})}let n=e==null;return s("button",{type:"button",...o,"aria-label":o["aria-label"]??(n?p.popoverClose:void 0),onClick:t=>{i?.(t),t.defaultPrevented||l()},className:b("inline-flex cursor-pointer items-center justify-center rounded-md transition-colors","text-gray-500 hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-gray-200","focus:outline-none focus-visible:ring-2 focus-visible:ring-synertech-primary-500",n?"h-8 w-8":"px-3 py-1.5 text-sm font-medium",u),children:n?C:e})}E.displayName="PopoverClose";export{E as PopoverClose};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";"use client";var R=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var X=(t,n)=>{for(var i in n)R(t,i,{get:n[i],enumerable:!0})},Y=(t,n,i,d)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of U(n))!V.call(t,r)&&r!==i&&R(t,r,{get:()=>n[r],enumerable:!(d=Q(n,r))||d.enumerable});return t};var Z=t=>Y(R({},"__esModule",{value:!0}),t);var j={};X(j,{PopoverContent:()=>k});module.exports=Z(j);var y=require("react"),T=require("react-dom"),L=require("./Popover.cjs"),H=require("../dropdown/hooks/usePositioning.cjs"),b=require("../dropdown/hooks/useLatest.cjs"),E=require("../../lib/aria-hide.cjs"),c=require("../../lib/focus.cjs"),O=require("../../lib/owner-document.cjs"),S=require("../../lib/cn.cjs"),h=require("react/jsx-runtime");function k(t){let{open:n,mounted:i,triggerRef:d}=(0,L.usePopoverContext)("PopoverContent"),r=d.current;return!n||!i||!r?null:(0,T.createPortal)((0,h.jsx)($,{...t}),(0,O.ownerDocumentOf)(r).body)}k.displayName="PopoverContent";function _(t,n){let i=(0,c.getFocusableElements)(t.ownerDocument.body),d=i.indexOf(t);if(d===-1)return null;for(let r of i.slice(d+1))if(!(n.contains(r)||(0,c.isSameTabStop)(r,t)))return(0,c.getTabStopEntry)(r,"forward");return null}function $({side:t="bottom",align:n="center",sideOffset:i=8,alignOffset:d=0,avoidCollisions:r=!0,collisionPadding:K=8,initialFocus:M,className:N,style:F,children:I,onKeyDown:z,...v}){let{setOpen:P,triggerRef:s,triggerId:A,contentId:W,closeOnEscape:q,closeOnClickOutside:B}=(0,L.usePopoverContext)("PopoverContent"),f=(0,y.useRef)(null),p=(0,H.usePositioning)({triggerRef:s,contentRef:f,isOpen:!0,side:t,align:n,sideOffset:i,alignOffset:d,avoidCollisions:r,collisionPadding:K}),w=(0,b.useLatest)(P),x=(0,b.useLatest)(q),C=(0,b.useLatest)(B),D=(0,b.useLatest)(M);(0,y.useEffect)(()=>{let e=f.current;if(e)return(0,E.registerFloatingLayer)(e,()=>s.current)},[s]),(0,y.useEffect)(()=>{let e=(0,O.ownerDocumentOf)(s.current),a=o=>{let u=f.current;return u?u.contains(o)||s.current?.contains(o)?!0:(0,E.findOwnedLayers)([u]).some(m=>m.contains(o)):!1},l=o=>{if(!C.current)return;let u=o.target;u&&a(u)||w.current(!1)},g=o=>{if(o.key!=="Escape"||o.defaultPrevented||!x.current)return;let u=f.current,m=o.target;m&&m!==e.body&&!u?.contains(m)&&!s.current?.contains(m)||(o.preventDefault(),w.current(!1),s.current?.focus())};return e.addEventListener("pointerdown",l),e.addEventListener("keydown",g),()=>{e.removeEventListener("pointerdown",l),e.removeEventListener("keydown",g)}},[s,w,x,C]),(0,y.useEffect)(()=>{if(!p.isReady)return;let e=f.current;if(!e||e.contains(e.ownerDocument.activeElement))return;let a=D.current?.(e);if(a&&e.contains(a)){a.focus({preventScroll:!0});return}let l=(0,c.getFocusableElements)(e)[0];(l?(0,c.getTabStopEntry)(l,"forward"):e).focus({preventScroll:!0})},[p.isReady,D]),(0,y.useLayoutEffect)(()=>{let e=f.current;return()=>{e?.contains(e.ownerDocument.activeElement)&&s.current?.focus({preventScroll:!0})}},[s]);let G=e=>{if(z?.(e),e.defaultPrevented||e.key!=="Tab")return;let a=f.current,l=s.current,g=e.target;if(!a||!l||!a.contains(g))return;let o=(0,c.getFocusableElements)(a),u=o[0]??null,m=o[o.length-1]??null;if(e.shiftKey){(g===a||(0,c.isSameTabStop)(g,u))&&(e.preventDefault(),P(!1),l.focus());return}(o.length===0||(0,c.isSameTabStop)(g,m))&&(e.preventDefault(),P(!1),(_(l,a)??l).focus())},J=v["aria-label"]!==void 0||v["aria-labelledby"]!==void 0;return(0,h.jsx)("div",{...v,ref:f,id:W,role:"dialog","aria-labelledby":J?v["aria-labelledby"]:A,tabIndex:-1,onKeyDown:G,style:{...F,position:"fixed",top:p.top,left:p.left,maxHeight:p.availableHeight,visibility:p.isReady?"visible":"hidden"},"data-side":p.actualSide,className:(0,S.cn)("z-50 max-w-[calc(100vw-1rem)] overflow-auto rounded-lg p-4 outline-none","border border-gray-200 bg-white text-sm text-gray-900 shadow-lg","dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100",p.isReady&&"animate-in fade-in-0 zoom-in-95",N),children:I})}0&&(module.exports={PopoverContent});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useEffect as E,useLayoutEffect as q,useRef as B}from"react";import{createPortal as G}from"react-dom";import{usePopoverContext as h}from"./Popover.js";import{usePositioning as J}from"../dropdown/hooks/usePositioning.js";import{useLatest as g}from"../dropdown/hooks/useLatest.js";import{findOwnedLayers as Q,registerFloatingLayer as U}from"../../lib/aria-hide.js";import{getFocusableElements as P,getTabStopEntry as x,isSameTabStop as w}from"../../lib/focus.js";import{ownerDocumentOf as C}from"../../lib/owner-document.js";import{cn as V}from"../../lib/cn.js";import{jsx as D}from"react/jsx-runtime";function X(u){let{open:m,mounted:f,triggerRef:p}=h("PopoverContent"),s=p.current;return!m||!f||!s?null:G(D(Z,{...u}),C(s).body)}X.displayName="PopoverContent";function Y(u,m){let f=P(u.ownerDocument.body),p=f.indexOf(u);if(p===-1)return null;for(let s of f.slice(p+1))if(!(m.contains(s)||w(s,u)))return x(s,"forward");return null}function Z({side:u="bottom",align:m="center",sideOffset:f=8,alignOffset:p=0,avoidCollisions:s=!0,collisionPadding:T=8,initialFocus:H,className:S,style:k,children:K,onKeyDown:M,...y}){let{setOpen:b,triggerRef:n,triggerId:N,contentId:F,closeOnEscape:I,closeOnClickOutside:z}=h("PopoverContent"),a=B(null),c=J({triggerRef:n,contentRef:a,isOpen:!0,side:u,align:m,sideOffset:f,alignOffset:p,avoidCollisions:s,collisionPadding:T}),v=g(b),R=g(I),L=g(z),O=g(H);E(()=>{let e=a.current;if(e)return U(e,()=>n.current)},[n]),E(()=>{let e=C(n.current),o=t=>{let i=a.current;return i?i.contains(t)||n.current?.contains(t)?!0:Q([i]).some(l=>l.contains(t)):!1},r=t=>{if(!L.current)return;let i=t.target;i&&o(i)||v.current(!1)},d=t=>{if(t.key!=="Escape"||t.defaultPrevented||!R.current)return;let i=a.current,l=t.target;l&&l!==e.body&&!i?.contains(l)&&!n.current?.contains(l)||(t.preventDefault(),v.current(!1),n.current?.focus())};return e.addEventListener("pointerdown",r),e.addEventListener("keydown",d),()=>{e.removeEventListener("pointerdown",r),e.removeEventListener("keydown",d)}},[n,v,R,L]),E(()=>{if(!c.isReady)return;let e=a.current;if(!e||e.contains(e.ownerDocument.activeElement))return;let o=O.current?.(e);if(o&&e.contains(o)){o.focus({preventScroll:!0});return}let r=P(e)[0];(r?x(r,"forward"):e).focus({preventScroll:!0})},[c.isReady,O]),q(()=>{let e=a.current;return()=>{e?.contains(e.ownerDocument.activeElement)&&n.current?.focus({preventScroll:!0})}},[n]);let A=e=>{if(M?.(e),e.defaultPrevented||e.key!=="Tab")return;let o=a.current,r=n.current,d=e.target;if(!o||!r||!o.contains(d))return;let t=P(o),i=t[0]??null,l=t[t.length-1]??null;if(e.shiftKey){(d===o||w(d,i))&&(e.preventDefault(),b(!1),r.focus());return}(t.length===0||w(d,l))&&(e.preventDefault(),b(!1),(Y(r,o)??r).focus())},W=y["aria-label"]!==void 0||y["aria-labelledby"]!==void 0;return D("div",{...y,ref:a,id:F,role:"dialog","aria-labelledby":W?y["aria-labelledby"]:N,tabIndex:-1,onKeyDown:A,style:{...k,position:"fixed",top:c.top,left:c.left,maxHeight:c.availableHeight,visibility:c.isReady?"visible":"hidden"},"data-side":c.actualSide,className:V("z-50 max-w-[calc(100vw-1rem)] overflow-auto rounded-lg p-4 outline-none","border border-gray-200 bg-white text-sm text-gray-900 shadow-lg","dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100",c.isReady&&"animate-in fade-in-0 zoom-in-95",S),children:K})}export{X as PopoverContent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";"use client";var g=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var L=(t,e)=>{for(var o in e)g(t,o,{get:e[o],enumerable:!0})},N=(t,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of C(e))!H.call(t,r)&&r!==o&&g(t,r,{get:()=>e[r],enumerable:!(s=x(e,r))||s.enumerable});return t};var B=t=>N(g({},"__esModule",{value:!0}),t);var w={};L(w,{PopoverTrigger:()=>M});module.exports=B(w);var i=require("react"),T=require("./Popover.cjs"),p=require("../../lib/cn.cjs"),l=require("../../lib/refs.cjs"),P=require("react/jsx-runtime");function M({asChild:t=!1,disabled:e=!1,children:o,className:s,onClick:r,...u}){let{open:d,setOpen:R,triggerRef:f,triggerId:h,contentId:k}=(0,T.usePopoverContext)("PopoverTrigger"),n=t&&(0,i.isValidElement)(o)?o:null,m=e||!!n?.props.disabled,b=n?(0,l.getElementRef)(n):void 0,y=(0,i.useMemo)(()=>(0,l.mergeRefs)(f,b),[f,b]),v=()=>{m||R(!d)},E={id:h,"aria-haspopup":"dialog","aria-expanded":d,"aria-controls":d?k:void 0,disabled:m};if(n){let{onClick:a}=n.props;return(0,i.cloneElement)(n,{...u,...E,ref:y,onClick:c=>{a?.(c),r?.(c),c.defaultPrevented||v()},className:(0,p.cn)(n.props.className,s)})}return(0,P.jsx)("button",{type:"button",...u,...E,ref:y,onClick:a=>{r?.(a),a.defaultPrevented||v()},className:(0,p.cn)("inline-flex cursor-pointer items-center justify-center gap-2 rounded-md px-4 py-2","border border-gray-300 bg-white text-sm font-medium text-gray-700","hover:bg-gray-50 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2 focus-visible:ring-synertech-primary-500 focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","transition-colors",s),children:o})}M.displayName="PopoverTrigger";0&&(module.exports={PopoverTrigger});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{cloneElement as T,isValidElement as M,useMemo as P}from"react";import{usePopoverContext as R}from"./Popover.js";import{cn as f}from"../../lib/cn.js";import{getElementRef as h,mergeRefs as k}from"../../lib/refs.js";import{jsx as C}from"react/jsx-runtime";function x({asChild:m=!1,disabled:b=!1,children:o,className:i,onClick:s,...a}){let{open:r,setOpen:y,triggerRef:l,triggerId:v,contentId:E}=R("PopoverTrigger"),e=m&&M(o)?o:null,d=b||!!e?.props.disabled,c=e?h(e):void 0,g=P(()=>k(l,c),[l,c]),p=()=>{d||y(!r)},u={id:v,"aria-haspopup":"dialog","aria-expanded":r,"aria-controls":r?E:void 0,disabled:d};if(e){let{onClick:t}=e.props;return T(e,{...a,...u,ref:g,onClick:n=>{t?.(n),s?.(n),n.defaultPrevented||p()},className:f(e.props.className,i)})}return C("button",{type:"button",...a,...u,ref:g,onClick:t=>{s?.(t),t.defaultPrevented||p()},className:f("inline-flex cursor-pointer items-center justify-center gap-2 rounded-md px-4 py-2","border border-gray-300 bg-white text-sm font-medium text-gray-700","hover:bg-gray-50 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2 focus-visible:ring-synertech-primary-500 focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","transition-colors",i),children:o})}x.displayName="PopoverTrigger";export{x as PopoverTrigger};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var n=Object.prototype.hasOwnProperty;var C=(r,o)=>{for(var p in o)t(r,p,{get:o[p],enumerable:!0})},y=(r,o,p,P)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of g(o))!n.call(r,e)&&e!==p&&t(r,e,{get:()=>o[e],enumerable:!(P=s(o,e))||P.enumerable});return r};var i=r=>y(t({},"__esModule",{value:!0}),r);var l={};C(l,{Popover:()=>v.Popover,PopoverClose:()=>x.PopoverClose,PopoverContent:()=>m.PopoverContent,PopoverTrigger:()=>f.PopoverTrigger});module.exports=i(l);var v=require("./Popover.cjs"),f=require("./PopoverTrigger.cjs"),m=require("./PopoverContent.cjs"),x=require("./PopoverClose.cjs");0&&(module.exports={Popover,PopoverClose,PopoverContent,PopoverTrigger});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Popover as e}from"./Popover.js";import{PopoverTrigger as t}from"./PopoverTrigger.js";import{PopoverContent as v}from"./PopoverContent.js";import{PopoverClose as m}from"./PopoverClose.js";export{e as Popover,m as PopoverClose,v as PopoverContent,t as PopoverTrigger};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var d=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var R=(e,r)=>{for(var s in r)d(e,s,{get:r[s],enumerable:!0})},_=(e,r,s,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of N(r))!z.call(e,a)&&a!==s&&d(e,a,{get:()=>r[a],enumerable:!(o=B(r,a))||o.enumerable});return e};var V=e=>_(d({},"__esModule",{value:!0}),e);var $={};R($,{ProgressBar:()=>b});module.exports=V($);var
|
|
1
|
+
"use strict";var d=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var R=(e,r)=>{for(var s in r)d(e,s,{get:r[s],enumerable:!0})},_=(e,r,s,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of N(r))!z.call(e,a)&&a!==s&&d(e,a,{get:()=>r[a],enumerable:!(o=B(r,a))||o.enumerable});return e};var V=e=>_(d({},"__esModule",{value:!0}),e);var $={};R($,{ProgressBar:()=>b});module.exports=V($);var i=require("../../lib/cn.cjs"),t=require("react/jsx-runtime"),M={xs:"h-1",sm:"h-1.5",md:"h-2.5",lg:"h-4",xl:"h-6"},S={default:"bg-gray-500 dark:bg-gray-400",primary:"bg-synertech-primary-600 dark:bg-synertech-primary-500",success:"bg-green-600 dark:bg-green-500",warning:"bg-yellow-500 dark:bg-yellow-400",error:"bg-red-600 dark:bg-red-500",info:"bg-cyan-600 dark:bg-cyan-500"},O={default:"text-gray-700 dark:text-gray-300",primary:"text-synertech-primary-600 dark:text-synertech-primary-400",success:"text-green-700 dark:text-green-400",warning:"text-yellow-700 dark:text-yellow-400",error:"text-red-600 dark:text-red-400",info:"text-cyan-700 dark:text-cyan-400"},p="bg-[repeating-linear-gradient(45deg,transparent,transparent_10px,rgba(255,255,255,0.2)_10px,rgba(255,255,255,0.2)_20px)]",W={default:"bg-gradient-to-r from-gray-400 to-gray-600",primary:"bg-gradient-to-r from-synertech-primary-400 to-synertech-primary-700",success:"bg-gradient-to-r from-green-400 to-green-700",warning:"bg-gradient-to-r from-yellow-300 to-yellow-600",error:"bg-gradient-to-r from-red-400 to-red-700",info:"bg-gradient-to-r from-cyan-400 to-cyan-700"};function b({value:e=0,indeterminate:r=!1,size:s="md",color:o="primary",variant:a="default",progressColor:u,trackColor:f,showValue:g=!1,valueFormat:m,label:n,animated:x=!0,className:h,"aria-label":v,"aria-labelledby":y,"aria-describedby":w,"aria-valuetext":P,...C}){let l=Number.isFinite(e)?Math.min(100,Math.max(0,e)):0,c=u||(a==="gradient"?W[o]:S[o]),k=m?m(l):`${Math.round(l)}%`;return(0,t.jsxs)("div",{className:(0,i.cn)("w-full",h),...C,children:[(n||g)&&(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[n&&(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:n}),g&&!r&&(0,t.jsx)("span",{className:(0,i.cn)("text-sm font-semibold",O[o],!n&&"ml-auto"),children:k})]}),(0,t.jsx)("div",{role:"progressbar","aria-valuenow":r?void 0:l,"aria-valuemin":0,"aria-valuemax":100,"aria-valuetext":P,"aria-label":v??(y?void 0:n),"aria-labelledby":y,"aria-describedby":w,className:(0,i.cn)("relative w-full overflow-hidden rounded-full",f||"bg-gray-200 dark:bg-gray-700",M[s]),children:r?(0,t.jsx)("div",{className:(0,i.cn)("absolute h-full w-1/3 rounded-full",c,a==="striped"&&p,"animate-[progress-indeterminate_1.5s_ease-in-out_infinite]")}):(0,t.jsx)("div",{className:(0,i.cn)("h-full rounded-full",c,a==="striped"&&p,x&&"transition-[width] duration-300 ease-out"),style:{width:`${l}%`}})})]})}b.displayName="ProgressBar";0&&(module.exports={ProgressBar});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cn as e}from"../../lib/cn.js";import{jsx as a,jsxs as
|
|
1
|
+
import{cn as e}from"../../lib/cn.js";import{jsx as a,jsxs as c}from"react/jsx-runtime";var k={xs:"h-1",sm:"h-1.5",md:"h-2.5",lg:"h-4",xl:"h-6"},B={default:"bg-gray-500 dark:bg-gray-400",primary:"bg-synertech-primary-600 dark:bg-synertech-primary-500",success:"bg-green-600 dark:bg-green-500",warning:"bg-yellow-500 dark:bg-yellow-400",error:"bg-red-600 dark:bg-red-500",info:"bg-cyan-600 dark:bg-cyan-500"},N={default:"text-gray-700 dark:text-gray-300",primary:"text-synertech-primary-600 dark:text-synertech-primary-400",success:"text-green-700 dark:text-green-400",warning:"text-yellow-700 dark:text-yellow-400",error:"text-red-600 dark:text-red-400",info:"text-cyan-700 dark:text-cyan-400"},y="bg-[repeating-linear-gradient(45deg,transparent,transparent_10px,rgba(255,255,255,0.2)_10px,rgba(255,255,255,0.2)_20px)]",z={default:"bg-gradient-to-r from-gray-400 to-gray-600",primary:"bg-gradient-to-r from-synertech-primary-400 to-synertech-primary-700",success:"bg-gradient-to-r from-green-400 to-green-700",warning:"bg-gradient-to-r from-yellow-300 to-yellow-600",error:"bg-gradient-to-r from-red-400 to-red-700",info:"bg-gradient-to-r from-cyan-400 to-cyan-700"};function R({value:n=0,indeterminate:s=!1,size:p="md",color:o="primary",variant:i="default",progressColor:b,trackColor:u,showValue:l=!1,valueFormat:d,label:r,animated:f=!0,className:x,"aria-label":h,"aria-labelledby":g,"aria-describedby":v,"aria-valuetext":w,...P}){let t=Number.isFinite(n)?Math.min(100,Math.max(0,n)):0,m=b||(i==="gradient"?z[o]:B[o]),C=d?d(t):`${Math.round(t)}%`;return c("div",{className:e("w-full",x),...P,children:[(r||l)&&c("div",{className:"flex items-center justify-between mb-1",children:[r&&a("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:r}),l&&!s&&a("span",{className:e("text-sm font-semibold",N[o],!r&&"ml-auto"),children:C})]}),a("div",{role:"progressbar","aria-valuenow":s?void 0:t,"aria-valuemin":0,"aria-valuemax":100,"aria-valuetext":w,"aria-label":h??(g?void 0:r),"aria-labelledby":g,"aria-describedby":v,className:e("relative w-full overflow-hidden rounded-full",u||"bg-gray-200 dark:bg-gray-700",k[p]),children:s?a("div",{className:e("absolute h-full w-1/3 rounded-full",m,i==="striped"&&y,"animate-[progress-indeterminate_1.5s_ease-in-out_infinite]")}):a("div",{className:e("h-full rounded-full",m,i==="striped"&&y,f&&"transition-[width] duration-300 ease-out"),style:{width:`${t}%`}})})]})}R.displayName="ProgressBar";export{R as ProgressBar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var E=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var ce=Object.prototype.hasOwnProperty;var ge=(e,r)=>{for(var s in r)E(e,s,{get:r[s],enumerable:!0})},ue=(e,r,s,c)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of de(r))!ce.call(e,a)&&a!==s&&E(e,a,{get:()=>r[a],enumerable:!(c=le(r,a))||c.enumerable});return e};var he=e=>ue(E({},"__esModule",{value:!0}),e);var ye={};ge(ye,{RadioButton:()=>H});module.exports=he(ye);var C=require("react"),o=require("../../lib/cn.cjs"),i=require("../../lib/css-value.cjs"),F=require("../form/shared/field-error.cjs"),t=require("react/jsx-runtime"),be=e=>({sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"})[e],fe=e=>({sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"})[e],me=(e,r,s,c,a,v,p,g)=>{if(r)return(0,o.cn)("border-2",c?"":"border-red-500",s&&!a?"bg-red-500":"");switch(e){case"filled":return(0,o.cn)("border-2",g?"":"border-gray-300 dark:border-gray-600",s?v?"":"bg-synertech-primary-600 border-synertech-primary-600 dark:bg-synertech-primary-500 dark:border-synertech-primary-500":p?"":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700");case"outlined":return(0,o.cn)("border-[3px]",g?"":s?"border-synertech-primary-600 dark:border-synertech-primary-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800");default:return(0,o.cn)("border-2",g?"":s?"border-synertech-primary-600 dark:border-synertech-primary-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800")}},pe={},H=(0,C.forwardRef)(({label:e,description:r,value:s,checked:c,defaultChecked:a=!1,onCheckedChange:v,size:p="md",variant:g="default",labelPosition:y="right",error:L,disabled:u=!1,readOnly:l=!1,required:I=!1,checkedColor:T,uncheckedColor:W,borderColor:q,labelColor:V,errorColor:A,dotColor:G,hoverColor:J,focusRingColor:K,showFocusRing:M=!0,className:Q,containerClassName:U,id:X,onClick:Y,"aria-describedby":Z,..._},$)=>{let f=(0,i.safeCssColor)(T),k=(0,i.safeCssColor)(W),x=(0,i.safeCssColor)(q),w=(0,i.safeCssColor)(V),h=(0,i.safeCssColor)(A),m=(0,i.safeCssColor)(G),R=(0,i.safeCssColor)(J),S=(0,i.safeCssColor)(K),j=c!==void 0,O=(0,C.useId)(),N=X||O,b=(0,F.describeField)(N,{description:r,error:L,own:Z}),P=b.message,z=b.invalid,ee=n=>{u||l||v?.(n.target.checked)},re=n=>{Y?.(n),l&&n.preventDefault()},oe=w?"":"text-gray-700 dark:text-gray-200",te=h?"":"text-red-600 dark:text-red-400",se=R?"hover:border-[color:var(--synertech-radio-hover)]":"hover:border-synertech-primary-500 dark:hover:border-synertech-primary-400",ne=S?"peer-focus-visible:ring-[color:var(--synertech-radio-ring)]":"peer-focus-visible:ring-synertech-primary-500",B=n=>{let d={};f&&n&&(d.backgroundColor=f,d.borderColor=f),k&&!n&&(d.backgroundColor=k),x&&(d.borderColor=x),z&&h&&(d.borderColor=h,n&&!m&&(d.backgroundColor=h));let D=d;return R&&(D["--synertech-radio-hover"]=R),S&&(D["--synertech-radio-ring"]=S),(0,t.jsx)("div",{className:(0,o.cn)("rounded-full transition-all duration-200",be(p),me(g,z,n,h,m,f,k,x),!u&&!l&&se,!u&&!l&&M&&"peer-focus-visible:ring-2 ring-offset-2",!u&&!l&&M&&ne,Q,n?"hidden peer-checked:block":"peer-checked:hidden"),style:d,children:n&&(0,t.jsx)("div",{className:(0,o.cn)("rounded-full absolute inset-0 m-auto transition-all duration-200",fe(p),m?"":g==="outlined"||g==="default"?"bg-synertech-primary-600 dark:bg-synertech-primary-500":f?"bg-white":"bg-synertech-on-primary"),style:m?{backgroundColor:m}:void 0})})},ae=w?{color:w}:{},ie=h?{color:h}:{};return(0,t.jsxs)("div",{className:(0,o.cn)("inline-flex flex-col",U),style:pe,children:[(0,t.jsxs)("label",{className:(0,o.cn)("inline-flex items-center cursor-pointer",u&&"opacity-50 cursor-not-allowed",l&&"cursor-default",y==="left"&&"flex-row-reverse"),htmlFor:N,children:[(0,t.jsxs)("div",{className:"relative inline-flex items-center",children:[(0,t.jsx)("input",{ref:$,type:"radio",id:N,value:s,...j?{checked:c}:{defaultChecked:a},onChange:ee,onClick:re,disabled:u,readOnly:l,required:I,"aria-invalid":z||void 0,"aria-describedby":b.describedBy,className:"sr-only peer",tabIndex:l?-1:void 0,..._}),B(!1),B(!0)]}),e&&(0,t.jsxs)("span",{className:(0,o.cn)("select-none",y==="left"?"mr-2":"ml-2",oe,u&&"opacity-50"),style:ae,children:[e,I&&(0,t.jsx)("span",{className:"text-red-600 dark:text-red-400 ml-1","aria-hidden":"true",children:"*"})]})]}),b.hasDescription&&(0,t.jsx)("p",{id:b.ids.description,className:(0,o.cn)("text-sm text-gray-500 dark:text-gray-400 mt-1",y==="left"?"text-right":"ml-7"),children:r}),P!==void 0&&(0,t.jsx)("p",{id:b.ids.error,className:(0,o.cn)("text-sm mt-1",y==="left"?"text-right":"ml-7",te),style:ie,children:P})]})});H.displayName="RadioButton";0&&(module.exports={RadioButton});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useId as
|
|
1
|
+
"use client";import{useId as ne,forwardRef as ae}from"react";import{cn as r}from"../../lib/cn.js";import{safeCssColor as n}from"../../lib/css-value.js";import{describeField as ie}from"../form/shared/field-error.js";import{jsx as u,jsxs as y}from"react/jsx-runtime";var le=o=>({sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"})[o],de=o=>({sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"})[o],ce=(o,d,c,f,C,v,m,a)=>{if(d)return r("border-2",f?"":"border-red-500",c&&!C?"bg-red-500":"");switch(o){case"filled":return r("border-2",a?"":"border-gray-300 dark:border-gray-600",c?v?"":"bg-synertech-primary-600 border-synertech-primary-600 dark:bg-synertech-primary-500 dark:border-synertech-primary-500":m?"":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700");case"outlined":return r("border-[3px]",a?"":c?"border-synertech-primary-600 dark:border-synertech-primary-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800");default:return r("border-2",a?"":c?"border-synertech-primary-600 dark:border-synertech-primary-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800")}},ge={},ue=ae(({label:o,description:d,value:c,checked:f,defaultChecked:C=!1,onCheckedChange:v,size:m="md",variant:a="default",labelPosition:p="right",error:D,disabled:i=!1,readOnly:t=!1,required:E=!1,checkedColor:F,uncheckedColor:H,borderColor:L,labelColor:T,errorColor:W,dotColor:q,hoverColor:V,focusRingColor:A,showFocusRing:I=!0,className:G,containerClassName:J,id:K,onClick:Q,"aria-describedby":U,...X},Y)=>{let h=n(F),k=n(H),x=n(L),w=n(T),l=n(W),b=n(q),R=n(V),S=n(A),Z=f!==void 0,_=ne(),N=K||_,g=ie(N,{description:d,error:D,own:U}),M=g.message,z=g.invalid,$=e=>{i||t||v?.(e.target.checked)},j=e=>{Q?.(e),t&&e.preventDefault()},O=w?"":"text-gray-700 dark:text-gray-200",ee=l?"":"text-red-600 dark:text-red-400",re=R?"hover:border-[color:var(--synertech-radio-hover)]":"hover:border-synertech-primary-500 dark:hover:border-synertech-primary-400",oe=S?"peer-focus-visible:ring-[color:var(--synertech-radio-ring)]":"peer-focus-visible:ring-synertech-primary-500",P=e=>{let s={};h&&e&&(s.backgroundColor=h,s.borderColor=h),k&&!e&&(s.backgroundColor=k),x&&(s.borderColor=x),z&&l&&(s.borderColor=l,e&&!b&&(s.backgroundColor=l));let B=s;return R&&(B["--synertech-radio-hover"]=R),S&&(B["--synertech-radio-ring"]=S),u("div",{className:r("rounded-full transition-all duration-200",le(m),ce(a,z,e,l,b,h,k,x),!i&&!t&&re,!i&&!t&&I&&"peer-focus-visible:ring-2 ring-offset-2",!i&&!t&&I&&oe,G,e?"hidden peer-checked:block":"peer-checked:hidden"),style:s,children:e&&u("div",{className:r("rounded-full absolute inset-0 m-auto transition-all duration-200",de(m),b?"":a==="outlined"||a==="default"?"bg-synertech-primary-600 dark:bg-synertech-primary-500":h?"bg-white":"bg-synertech-on-primary"),style:b?{backgroundColor:b}:void 0})})},te=w?{color:w}:{},se=l?{color:l}:{};return y("div",{className:r("inline-flex flex-col",J),style:ge,children:[y("label",{className:r("inline-flex items-center cursor-pointer",i&&"opacity-50 cursor-not-allowed",t&&"cursor-default",p==="left"&&"flex-row-reverse"),htmlFor:N,children:[y("div",{className:"relative inline-flex items-center",children:[u("input",{ref:Y,type:"radio",id:N,value:c,...Z?{checked:f}:{defaultChecked:C},onChange:$,onClick:j,disabled:i,readOnly:t,required:E,"aria-invalid":z||void 0,"aria-describedby":g.describedBy,className:"sr-only peer",tabIndex:t?-1:void 0,...X}),P(!1),P(!0)]}),o&&y("span",{className:r("select-none",p==="left"?"mr-2":"ml-2",O,i&&"opacity-50"),style:te,children:[o,E&&u("span",{className:"text-red-600 dark:text-red-400 ml-1","aria-hidden":"true",children:"*"})]})]}),g.hasDescription&&u("p",{id:g.ids.description,className:r("text-sm text-gray-500 dark:text-gray-400 mt-1",p==="left"?"text-right":"ml-7"),children:d}),M!==void 0&&u("p",{id:g.ids.error,className:r("text-sm mt-1",p==="left"?"text-right":"ml-7",ee),style:se,children:M})]})});ue.displayName="RadioButton";export{ue as RadioButton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var ne=Object.defineProperty;var ke=Object.getOwnPropertyDescriptor;var ve=Object.getOwnPropertyNames;var Se=Object.prototype.hasOwnProperty;var Pe=(s,o)=>{for(var r in o)ne(s,r,{get:o[r],enumerable:!0})},Ve=(s,o,r,C)=>{if(o&&typeof o=="object"||typeof o=="function")for(let m of ve(o))!Se.call(s,m)&&m!==r&&ne(s,m,{get:()=>o[m],enumerable:!(C=ke(o,m))||C.enumerable});return s};var Re=s=>Ve(ne({},"__esModule",{value:!0}),s);var Ee={};Pe(Ee,{ScatterChart:()=>Ie,resetScatterWarnings:()=>Me});module.exports=Re(Ee);var g=require("react"),de=require("../../lib/i18n.cjs"),oe=require("../chart/ChartAxis.cjs"),me=require("../chart/ChartContainer.cjs"),he=require("../chart/ChartGrid.cjs"),fe=require("../chart/ChartLegend.cjs"),ge=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"),ye=require("../chart/utils/scales.cjs"),ie=require("../chart/utils/ticks.cjs"),pe=require("../chart/utils/timestamp.cjs"),xe=require("../chart/utils/touch.cjs"),i=require("react/jsx-runtime"),Le=4.5,we=48,se=!1;function ue(s){return`${s.index}:${s.seriesKey}`}function Te(s,o){return s.reduce((r,C)=>Math.abs(C.cx-o)<Math.abs(r.cx-o)?C:r)}var Ke=(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 Ae({width:s,height:o,data:r,resolvedSeries:C,x:m,y:$,grid:K,size:Y,bubble:k,trendLine:_,quadrants:W,pointRadius:D,overlay:z,maxPoints:A,margin:U,tooltip:I,onPointClick:M,plotLabel:Z,formatValue:T,formatX:E}){let[q,H]=(0,g.useState)(null),t=(0,g.useMemo)(()=>{let a=C.filter(u=>!u.hidden),x=a.map(u=>u.key),l=(0,O.buildCartesianGeometry)({width:s,height:o,data:r,x:{...m,scale:m.scale==="time"?"time":"linear"},y:$,bounds:(0,ie.extent)((0,G.collectAllValues)(r,x)),margin:U,formatValue:T,formatX:E}),R=k?(0,G.collectAllValues)(r,[k.key]):[],L=k?(0,ie.extent)(R):null,[c,d]=k?.range??[4,14],f=u=>{if(!k||!L)return D;let h=(0,G.readNumber)(u,k.key);if(h===null)return c;let[S,n]=L,y=n===S?1:(h-S)/(n-S);return Math.sqrt(c*c+y*(d*d-c*c))},b=[],v=[],N=[];a.forEach(u=>{let h=[];r.forEach((n,y)=>{let V=(0,G.readNumber)(n,u.key),p=l.categoryPositions[y];V===null||!Number.isFinite(p)||h.push({seriesKey:u.key,seriesLabel:(0,w.getSeriesLabel)(u),color:u.color,index:y,cx:p,cy:l.valueScale(V),r:f(n),xValue:l.toCategoryNumber(l.xValues[y]),yValue:V})}),A||(0,Q.warnPointBudget)("ScatterChart",h.length);let S=A&&A>0?(0,Q.sampleEvenly)(h,A):h;v.push(...h),b.push(...S),S.length>0&&N.push([...S].sort((n,y)=>n.cx-y.cx||n.index-y.index))});let j=null;if(_&&v.length>1){let u=v.length,h=v.reduce((p,P)=>p+P.xValue,0),S=v.reduce((p,P)=>p+P.yValue,0),n=v.reduce((p,P)=>p+P.xValue*P.yValue,0),y=v.reduce((p,P)=>p+P.xValue*P.xValue,0),V=u*y-h*h;if(V!==0){let p=(u*n-h*S)/V,P=(S-p*h)/u,le=v.map(re=>re.xValue),[be,Ce]=[Math.min(...le),Math.max(...le)],ce=v.map(re=>re.cx);j={x1:Math.min(...ce),y1:l.valueScale(p*be+P),x2:Math.max(...ce),y2:l.valueScale(p*Ce+P)}}}return{visible:a,points:b,tracks:N,marks:new Map(b.map(u=>[ue(u),u])),plot:(0,O.createPlotContext)({geometry:l,width:s,height:o,data:r,series:a,formatValue:T,formatX:E}),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,m,$,s,o,U,k,_,D,A,T,E]),e=q===null?null:t.marks.get(ue(q))??null,ee=(0,g.useCallback)(a=>{if(I===!1||t.points.length===0)return;let x=a.currentTarget.getBoundingClientRect(),l=a.clientX-x.left-t.margin.left,R=a.clientY-x.top-t.margin.top,L=null,c=we;for(let d of t.points){let f=Math.hypot(d.cx-l,d.cy-R);f<c&&(c=f,L=d)}H(L)},[I,t.points,t.margin]),B=(0,g.useCallback)(()=>{if(!M||!e)return;let a=r[e.index];a&&M({seriesKey:e.seriesKey,seriesLabel:e.seriesLabel,color:e.color,value:e.yValue,formattedValue:T(e.yValue),datum:a,index:e.index,x:t.xValues[e.index]})},[M,e,T,r,t.xValues]),te=(0,g.useCallback)(a=>{let{tracks:x}=t;if(x.length===0||(0,X.pressChartMark)(a,M&&e?B:null))return;let l=e?x.findIndex(b=>b[0].seriesKey===e.seriesKey):-1,R=l<0?null:x[l],L=R&&e?R.indexOf(e):-1,c=R&&L>=0?{track:R,trackIndex:l,markIndex:L}:null,d=c?.track??x[0],f;switch(a.key){case"ArrowRight":f=d[(0,X.stepChartCursor)(c?.markIndex??null,1,d.length)];break;case"ArrowLeft":f=d[(0,X.stepChartCursor)(c?.markIndex??null,-1,d.length)];break;case"ArrowDown":case"ArrowUp":{if(!c||!e){f=d[0];break}let b=(0,X.stepChartCursor)(c.trackIndex,a.key==="ArrowDown"?1:-1,x.length);f=b===c.trackIndex?e:Te(x[b],e.cx);break}case"Home":f=d[0];break;case"End":f=d[d.length-1];break;case"Escape":f=null;break;default:return}a.preventDefault(),H(f)},[t,e,M,B]),F=(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:`${xe.CHART_TOUCH} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500`,onPointerMove:ee,onPointerLeave:()=>H(null),onKeyDown:te,onBlur:()=>H(null),onClick:B,children:[(0,i.jsxs)("g",{transform:`translate(${t.margin.left}, ${t.margin.top})`,children:[(0,i.jsx)(he.ChartGrid,{width:t.innerWidth,height:t.innerHeight,horizontal:K==="y"||K==="both"?t.yTicks.map(a=>a.offset):void 0,vertical:K==="x"||K==="both"?t.xTicks.map(a=>a.offset):void 0}),W?.y!==void 0?(0,i.jsx)("line",{x1:0,y1:t.valueScale(W.y),x2:t.innerWidth,y2:t.valueScale(W.y),stroke:"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:"4 4"}):null,F.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)(Ke,{points:t.points}),F.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:m.hidden?null:(0,i.jsx)(oe.ChartAxis,{orientation:"bottom",ticks:t.xTicks,length:t.innerWidth,label:m.label,size:Y})}),(0,i.jsx)("g",{transform:`translate(${t.margin.left}, ${t.margin.top})`,children:$?.hidden?null:(0,i.jsx)(oe.ChartAxis,{orientation:"left",ticks:t.yTicks,length:t.innerHeight,showLine:!1,label:$?.label,size:Y})})]}),e&&r[e.index]&&I!==!1?(0,i.jsx)(J.ChartTooltip,{x:t.margin.left+e.cx,y:t.margin.top+e.cy,containerWidth:s,children:typeof I=="function"?I({x:t.xValues[e.index],xLabel:E(t.xValues[e.index],e.index),index:e.index,points:[{seriesKey:e.seriesKey,seriesLabel:e.seriesLabel,color:e.color,value:e.yValue,formattedValue:T(e.yValue),datum:r[e.index]}]}):(0,i.jsx)(J.ChartTooltipContent,{title:`${m.label??m.key} ${E(t.xValues[e.index],e.index)}`,points:[{seriesKey:e.seriesKey,seriesLabel:e.seriesLabel,color:e.color,value:e.yValue,formattedValue:T(e.yValue),datum:r[e.index]}]})}):null]})}function Ie({data:s,series:o,x:r,y:C,height:m=280,width:$,size:K="md",grid:Y="both",legend:k,tooltip:_=!0,tableView:W=!1,emphasis:D,title:z,description:A,loading:U=!1,emptyState:I,error:M=!1,errorState:Z,onRetry:T,actions:E,onPointClick:q,bubble:H,trendLine:t=!1,quadrants:e,pointRadius:ee=Le,overlay:B,legendToggle:te=!0,maxPoints:F,margin:a,locale:x,plotLabel:l,className:R,...L}){let c=(0,de.useUILocale)(x),[d,f]=(0,g.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 b=(0,g.useMemo)(()=>o.map((n,y)=>({...n,hidden:n.hidden||d.has(n.key),color:(0,w.resolveSeriesColor)(n,y,D)})),[o,d,D]),v=(0,g.useMemo)(()=>C?.format??(n=>(0,ae.formatAuto)(n,c)),[C?.format,c]),N=(0,g.useMemo)(()=>r.format??(n=>r.scale==="time"?(0,pe.formatTimeValue)(n,c):(0,ae.formatAuto)((0,ye.toNumber)(n),c)),[r.format,r.scale,c]),j=(0,g.useCallback)(n=>{f(y=>{let V=new Set(y);return V.has(n)?V.delete(n):V.add(n),V})},[]),u=k===void 0?o.length>=2:k!==!1,h=typeof k=="string"?k:"bottom",S=b.filter(n=>!n.hidden).length;return(0,i.jsx)(me.ChartContainer,{title:z,description:A,height:m,width:$,size:K,loading:U,empty:s.length===0||S===0,emptyState:I,error:M,errorState:Z,onRetry:T,actions:E,tableView:W,legendPosition:h,legend:u?(0,i.jsx)(fe.ChartLegend,{items:(0,w.toLegendItems)(b,D),position:h,marker:"dot",size:K,onToggle:te?j:void 0}):void 0,table:W?(0,i.jsx)(ge.ChartTableView,{data:s,series:b,xKey:r.key,xLabel:r.label??r.key,formatX:N,formatValue:v,caption:typeof z=="string"?z:void 0}):void 0,className:R,...L,children:({width:n})=>(0,i.jsx)(Ae,{width:n,height:m,data:s,resolvedSeries:b,x:r,y:C,grid:Y,size:K,bubble:H,trendLine:t,quadrants:e,pointRadius:ee,overlay:B,maxPoints:F,margin:a,tooltip:_,onPointClick:q,plotLabel:l,formatValue:v,formatX:N})})}function Me(){se=!1}0&&(module.exports={ScatterChart,resetScatterWarnings});
|
|
1
|
+
"use strict";"use client";var le=Object.defineProperty;var Se=Object.getOwnPropertyDescriptor;var Pe=Object.getOwnPropertyNames;var Re=Object.prototype.hasOwnProperty;var Le=(s,i)=>{for(var r in i)le(s,r,{get:i[r],enumerable:!0})},we=(s,i,r,k)=>{if(i&&typeof i=="object"||typeof i=="function")for(let h of Pe(i))!Re.call(s,h)&&h!==r&&le(s,h,{get:()=>i[h],enumerable:!(k=Se(i,h))||k.enumerable});return s};var Ve=s=>we(le({},"__esModule",{value:!0}),s);var $e={};Le($e,{ScatterChart:()=>He,resetScatterWarnings:()=>We});module.exports=Ve($e);var p=require("react"),he=require("../../lib/i18n.cjs"),ce=require("../chart/ChartAxis.cjs"),fe=require("../chart/ChartContainer.cjs"),ge=require("../chart/ChartGrid.cjs"),ye=require("../chart/ChartLegend.cjs"),pe=require("../chart/ChartPlotClip.cjs"),xe=require("../chart/ChartTableView.cjs"),re=require("../chart/ChartTooltip.cjs"),b=require("../chart/palette.cjs"),z=require("../chart/utils/cartesian.cjs"),$=require("../chart/utils/data.cjs"),ne=require("../chart/utils/decimate.cjs"),X=require("../chart/utils/format.cjs"),N=require("../chart/utils/keyboard.cjs"),ke=require("../chart/utils/regression.cjs"),Ce=require("../chart/utils/scales.cjs"),F=require("../chart/utils/ticks.cjs"),be=require("../chart/utils/timestamp.cjs"),ve=require("../chart/utils/touch.cjs"),n=require("react/jsx-runtime"),Te=4.5,Ae=48,ue=!1;function me(s){return`${s.index}:${s.seriesKey}`}function Ke(s,i){return s.reduce((r,k)=>Math.abs(k.cx-i)<Math.abs(r.cx-i)?k:r)}var Ie=(0,p.memo)(function({points:i}){return(0,n.jsx)("g",{children:i.map(r=>(0,n.jsx)("circle",{cx:r.cx,cy:r.cy,r:r.r,fill:r.color,fillOpacity:.85,strokeWidth:2,stroke:b.CHART_SURFACE_COLOR},`${r.seriesKey}-${r.index}`))})});function Ee({width:s,height:i,data:r,resolvedSeries:k,x:h,y:D,grid:T,size:j,bubble:u,trendLine:J,quadrants:K,pointRadius:M,overlay:G,maxPoints:I,margin:Q,tooltip:E,onPointClick:H,plotLabel:ae,formatValue:V,formatX:W,locale:_}){let[v,O]=(0,p.useState)(null),t=(0,p.useMemo)(()=>{let a=k.filter(c=>!c.hidden),x=a.map(c=>c.key),o=(0,z.buildCartesianGeometry)({locale:_,width:s,height:i,data:r,x:{...h,scale:h.scale==="time"?"time":"linear"},y:D,bounds:(0,F.extent)((0,$.collectAllValues)(r,x)),margin:Q,formatValue:V,formatX:W}),P=u?(0,$.collectAllValues)(r,[u.key]):[],R=u?(0,F.extent)(P):null,[d,m]=u?.range??[4,14],f=c=>{if(!u||!R)return M;let g=(0,$.readNumber)(c,u.key);if(g===null)return d;let[w,C]=R,y=C===w?1:(g-w)/(C-w);return Math.sqrt(d*d+y*(m*m-d*d))},L=[],A=[],te=[];a.forEach(c=>{let g=[];r.forEach((C,y)=>{let B=(0,$.readNumber)(C,c.key),de=o.categoryPositions[y];B===null||!Number.isFinite(de)||g.push({seriesKey:c.key,seriesLabel:(0,b.getSeriesLabel)(c),color:c.color,index:y,cx:de,cy:o.valueScale(B),r:f(C),xValue:o.toCategoryNumber(o.xValues[y]),yValue:B})}),I||(0,ne.warnPointBudget)("ScatterChart",g.length);let w=I&&I>0?(0,ne.sampleEvenly)(g,I):g;A.push(...g),L.push(...w),w.length>0&&te.push([...w].sort((C,y)=>C.cx-y.cx||C.index-y.index))});let l=null;if(J&&A.length>1){let[c,g]=(0,F.extent)(A.map(y=>y.xValue))??[0,0],w=(0,ke.leastSquares)(A),C=(0,F.extent)(A.map(y=>y.cx));if(w!==null&&C!==null&&g>c){let{slope:y,intercept:B}=w;l={x1:C[0],y1:o.valueScale(y*c+B),x2:C[1],y2:o.valueScale(y*g+B)}}}return{visible:a,points:L,tracks:te,marks:new Map(L.map(c=>[me(c),c])),plot:(0,z.createPlotContext)({geometry:o,width:s,height:i,data:r,series:a,formatValue:V,formatX:W}),trend:l,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,k,h,D,s,i,Q,u,J,M,I,V,W]),e=v===null?null:t.marks.get(me(v))??null,Z=u&&e&&r[e.index]?(0,$.readNumber)(r[e.index],u.key):null,oe=u?.format??(a=>(0,X.formatExact)(a,_)),ie=(0,p.useCallback)(a=>{if(E===!1||t.points.length===0)return;let x=a.currentTarget.getBoundingClientRect(),o=a.clientX-x.left-t.margin.left,P=a.clientY-x.top-t.margin.top,R=null,d=Ae;for(let m of t.points){let f=Math.hypot(m.cx-o,m.cy-P);f<d&&(d=f,R=m)}O(R)},[E,t.points,t.margin]),U=(0,p.useCallback)(()=>{if(!H||!e)return;let a=r[e.index];a&&H({seriesKey:e.seriesKey,seriesLabel:e.seriesLabel,color:e.color,value:e.yValue,formattedValue:V(e.yValue),datum:a,index:e.index,x:t.xValues[e.index]})},[H,e,V,r,t.xValues]),se=(0,p.useCallback)(a=>{let{tracks:x}=t;if(x.length===0||(0,N.pressChartMark)(a,H&&e?U:null))return;let o=e?x.findIndex(L=>L[0].seriesKey===e.seriesKey):-1,P=o<0?null:x[o],R=P&&e?P.indexOf(e):-1,d=P&&R>=0?{track:P,trackIndex:o,markIndex:R}:null,m=d?.track??x[0],f;switch(a.key){case"ArrowRight":f=m[(0,N.stepChartCursor)(d?.markIndex??null,1,m.length)];break;case"ArrowLeft":f=m[(0,N.stepChartCursor)(d?.markIndex??null,-1,m.length)];break;case"ArrowDown":case"ArrowUp":{if(!d||!e){f=m[0];break}let L=(0,N.stepChartCursor)(d.trackIndex,a.key==="ArrowDown"?1:-1,x.length);f=L===d.trackIndex?e:Ke(x[L],e.cx);break}case"Home":f=m[0];break;case"End":f=m[m.length-1];break;case"Escape":if(e===null)return;f=null;break;default:return}a.preventDefault(),O(f)},[t,e,H,U]),ee=(0,z.splitOverlay)(G),Y=K?.x===void 0?null:t.plot.xAt(K.x),q=K?.y===void 0?null:t.valueScale(K.y),S=q!==null&&(0,pe.isOnPlot)(q,t.innerHeight)?q:null;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("svg",{width:s,height:i,role:"img","aria-label":ae??t.visible.map(a=>(0,b.getSeriesLabel)(a)).join(", "),tabIndex:0,className:`${ve.CHART_TOUCH} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500`,onPointerMove:ie,onPointerLeave:()=>O(null),onKeyDown:se,onBlur:()=>O(null),onClick:U,children:[(0,n.jsxs)("g",{transform:`translate(${t.margin.left}, ${t.margin.top})`,children:[(0,n.jsx)(ge.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!==null?(0,n.jsx)("line",{x1:Y,y1:0,x2:Y,y2:t.innerHeight,stroke:"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:"4 4"}):null,S!==null?(0,n.jsx)("line",{x1:0,y1:S,x2:t.innerWidth,y2:S,stroke:"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:"4 4"}):null,ee.under?.(t.plot),t.trend?(0,n.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,n.jsx)(Ie,{points:t.points}),ee.over?.(t.plot),e?(0,n.jsx)("circle",{cx:e.cx,cy:e.cy,r:e.r+3,fill:"none",stroke:e.color,strokeWidth:2,"aria-hidden":"true"}):null]}),(0,n.jsx)("g",{transform:`translate(${t.margin.left}, ${t.margin.top+t.innerHeight})`,children:h.hidden?null:(0,n.jsx)(ce.ChartAxis,{orientation:"bottom",ticks:t.xTicks,length:t.innerWidth,label:h.label,size:j})}),(0,n.jsx)("g",{transform:`translate(${t.margin.left}, ${t.margin.top})`,children:D?.hidden?null:(0,n.jsx)(ce.ChartAxis,{orientation:"left",ticks:t.yTicks,length:t.innerHeight,showLine:!1,label:D?.label,size:j})})]}),e&&r[e.index]&&E!==!1?(0,n.jsx)(re.ChartTooltip,{x:t.margin.left+e.cx,y:t.margin.top+e.cy,containerWidth:s,children:typeof E=="function"?E({x:t.xValues[e.index],xLabel:W(t.xValues[e.index],e.index),index:e.index,points:[{seriesKey:e.seriesKey,seriesLabel:e.seriesLabel,color:e.color,value:e.yValue,formattedValue:V(e.yValue),datum:r[e.index]}]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(re.ChartTooltipContent,{title:`${h.label??h.key} ${W(t.xValues[e.index],e.index)}`,points:[{seriesKey:e.seriesKey,seriesLabel:e.seriesLabel,color:e.color,value:e.yValue,formattedValue:V(e.yValue),datum:r[e.index]}]}),Z!==null&&u?(0,n.jsxs)("div",{className:"mt-0.5 flex items-center gap-2",children:[(0,n.jsx)("span",{className:"w-3 shrink-0","aria-hidden":"true"}),(0,n.jsx)("span",{className:"grow text-gray-500 dark:text-gray-400",children:u.label??u.key}),(0,n.jsx)("span",{className:"font-semibold text-gray-900 [font-variant-numeric:tabular-nums] dark:text-gray-100",children:oe(Z)})]}):null]})}):null]})}function He({data:s,series:i,x:r,y:k,height:h=280,width:D,size:T="md",grid:j="both",legend:u,tooltip:J=!0,tableView:K=!1,emphasis:M,title:G,description:I,loading:Q=!1,emptyState:E,error:H=!1,errorState:ae,onRetry:V,actions:W,onPointClick:_,bubble:v,trendLine:O=!1,quadrants:t,pointRadius:e=Te,overlay:Z,legendToggle:oe=!0,maxPoints:ie,margin:U,locale:se,plotLabel:ee,className:Y,...q}){let S=(0,he.useUILocale)(se),[a,x]=(0,p.useState)(()=>new Set);i.length>b.CHART_ALL_PAIRS_LIMIT&&!ue&&(ue=!0,console.warn(`[@synertech/ui] A ScatterChart was given ${i.length} series. Any two marks can sit side by side here, and only the first ${b.CHART_ALL_PAIRS_LIMIT} palette slots stay tellable apart under that test: facet the chart instead.`));let o=(0,p.useMemo)(()=>i.map((l,c)=>({...l,hidden:l.hidden||a.has(l.key),color:(0,b.resolveSeriesColor)(l,c,M)})),[i,a,M]),P=(0,p.useMemo)(()=>k?.format??(l=>(0,X.formatAuto)(l,S)),[k?.format,S]),R=(0,p.useMemo)(()=>r.format??(l=>r.scale==="time"?(0,be.formatTimeValue)(l,S):(0,X.formatAuto)((0,Ce.toNumber)(l),S)),[r.format,r.scale,S]),d=(0,p.useCallback)(l=>{x(c=>{let g=new Set(c);return g.has(l)?g.delete(l):g.add(l),g})},[]),m=u===void 0?i.length>=2:u!==!1,f=typeof u=="string"?u:"bottom",L=o.filter(l=>!l.hidden).length,A=v?[...o,{key:v.key,label:v.label??v.key}]:o,te=v?.format??(l=>(0,X.formatExact)(l,S));return(0,n.jsx)(fe.ChartContainer,{title:G,description:I,height:h,width:D,size:T,loading:Q,empty:s.length===0||L===0,emptyState:E,error:H,errorState:ae,onRetry:V,actions:W,exportSource:{data:s,series:A,xKey:r.key,xLabel:r.label??r.key,formatX:r.format},tableView:K,legendPosition:f,legend:m?(0,n.jsx)(ye.ChartLegend,{items:(0,b.toLegendItems)(o,M),position:f,marker:"dot",size:T,onToggle:oe?d:void 0}):void 0,table:K?(0,n.jsx)(xe.ChartTableView,{data:s,series:A,xKey:r.key,xLabel:r.label??r.key,formatX:R,formatValue:P,columnFormats:v?{[v.key]:te}:void 0,caption:typeof G=="string"?G:void 0}):void 0,className:Y,...q,children:({width:l})=>(0,n.jsx)(Ee,{locale:S,width:l,height:h,data:s,resolvedSeries:o,x:r,y:k,grid:j,size:T,bubble:v,trendLine:O,quadrants:t,pointRadius:e,overlay:Z,maxPoints:ie,margin:U,tooltip:J,onPointClick:_,plotLabel:ee,formatValue:P,formatX:R})})}function We(){ue=!1}0&&(module.exports={ScatterChart,resetScatterWarnings});
|