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