@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 strict";"use client";var
|
|
1
|
+
"use strict";"use client";var ae=Object.defineProperty;var ke=Object.getOwnPropertyDescriptor;var we=Object.getOwnPropertyNames;var xe=Object.prototype.hasOwnProperty;var ve=(o,n)=>{for(var u in n)ae(o,u,{get:n[u],enumerable:!0})},Le=(o,n,u,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let c of we(n))!xe.call(o,c)&&c!==u&&ae(o,c,{get:()=>n[c],enumerable:!(r=ke(n,c))||r.enumerable});return o};var Pe=o=>Le(ae({},"__esModule",{value:!0}),o);var Te={};ve(Te,{CandlestickChart:()=>He});module.exports=Pe(Te);var s=require("react"),z=require("../../lib/i18n.cjs"),oe=require("../chart/ChartAxis.cjs"),he=require("../chart/ChartContainer.cjs"),ue=require("../chart/ChartGrid.cjs"),ge=require("../chart/ChartLegend.cjs"),T=require("../chart/ChartPlotClip.cjs"),de=require("../chart/ChartTableView.cjs"),me=require("../chart/ChartTooltip.cjs"),J=require("../chart/palette.cjs"),V=require("../chart/utils/cartesian.cjs"),v=require("../chart/utils/data.cjs"),Q=require("../chart/utils/format.cjs"),fe=require("../chart/utils/keyboard.cjs"),pe=require("../chart/utils/path.cjs"),be=require("../chart/utils/scales.cjs"),ye=require("../chart/utils/ticks.cjs"),Ce=require("../chart/utils/touch.cjs"),e=require("react/jsx-runtime"),Re=16,Ne=1.5,Se=(0,s.memo)(function({candles:n,clipId:u}){return(0,e.jsx)("g",{clipPath:`url(#${u})`,children:n.map(r=>(0,e.jsxs)("g",{children:[r.wick?(0,e.jsx)("line",{x1:r.wick.x,y1:r.wick.y1,x2:r.wick.x,y2:r.wick.y2,stroke:r.color,strokeWidth:1.5}):null,r.body?(0,e.jsx)("path",{d:r.body,fill:r.hollow?"none":r.color,stroke:r.color,strokeWidth:r.hollow?1.5:0}):null]},r.key))})});function Ie({width:o,height:n,data:u,candles:r,x:c,y,grid:L,size:E,candleSize:G,fillRising:P,palette:X,referenceLines:R,margin:_,tooltip:f,plotLabel:ee,formatValue:p,formatX:K,onCandleClick:C,locale:N}){let[M,S]=(0,s.useState)(null),g=M!==null&&M<r.length?M:null,k=(0,z.useUILabels)(),B=(0,T.plotClipId)((0,s.useId)()),t=(0,s.useMemo)(()=>{let a=r.flatMap(i=>i.high===null||i.low===null?[]:[i.low,i.high]),l=(0,V.buildCartesianGeometry)({locale:N,width:o,height:n,data:u,x:c,y,bounds:(0,V.widenBounds)((0,ye.extent)(a),(0,V.annotationValues)(u,c.key,R,void 0)),margin:_,orientation:"vertical",placement:"band",formatValue:p,formatX:K,defaultIncludeZero:!1}),{valueScale:b,bandwidth:W,categoryPositions:O,innerWidth:Y,innerHeight:U}=l,I=Math.min(G??Re,Math.max(1,W-2));return{rendered:r.map((i,w)=>{let d=O[w]+(W-I)/2,F=d+I/2,H=i.rising?X.up:X.down,j=i.high===null||i.low===null?null:{x:F,y1:b(i.high),y2:b(i.low)},x=null;if(i.open!==null&&i.close!==null){let Z=b(i.open),q=b(i.close);x=(0,pe.buildBarPath)({x:d,y:Math.min(Z,q),width:I,height:Math.max(Ne,Math.abs(q-Z)),radius:0,round:"none"})}return{key:`${w}`,color:H,body:x,hollow:i.rising&&!P,wick:j,left:d,width:I}}),categoryPositions:O,categoryCenters:l.categoryCenters,bandwidth:W,categoryTicks:l.categoryTicks,valueTicks:l.valueTicks,valueScale:b,innerWidth:Y,innerHeight:U,margin:l.margin}},[N,r,u,c,y,o,n,_,G,P,X,R,p,K]),te=(0,s.useCallback)(a=>{if(f===!1||r.length===0)return;let l=a.currentTarget.getBoundingClientRect(),b=a.clientX-l.left-t.margin.left;S((0,be.nearestIndex)(t.categoryCenters,b))},[f,r.length,t.margin.left,t.categoryCenters]),A=(0,s.useCallback)(()=>{!C||g===null||C(r[g])},[C,g,r]),re=(0,s.useCallback)(a=>(0,fe.handleChartKeyDown)(a,{count:r.length,current:g,axis:"x",onMove:S,pick:C?A:null}),[r.length,g,C,A]),h=g===null?null:r[g];return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("svg",{width:o,height:n,role:"img","aria-label":ee??r.map(a=>a.label).join(", "),tabIndex:0,className:`${Ce.CHART_TOUCH} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500`,onPointerMove:te,onPointerLeave:()=>S(null),onKeyDown:re,onBlur:()=>S(null),onClick:A,children:[(0,e.jsxs)("g",{transform:`translate(${t.margin.left}, ${t.margin.top})`,children:[(0,e.jsx)(T.ChartPlotClip,{id:B,width:t.innerWidth,height:t.innerHeight,bleed:1}),(0,e.jsx)(ue.ChartGrid,{width:t.innerWidth,height:t.innerHeight,horizontal:L==="y"||L==="both"?t.valueTicks.map(a=>a.offset):void 0}),g!==null?(0,e.jsx)("rect",{x:t.categoryPositions[g],y:0,width:t.bandwidth,height:t.innerHeight,className:"fill-gray-400 dark:fill-gray-500",opacity:.12,"aria-hidden":"true"}):null,R?.map(a=>{let l=t.valueScale(a.value);return(0,T.isOnPlot)(l,t.innerHeight)?(0,e.jsxs)("g",{children:[(0,e.jsx)("line",{x1:0,y1:l,x2:t.innerWidth,y2:l,stroke:a.color??"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:a.dashed===!1?void 0:"4 4"}),a.label?(0,e.jsx)("text",{x:t.innerWidth,y:l-4,textAnchor:"end",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:a.label}):null]},`${a.value}-${a.label??""}`):null}),(0,e.jsx)(Se,{candles:t.rendered,clipId:B})]}),(0,e.jsx)("g",{transform:`translate(${t.margin.left}, ${t.margin.top+t.innerHeight})`,children:c.hidden?null:(0,e.jsx)(oe.ChartAxis,{orientation:"bottom",ticks:t.categoryTicks,length:t.innerWidth,label:c.label,size:E})}),(0,e.jsx)("g",{transform:`translate(${t.margin.left}, ${t.margin.top})`,children:y?.hidden?null:(0,e.jsx)(oe.ChartAxis,{orientation:"left",ticks:t.valueTicks,length:t.innerHeight,showLine:!1,label:y?.label,size:E})})]}),h&&g!==null&&f!==!1?(0,e.jsx)(me.ChartTooltip,{x:t.margin.left+t.categoryCenters[g],y:t.margin.top+(h.high===null?t.innerHeight/2:t.valueScale(h.high)),containerWidth:o,children:typeof f=="function"?f(h):(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)("div",{className:"font-medium text-gray-900 dark:text-gray-100",children:h.label}),(0,e.jsx)("dl",{className:"grid grid-cols-[auto_auto] gap-x-3 gap-y-0.5",children:[[k.chartOpen,h.open],[k.chartHigh,h.high],[k.chartLow,h.low],[k.chartClose,h.close]].map(([a,l])=>(0,e.jsxs)("div",{className:"contents",children:[(0,e.jsx)("dt",{className:"text-gray-500 dark:text-gray-400",children:a}),(0,e.jsx)("dd",{className:"justify-self-end font-medium text-gray-900 [font-variant-numeric:tabular-nums] dark:text-gray-100",children:l===null?"\u2014":p(l)})]},a))}),h.change===null?null:(0,e.jsxs)("div",{className:"flex items-center gap-2 border-t border-gray-200 pt-1 dark:border-gray-700",children:[(0,e.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:h.rising?k.chartRise:k.chartFall}),(0,e.jsxs)("span",{className:"[font-variant-numeric:tabular-nums] font-semibold text-gray-900 dark:text-gray-100",children:[h.change>0?"+":"",p(h.change)]})]})]})}):null]})}function He({data:o,x:n,y:u,open:r,high:c,low:y,close:L,candleSize:E,fillRising:G=!1,colors:P,referenceLines:X,height:R=300,width:_,size:f="md",grid:ee="y",legend:p,tooltip:K=!0,tableView:C=!1,title:N,description:M,loading:S=!1,emptyState:g,error:k=!1,errorState:B,onRetry:t,actions:te,margin:A,locale:re,plotLabel:h,openLabel:a,highLabel:l,lowLabel:b,closeLabel:W,riseLabel:O,fallLabel:Y,format:U,onCandleClick:I,className:le,...i}){let w=(0,z.useUILocale)(re),d=(0,z.useUILabels)(),F=(0,s.useMemo)(()=>u?.format??U??(m=>(0,Q.formatAuto)(m,w)),[u?.format,U,w]),H=(0,s.useMemo)(()=>n.format??(m=>(0,Q.formatXValue)(m,w)),[n.format,w]),j=(0,s.useMemo)(()=>o.map((m,ne)=>{let ce=(0,v.readXValue)(m,n.key,ne),D=(0,v.readNumber)(m,r),$=(0,v.readNumber)(m,L);return{index:ne,x:ce,label:H(ce,ne),open:D,high:(0,v.readNumber)(m,c),low:(0,v.readNumber)(m,y),close:$,change:D===null||$===null?null:$-D,rising:D===null||$===null?!0:$>=D,datum:m}}),[o,n.key,r,c,y,L,H]),x=(0,s.useMemo)(()=>({up:P?.up??J.CHART_UP_COLOR,down:P?.down??J.CHART_DOWN_COLOR}),[P]),Z=(0,s.useMemo)(()=>[{key:"up",label:O??d.chartRise,color:x.up,marker:"rect"},{key:"down",label:Y??d.chartFall,color:x.down,marker:"rect"}],[x,O,Y,d.chartRise,d.chartFall]),q=p===void 0?!0:p!==!1,ie=typeof p=="string"?p:"bottom",se=[{key:r,label:a??d.chartOpen},{key:c,label:l??d.chartHigh},{key:y,label:b??d.chartLow},{key:L,label:W??d.chartClose}];return(0,e.jsx)(he.ChartContainer,{title:N,description:M,height:R,width:_,size:f,loading:S,empty:j.length===0,emptyState:g,error:k,errorState:B,onRetry:t,actions:te,exportSource:{data:o,series:se,xKey:n.key,xLabel:n.label??n.key,formatX:n.format},tableView:C,legendPosition:ie,legend:q?(0,e.jsx)(ge.ChartLegend,{items:Z,position:ie,marker:"rect",size:f}):void 0,table:C?(0,e.jsx)(de.ChartTableView,{data:o,series:se,xKey:n.key,xLabel:n.label??n.key,formatX:H,formatValue:F,caption:typeof N=="string"?N:void 0}):void 0,className:le,...i,children:({width:m})=>(0,e.jsx)(Ie,{locale:w,width:m,height:R,data:o,candles:j,x:n,y:u,grid:ee,size:f,candleSize:E,fillRising:G,palette:x,referenceLines:X,margin:A,tooltip:K,plotLabel:h,formatValue:F,formatX:H,onCandleClick:I})})}0&&(module.exports={CandlestickChart});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{memo as
|
|
1
|
+
"use client";import{memo as ie,useCallback as ee,useId as se,useMemo as H,useState as ce}from"react";import{useUILabels as le,useUILocale as he}from"../../lib/i18n.js";import{ChartAxis as oe}from"../chart/ChartAxis.js";import{ChartContainer as ue}from"../chart/ChartContainer.js";import{ChartGrid as ge}from"../chart/ChartGrid.js";import{ChartLegend as de}from"../chart/ChartLegend.js";import{ChartPlotClip as me,isOnPlot as fe,plotClipId as pe}from"../chart/ChartPlotClip.js";import{ChartTableView as be}from"../chart/ChartTableView.js";import{ChartTooltip as ye}from"../chart/ChartTooltip.js";import{CHART_DOWN_COLOR as Ce,CHART_UP_COLOR as ke}from"../chart/palette.js";import{annotationValues as we,buildCartesianGeometry as xe,widenBounds as ve}from"../chart/utils/cartesian.js";import{readNumber as j,readXValue as Le}from"../chart/utils/data.js";import{formatAuto as Pe,formatXValue as Re}from"../chart/utils/format.js";import{handleChartKeyDown as Ne}from"../chart/utils/keyboard.js";import{buildBarPath as Se}from"../chart/utils/path.js";import{nearestIndex as Ie}from"../chart/utils/scales.js";import{extent as He}from"../chart/utils/ticks.js";import{CHART_TOUCH as Te}from"../chart/utils/touch.js";import{Fragment as We,jsx as n,jsxs as b}from"react/jsx-runtime";var Ve=16,Xe=1.5,Me=ie(function({candles:a,clipId:g}){return n("g",{clipPath:`url(#${g})`,children:a.map(t=>b("g",{children:[t.wick?n("line",{x1:t.wick.x,y1:t.wick.y1,x2:t.wick.x,y2:t.wick.y2,stroke:t.color,strokeWidth:1.5}):null,t.body?n("path",{d:t.body,fill:t.hollow?"none":t.color,stroke:t.color,strokeWidth:t.hollow?1.5:0}):null]},t.key))})});function Ae({width:u,height:a,data:g,candles:t,x:d,y,grid:v,size:D,candleSize:$,fillRising:L,palette:T,referenceLines:P,margin:z,tooltip:m,plotLabel:Z,formatValue:f,formatX:E,onCandleClick:C,locale:R}){let[V,N]=ce(null),s=V!==null&&V<t.length?V:null,k=le(),G=pe(se()),e=H(()=>{let r=t.flatMap(l=>l.high===null||l.low===null?[]:[l.low,l.high]),o=xe({locale:R,width:u,height:a,data:g,x:d,y,bounds:ve(He(r),we(g,d.key,P,void 0)),margin:z,orientation:"vertical",placement:"band",formatValue:f,formatX:E,defaultIncludeZero:!1}),{valueScale:p,bandwidth:M,categoryPositions:A,innerWidth:_,innerHeight:K}=o,S=Math.min($??Ve,Math.max(1,M-2));return{rendered:t.map((l,w)=>{let c=A[w]+(M-S)/2,B=c+S/2,I=l.rising?T.up:T.down,Y=l.high===null||l.low===null?null:{x:B,y1:p(l.high),y2:p(l.low)},x=null;if(l.open!==null&&l.close!==null){let U=p(l.open),F=p(l.close);x=Se({x:c,y:Math.min(U,F),width:S,height:Math.max(Xe,Math.abs(F-U)),radius:0,round:"none"})}return{key:`${w}`,color:I,body:x,hollow:l.rising&&!L,wick:Y,left:c,width:S}}),categoryPositions:A,categoryCenters:o.categoryCenters,bandwidth:M,categoryTicks:o.categoryTicks,valueTicks:o.valueTicks,valueScale:p,innerWidth:_,innerHeight:K,margin:o.margin}},[R,t,g,d,y,u,a,z,$,L,T,P,f,E]),q=ee(r=>{if(m===!1||t.length===0)return;let o=r.currentTarget.getBoundingClientRect(),p=r.clientX-o.left-e.margin.left;N(Ie(e.categoryCenters,p))},[m,t.length,e.margin.left,e.categoryCenters]),X=ee(()=>{!C||s===null||C(t[s])},[C,s,t]),J=ee(r=>Ne(r,{count:t.length,current:s,axis:"x",onMove:N,pick:C?X:null}),[t.length,s,C,X]),i=s===null?null:t[s];return b(We,{children:[b("svg",{width:u,height:a,role:"img","aria-label":Z??t.map(r=>r.label).join(", "),tabIndex:0,className:`${Te} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500`,onPointerMove:q,onPointerLeave:()=>N(null),onKeyDown:J,onBlur:()=>N(null),onClick:X,children:[b("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[n(me,{id:G,width:e.innerWidth,height:e.innerHeight,bleed:1}),n(ge,{width:e.innerWidth,height:e.innerHeight,horizontal:v==="y"||v==="both"?e.valueTicks.map(r=>r.offset):void 0}),s!==null?n("rect",{x:e.categoryPositions[s],y:0,width:e.bandwidth,height:e.innerHeight,className:"fill-gray-400 dark:fill-gray-500",opacity:.12,"aria-hidden":"true"}):null,P?.map(r=>{let o=e.valueScale(r.value);return fe(o,e.innerHeight)?b("g",{children:[n("line",{x1:0,y1:o,x2:e.innerWidth,y2:o,stroke:r.color??"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:r.dashed===!1?void 0:"4 4"}),r.label?n("text",{x:e.innerWidth,y:o-4,textAnchor:"end",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:r.label}):null]},`${r.value}-${r.label??""}`):null}),n(Me,{candles:e.rendered,clipId:G})]}),n("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:d.hidden?null:n(oe,{orientation:"bottom",ticks:e.categoryTicks,length:e.innerWidth,label:d.label,size:D})}),n("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:y?.hidden?null:n(oe,{orientation:"left",ticks:e.valueTicks,length:e.innerHeight,showLine:!1,label:y?.label,size:D})})]}),i&&s!==null&&m!==!1?n(ye,{x:e.margin.left+e.categoryCenters[s],y:e.margin.top+(i.high===null?e.innerHeight/2:e.valueScale(i.high)),containerWidth:u,children:typeof m=="function"?m(i):b("div",{className:"flex flex-col gap-1",children:[n("div",{className:"font-medium text-gray-900 dark:text-gray-100",children:i.label}),n("dl",{className:"grid grid-cols-[auto_auto] gap-x-3 gap-y-0.5",children:[[k.chartOpen,i.open],[k.chartHigh,i.high],[k.chartLow,i.low],[k.chartClose,i.close]].map(([r,o])=>b("div",{className:"contents",children:[n("dt",{className:"text-gray-500 dark:text-gray-400",children:r}),n("dd",{className:"justify-self-end font-medium text-gray-900 [font-variant-numeric:tabular-nums] dark:text-gray-100",children:o===null?"\u2014":f(o)})]},r))}),i.change===null?null:b("div",{className:"flex items-center gap-2 border-t border-gray-200 pt-1 dark:border-gray-700",children:[n("span",{className:"text-gray-500 dark:text-gray-400",children:i.rising?k.chartRise:k.chartFall}),b("span",{className:"[font-variant-numeric:tabular-nums] font-semibold text-gray-900 dark:text-gray-100",children:[i.change>0?"+":"",f(i.change)]})]})]})}):null]})}function tt({data:u,x:a,y:g,open:t,high:d,low:y,close:v,candleSize:D,fillRising:$=!1,colors:L,referenceLines:T,height:P=300,width:z,size:m="md",grid:Z="y",legend:f,tooltip:E=!0,tableView:C=!1,title:R,description:V,loading:N=!1,emptyState:s,error:k=!1,errorState:G,onRetry:e,actions:q,margin:X,locale:J,plotLabel:i,openLabel:r,highLabel:o,lowLabel:p,closeLabel:M,riseLabel:A,fallLabel:_,format:K,onCandleClick:S,className:te,...l}){let w=he(J),c=le(),B=H(()=>g?.format??K??(h=>Pe(h,w)),[g?.format,K,w]),I=H(()=>a.format??(h=>Re(h,w)),[a.format,w]),Y=H(()=>u.map((h,Q)=>{let ae=Le(h,a.key,Q),W=j(h,t),O=j(h,v);return{index:Q,x:ae,label:I(ae,Q),open:W,high:j(h,d),low:j(h,y),close:O,change:W===null||O===null?null:O-W,rising:W===null||O===null?!0:O>=W,datum:h}}),[u,a.key,t,d,y,v,I]),x=H(()=>({up:L?.up??ke,down:L?.down??Ce}),[L]),U=H(()=>[{key:"up",label:A??c.chartRise,color:x.up,marker:"rect"},{key:"down",label:_??c.chartFall,color:x.down,marker:"rect"}],[x,A,_,c.chartRise,c.chartFall]),F=f===void 0?!0:f!==!1,re=typeof f=="string"?f:"bottom",ne=[{key:t,label:r??c.chartOpen},{key:d,label:o??c.chartHigh},{key:y,label:p??c.chartLow},{key:v,label:M??c.chartClose}];return n(ue,{title:R,description:V,height:P,width:z,size:m,loading:N,empty:Y.length===0,emptyState:s,error:k,errorState:G,onRetry:e,actions:q,exportSource:{data:u,series:ne,xKey:a.key,xLabel:a.label??a.key,formatX:a.format},tableView:C,legendPosition:re,legend:F?n(de,{items:U,position:re,marker:"rect",size:m}):void 0,table:C?n(be,{data:u,series:ne,xKey:a.key,xLabel:a.label??a.key,formatX:I,formatValue:B,caption:typeof R=="string"?R:void 0}):void 0,className:te,...l,children:({width:h})=>n(Ae,{locale:w,width:h,height:P,data:u,candles:Y,x:a,y:g,grid:Z,size:m,candleSize:D,fillRising:$,palette:x,referenceLines:T,margin:X,tooltip:E,plotLabel:i,formatValue:B,formatX:I,onCandleClick:S})})}export{tt as CandlestickChart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var s=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var k=(e,r)=>{for(var a in r)s(e,a,{get:r[a],enumerable:!0})},N=(e,r,a,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of y(r))!R.call(e,n)&&n!==a&&s(e,n,{get:()=>r[n],enumerable:!(t=P(r,n))||t.enumerable});return e};var z=e=>N(s({},"__esModule",{value:!0}),e);var q={};k(q,{Card:()=>i});module.exports=z(q);var o=require("../../lib/cn.cjs"),u=require("react/jsx-runtime");function B(e,r,a){let t=a||"bg-white dark:bg-gray-800",n=r||"border-gray-200 dark:border-gray-700";switch(e){case"outlined":return(0,o.cn)("border-2 bg-transparent",n);case"elevated":return(0,o.cn)("shadow-lg border-0",t);case"filled":return(0,o.cn)(a||"bg-gray-100 dark:bg-gray-700","border-0");default:return(0,o.cn)("border",n,t)}}function W(e){switch(e){case"sm":return"max-w-sm";case"lg":return"max-w-2xl";default:return"max-w-md"}}function S(e){switch(e){case"none":return"rounded-none";case"sm":return"rounded-sm";case"md":return"rounded-md";case"xl":return"rounded-xl";case"full":return"rounded-3xl";default:return"rounded-lg"}}function V(e){switch(e){case"none":return"";case"sm":return"p-2";case"lg":return"p-6";default:return""}}function i({variant:e="default",size:r="md",rounded:a="lg",padding:t="none",bgColor:n,borderColor:c,shadowColor:g,hoverable:m=!1,clickable:d=!1,as:f="div",className:p,children:C,onClick:l,...h}){let b=f,v=m?"transition-all duration-200 hover:shadow-lg hover:-translate-y-0.5":"",w=d?"cursor-pointer active:scale-[0.98] transition-transform":"",x=g||"";return(0,u.jsx)(b,{className:(0,o.cn)("overflow-hidden",B(e,c,n),W(r),S(a),V(t),v,w,x,p),onClick:d||l?l:void 0,...h,children:C})}i.displayName="Card";0&&(module.exports={Card});
|
|
1
|
+
"use strict";var s=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var k=(e,r)=>{for(var a in r)s(e,a,{get:r[a],enumerable:!0})},N=(e,r,a,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of y(r))!R.call(e,n)&&n!==a&&s(e,n,{get:()=>r[n],enumerable:!(t=P(r,n))||t.enumerable});return e};var z=e=>N(s({},"__esModule",{value:!0}),e);var q={};k(q,{Card:()=>i});module.exports=z(q);var o=require("../../lib/cn.cjs"),u=require("react/jsx-runtime");function B(e,r,a){let t=a||"bg-white dark:bg-gray-800",n=r||"border-gray-200 dark:border-gray-700";switch(e){case"outlined":return(0,o.cn)("border-2 bg-transparent",n);case"elevated":return(0,o.cn)("shadow-lg border-0",t);case"filled":return(0,o.cn)(a||"bg-gray-100 dark:bg-gray-700","border-0");default:return(0,o.cn)("border",n,t)}}function W(e){switch(e){case"sm":return"max-w-sm";case"lg":return"max-w-2xl";default:return"max-w-md"}}function S(e){switch(e){case"none":return"rounded-none";case"sm":return"rounded-sm";case"md":return"rounded-md";case"xl":return"rounded-xl";case"full":return"rounded-3xl";default:return"rounded-lg"}}function V(e){switch(e){case"none":return"";case"sm":return"p-2";case"md":return"p-4";case"lg":return"p-6";default:return""}}function i({variant:e="default",size:r="md",rounded:a="lg",padding:t="none",bgColor:n,borderColor:c,shadowColor:g,hoverable:m=!1,clickable:d=!1,as:f="div",className:p,children:C,onClick:l,...h}){let b=f,v=m?"transition-all duration-200 hover:shadow-lg hover:-translate-y-0.5":"",w=d?"cursor-pointer active:scale-[0.98] transition-transform":"",x=g||"";return(0,u.jsx)(b,{className:(0,o.cn)("overflow-hidden",B(e,c,n),W(r),S(a),V(t),v,w,x,p),onClick:d||l?l:void 0,...h,children:C})}i.displayName="Card";0&&(module.exports={Card});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cn as r}from"../../lib/cn.js";import{jsx as R}from"react/jsx-runtime";function v(e,o,n){let a=n||"bg-white dark:bg-gray-800",t=o||"border-gray-200 dark:border-gray-700";switch(e){case"outlined":return r("border-2 bg-transparent",t);case"elevated":return r("shadow-lg border-0",a);case"filled":return r(n||"bg-gray-100 dark:bg-gray-700","border-0");default:return r("border",t,a)}}function w(e){switch(e){case"sm":return"max-w-sm";case"lg":return"max-w-2xl";default:return"max-w-md"}}function x(e){switch(e){case"none":return"rounded-none";case"sm":return"rounded-sm";case"md":return"rounded-md";case"xl":return"rounded-xl";case"full":return"rounded-3xl";default:return"rounded-lg"}}function P(e){switch(e){case"none":return"";case"sm":return"p-2";case"lg":return"p-6";default:return""}}function y({variant:e="default",size:o="md",rounded:n="lg",padding:a="none",bgColor:t,borderColor:l,shadowColor:i,hoverable:u=!1,clickable:s=!1,as:c="div",className:g,children:m,onClick:d,...f}){let p=c,C=u?"transition-all duration-200 hover:shadow-lg hover:-translate-y-0.5":"",h=s?"cursor-pointer active:scale-[0.98] transition-transform":"",b=i||"";return R(p,{className:r("overflow-hidden",v(e,l,t),w(o),x(n),P(a),C,h,b,g),onClick:s||d?d:void 0,...f,children:m})}y.displayName="Card";export{y as Card};
|
|
1
|
+
import{cn as r}from"../../lib/cn.js";import{jsx as R}from"react/jsx-runtime";function v(e,o,n){let a=n||"bg-white dark:bg-gray-800",t=o||"border-gray-200 dark:border-gray-700";switch(e){case"outlined":return r("border-2 bg-transparent",t);case"elevated":return r("shadow-lg border-0",a);case"filled":return r(n||"bg-gray-100 dark:bg-gray-700","border-0");default:return r("border",t,a)}}function w(e){switch(e){case"sm":return"max-w-sm";case"lg":return"max-w-2xl";default:return"max-w-md"}}function x(e){switch(e){case"none":return"rounded-none";case"sm":return"rounded-sm";case"md":return"rounded-md";case"xl":return"rounded-xl";case"full":return"rounded-3xl";default:return"rounded-lg"}}function P(e){switch(e){case"none":return"";case"sm":return"p-2";case"md":return"p-4";case"lg":return"p-6";default:return""}}function y({variant:e="default",size:o="md",rounded:n="lg",padding:a="none",bgColor:t,borderColor:l,shadowColor:i,hoverable:u=!1,clickable:s=!1,as:c="div",className:g,children:m,onClick:d,...f}){let p=c,C=u?"transition-all duration-200 hover:shadow-lg hover:-translate-y-0.5":"",h=s?"cursor-pointer active:scale-[0.98] transition-transform":"",b=i||"";return R(p,{className:r("overflow-hidden",v(e,l,t),w(o),x(n),P(a),C,h,b,g),onClick:s||d?d:void 0,...f,children:m})}y.displayName="Card";export{y as Card};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var N=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var $=(t,r)=>{for(var e in r)N(t,e,{get:r[e],enumerable:!0})},w=(t,r,e,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of M(r))!D.call(t,l)&&l!==e&&N(t,l,{get:()=>r[l],enumerable:!(i=_(r,l))||i.enumerable});return t};var B=t=>w(N({},"__esModule",{value:!0}),t);var V={};$(V,{ChartAnnotationLayer:()=>G,describeAnnotations:()=>L});module.exports=B(V);var m=require("./utils/text.cjs"),n=require("react/jsx-runtime"),A=10,C=15,x=5,d=6,b=4,E=.1;function I({x:t,y:r,text:e,align:i}){let l=(0,m.estimateTextWidth)(e,A)+x*2,g=i==="start"?t:t-l;return(0,n.jsxs)("g",{children:[(0,n.jsx)("rect",{x:g,y:r,width:l,height:C,rx:3,className:"fill-white stroke-gray-200 dark:fill-gray-800 dark:stroke-gray-700",strokeWidth:1}),(0,n.jsx)("text",{x:g+x,y:r+C/2,dominantBaseline:"central",className:"fill-gray-600 text-[10px] dark:fill-gray-300",children:e})]})}function G({annotations:t,xAt:r,spanAt:e,yAt:i,width:l,height:g,bandwidth:T=0,layer:W="over"}){if(t.length===0)return null;if(W==="under"){let a=t.filter(s=>s.type==="band");return a.length===0?null:(0,n.jsx)("g",{"aria-hidden":"true",children:a.map((s,o)=>{let p=e??r,c=p(s.from),u=p(s.to);if(c===null||u===null)return null;let y=Math.max(0,Math.min(c,u)-T/2),f=Math.min(l,Math.max(c,u)+T/2)-y;if(f<=0)return null;let h=s.label??"",P=(0,m.estimateTextWidth)(h,A)+x*2;return(0,n.jsxs)("g",{children:[(0,n.jsx)("rect",{x:y,y:0,width:f,height:g,fill:s.color??"var(--color-chart-muted)",opacity:E}),h&&P<=f?(0,n.jsx)(I,{x:y+2,y:2,text:h,align:"start"}):null]},`band-${o}`)})})}let v=t.filter(a=>a.type!=="band");return v.length===0?null:(0,n.jsx)("g",{"aria-hidden":"true",children:v.map((a,s)=>{let o=r(a.x);if(o===null)return null;let p=a.color??"var(--color-chart-muted)";if(a.type==="line"){let h=a.label??"",P=(0,m.estimateTextWidth)(h,A)+x*2,O=o+d+P<=l?"start":"end";return(0,n.jsxs)("g",{children:[(0,n.jsx)("line",{x1:o,y1:0,x2:o,y2:g,stroke:p,strokeWidth:1,strokeDasharray:a.dashed===!1?void 0:"3 3"}),h?(0,n.jsx)(I,{x:O==="start"?o+d:o-d,y:2,text:h,align:O}):null]},`line-${s}`)}let c=i(a.y);if(!Number.isFinite(c))return null;let u=a.label??"",y=(0,m.estimateTextWidth)(u,A)+x*2,k=o+b+d+y<=l?"start":"end",f=Math.min(Math.max(0,c-C-d),g-C);return(0,n.jsxs)("g",{children:[(0,n.jsx)("circle",{cx:o,cy:c,r:b,fill:"none",stroke:p,strokeWidth:2}),u?(0,n.jsx)(I,{x:k==="start"?o+b+d:o-b-d,y:f,text:u,align:k}):null]},`point-${s}`)})})}function L(t,r){if(!t||t.length===0)return"";let e=t.map(i=>i.label).filter(i=>!!i);return e.length===0?"":`${r}: ${e.join(", ")}`}0&&(module.exports={ChartAnnotationLayer,describeAnnotations});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{estimateTextWidth as b}from"./utils/text.js";import{jsx as e,jsxs as C}from"react/jsx-runtime";var A=10,k=15,m=5,
|
|
1
|
+
import{estimateTextWidth as b}from"./utils/text.js";import{jsx as e,jsxs as C}from"react/jsx-runtime";var A=10,k=15,m=5,h=6,x=4,_=.1;function I({x:n,y:a,text:o,align:i}){let d=b(o,A)+m*2,g=i==="start"?n:n-d;return C("g",{children:[e("rect",{x:g,y:a,width:d,height:k,rx:3,className:"fill-white stroke-gray-200 dark:fill-gray-800 dark:stroke-gray-700",strokeWidth:1}),e("text",{x:g+m,y:a+k/2,dominantBaseline:"central",className:"fill-gray-600 text-[10px] dark:fill-gray-300",children:o})]})}function D({annotations:n,xAt:a,spanAt:o,yAt:i,width:d,height:g,bandwidth:T=0,layer:W="over"}){if(n.length===0)return null;if(W==="under"){let t=n.filter(l=>l.type==="band");return t.length===0?null:e("g",{"aria-hidden":"true",children:t.map((l,r)=>{let p=o??a,s=p(l.from),c=p(l.to);if(s===null||c===null)return null;let y=Math.max(0,Math.min(s,c)-T/2),f=Math.min(d,Math.max(s,c)+T/2)-y;if(f<=0)return null;let u=l.label??"",N=b(u,A)+m*2;return C("g",{children:[e("rect",{x:y,y:0,width:f,height:g,fill:l.color??"var(--color-chart-muted)",opacity:_}),u&&N<=f?e(I,{x:y+2,y:2,text:u,align:"start"}):null]},`band-${r}`)})})}let v=n.filter(t=>t.type!=="band");return v.length===0?null:e("g",{"aria-hidden":"true",children:v.map((t,l)=>{let r=a(t.x);if(r===null)return null;let p=t.color??"var(--color-chart-muted)";if(t.type==="line"){let u=t.label??"",N=b(u,A)+m*2,O=r+h+N<=d?"start":"end";return C("g",{children:[e("line",{x1:r,y1:0,x2:r,y2:g,stroke:p,strokeWidth:1,strokeDasharray:t.dashed===!1?void 0:"3 3"}),u?e(I,{x:O==="start"?r+h:r-h,y:2,text:u,align:O}):null]},`line-${l}`)}let s=i(t.y);if(!Number.isFinite(s))return null;let c=t.label??"",y=b(c,A)+m*2,P=r+x+h+y<=d?"start":"end",f=Math.min(Math.max(0,s-k-h),g-k);return C("g",{children:[e("circle",{cx:r,cy:s,r:x,fill:"none",stroke:p,strokeWidth:2}),c?e(I,{x:P==="start"?r+x+h:r-x-h,y:f,text:c,align:P}):null]},`point-${l}`)})})}function $(n,a){if(!n||n.length===0)return"";let o=n.map(i=>i.label).filter(i=>!!i);return o.length===0?"":`${a}: ${o.join(", ")}`}export{D as ChartAnnotationLayer,$ as describeAnnotations};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var V=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var O=(e,r)=>{for(var n in r)V(e,n,{get:r[n],enumerable:!0})},X=(e,r,n,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of T(r))!K.call(e,o)&&o!==n&&V(e,o,{get:()=>r[o],enumerable:!(l=M(r,o))||l.enumerable});return e};var N=e=>X(V({},"__esModule",{value:!0}),e);var q={};O(q,{ChartBrushLayer:()=>L,locateBrush:()=>_,useChartBrush:()=>W});module.exports=N(q);var c=require("react"),k=require("./utils/keyboard.cjs"),R=require("./utils/scales.cjs"),G=require("./utils/timestamp.cjs"),P=require("react/jsx-runtime"),U=4,Y=.14;function L({from:e,to:r,width:n,height:l,orientation:o="vertical",live:a=!1,label:s,minSpan:f=0}){let C=o==="vertical"?n:l,p=Math.min(e,r),m=Math.max(e,r);if(m-p<f){let h=(p+m)/2;p=h-f/2,m=h+f/2}let y=Math.max(0,p),g=Math.min(C,m),d=g-y;if(d<=0)return null;let b=o==="vertical",S=b?{x:y,y:0,width:d,height:l}:{x:0,y,width:n,height:d},B=h=>b?{x1:h,y1:0,x2:h,y2:l}:{x1:0,y1:h,x2:n,y2:h};return(0,P.jsxs)("g",{"aria-hidden":s?void 0:"true",role:s?"img":void 0,"aria-label":s,children:[(0,P.jsx)("rect",{...S,className:"fill-synertech-primary-500",opacity:Y}),[y,g].map(h=>(0,P.jsx)("line",{...B(h),className:"stroke-synertech-primary-600 dark:stroke-synertech-primary-400",strokeWidth:1.5,strokeDasharray:a?"3 3":void 0},h))]})}function _(e,r,n,l){let o=(f,C)=>f>=0&&f<r.length&&(0,R.toKey)(r[f])===(0,R.toKey)(C)?n[f]:null,a=o(e.fromIndex,e.from)??l(e.from),s=o(e.toIndex,e.to)??l(e.to);return a===null||s===null?null:{from:a,to:s}}function F(e,r){let n=r-e;if(!(n>0))return Number.NaN;let o=n/864e5,a=new Date(r),s=o>=28&&o<=31?1:o>=89&&o<=92?3:0;return s>0?(a.setMonth(a.getMonth()+s),a.getTime()):o>=365&&o<=366?(a.setFullYear(a.getFullYear()+1),a.getTime()):r+n}function H(e,r){let n=(0,G.toTimestamp)(e[r]);if(n===null)return;if(r+1<e.length)return(0,G.toTimestamp)(e[r+1])===null?void 0:e[r+1];if(r<1)return;let l=(0,G.toTimestamp)(e[r-1]);if(l===null)return;let o=F(l,n);return Number.isFinite(o)?new Date(o):void 0}function W({enabled:e,active:r,centers:n,xValues:l,offset:o,orientation:a,onCommit:s}){let[f,C]=(0,c.useState)(null),p=(0,c.useRef)(null),m=(0,c.useRef)(!1),y=(0,c.useRef)(!1),g=(0,c.useRef)(null),d=(0,c.useCallback)((t,u)=>{let[i,E]=t<=u?[t,u]:[u,t],v=H(l,E);return{from:l[i],to:l[E],fromIndex:i,toIndex:E,...v===void 0?{}:{end:v}}},[l]),b=(0,c.useCallback)(t=>{let u=t.currentTarget.getBoundingClientRect();return a==="vertical"?t.clientX-u.left-o:t.clientY-u.top-o},[a,o]),S=(0,c.useCallback)(t=>{if(!e||n.length===0||t.button!==0)return;let u=b(t),i=(0,R.nearestIndex)(n,u);i<0||(p.current={index:i,pixel:u},m.current=!1,y.current=!1,t.currentTarget.setPointerCapture?.(t.pointerId))},[e,n,b]),B=(0,c.useCallback)(t=>{let u=p.current;if(!e||!u)return;let i=b(t);!m.current&&Math.abs(i-u.pixel)<U||(m.current=!0,C(d(u.index,(0,R.nearestIndex)(n,i))))},[e,n,b,d]),h=(0,c.useCallback)(t=>{let u=p.current;if(p.current=null,!e||!u)return;if(t.currentTarget.hasPointerCapture?.(t.pointerId)&&t.currentTarget.releasePointerCapture?.(t.pointerId),!m.current){C(null),r&&s(null);return}y.current=!0,m.current=!1;let i=d(u.index,(0,R.nearestIndex)(n,b(t)));C(null),g.current=i.fromIndex,s(i)},[e,r,n,b,d,s]),D=(0,c.useCallback)((t,u)=>{if(!e||n.length===0)return!1;if(t.key==="Escape"){g.current=null;let I=r||f!==null;return C(null),r&&s(null),I}if(!t.shiftKey)return g.current=null,!1;let i=a==="vertical",E=i?"ArrowRight":"ArrowDown",v=i?"ArrowLeft":"ArrowUp";if(t.key!==E&&t.key!==v)return!1;if(u===null)return g.current=null,!1;let A=(0,k.stepChartCursor)(u,t.key===E?1:-1,n.length),w=g.current??u;return g.current=w,s(d(w,A)),!1},[e,r,f,n.length,a,d,s]),x=(0,c.useCallback)(()=>{let t=y.current;return y.current=!1,t},[]);return{dragging:f,onPointerDown:S,onPointerMove:B,onPointerUp:h,onKeyDown:D,consumedClick:x}}0&&(module.exports={ChartBrushLayer,locateBrush,useChartBrush});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useCallback as
|
|
1
|
+
"use client";import{useCallback as C,useRef as P,useState as M}from"react";import{stepChartCursor as T}from"./utils/keyboard.js";import{nearestIndex as S,toKey as w}from"./utils/scales.js";import{toTimestamp as B}from"./utils/timestamp.js";import{jsx as k,jsxs as U}from"react/jsx-runtime";var K=4,O=.14;function H({from:r,to:t,width:n,height:s,orientation:u="vertical",live:l=!1,label:a,minSpan:i=0}){let b=u==="vertical"?n:s,d=Math.min(r,t),h=Math.max(r,t);if(h-d<i){let f=(d+h)/2;d=f-i/2,h=f+i/2}let p=Math.max(0,d),y=Math.min(b,h),m=y-p;if(m<=0)return null;let g=u==="vertical",v=g?{x:p,y:0,width:m,height:s}:{x:0,y:p,width:n,height:m},G=f=>g?{x1:f,y1:0,x2:f,y2:s}:{x1:0,y1:f,x2:n,y2:f};return U("g",{"aria-hidden":a?void 0:"true",role:a?"img":void 0,"aria-label":a,children:[k("rect",{...v,className:"fill-synertech-primary-500",opacity:O}),[p,y].map(f=>k("line",{...G(f),className:"stroke-synertech-primary-600 dark:stroke-synertech-primary-400",strokeWidth:1.5,strokeDasharray:l?"3 3":void 0},f))]})}function W(r,t,n,s){let u=(i,b)=>i>=0&&i<t.length&&w(t[i])===w(b)?n[i]:null,l=u(r.fromIndex,r.from)??s(r.from),a=u(r.toIndex,r.to)??s(r.to);return l===null||a===null?null:{from:l,to:a}}function X(r,t){let n=t-r;if(!(n>0))return Number.NaN;let u=n/864e5,l=new Date(t),a=u>=28&&u<=31?1:u>=89&&u<=92?3:0;return a>0?(l.setMonth(l.getMonth()+a),l.getTime()):u>=365&&u<=366?(l.setFullYear(l.getFullYear()+1),l.getTime()):t+n}function N(r,t){let n=B(r[t]);if(n===null)return;if(t+1<r.length)return B(r[t+1])===null?void 0:r[t+1];if(t<1)return;let s=B(r[t-1]);if(s===null)return;let u=X(s,n);return Number.isFinite(u)?new Date(u):void 0}function q({enabled:r,active:t,centers:n,xValues:s,offset:u,orientation:l,onCommit:a}){let[i,b]=M(null),d=P(null),h=P(!1),p=P(!1),y=P(null),m=C((e,o)=>{let[c,R]=e<=o?[e,o]:[o,e],E=N(s,R);return{from:s[c],to:s[R],fromIndex:c,toIndex:R,...E===void 0?{}:{end:E}}},[s]),g=C(e=>{let o=e.currentTarget.getBoundingClientRect();return l==="vertical"?e.clientX-o.left-u:e.clientY-o.top-u},[l,u]),v=C(e=>{if(!r||n.length===0||e.button!==0)return;let o=g(e),c=S(n,o);c<0||(d.current={index:c,pixel:o},h.current=!1,p.current=!1,e.currentTarget.setPointerCapture?.(e.pointerId))},[r,n,g]),G=C(e=>{let o=d.current;if(!r||!o)return;let c=g(e);!h.current&&Math.abs(c-o.pixel)<K||(h.current=!0,b(m(o.index,S(n,c))))},[r,n,g,m]),f=C(e=>{let o=d.current;if(d.current=null,!r||!o)return;if(e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId),!h.current){b(null),t&&a(null);return}p.current=!0,h.current=!1;let c=m(o.index,S(n,g(e)));b(null),y.current=c.fromIndex,a(c)},[r,t,n,g,m,a]),D=C((e,o)=>{if(!r||n.length===0)return!1;if(e.key==="Escape"){y.current=null;let I=t||i!==null;return b(null),t&&a(null),I}if(!e.shiftKey)return y.current=null,!1;let c=l==="vertical",R=c?"ArrowRight":"ArrowDown",E=c?"ArrowLeft":"ArrowUp";if(e.key!==R&&e.key!==E)return!1;if(o===null)return y.current=null,!1;let A=T(o,e.key===R?1:-1,n.length),V=y.current??o;return y.current=V,a(m(V,A)),!1},[r,t,i,n.length,l,m,a]),x=C(()=>{let e=p.current;return p.current=!1,e},[]);return{dragging:i,onPointerDown:v,onPointerMove:G,onPointerUp:f,onKeyDown:D,consumedClick:x}}export{H as ChartBrushLayer,W as locateBrush,q as useChartBrush};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var x=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var Y=Object.prototype.hasOwnProperty;var _=(r,t)=>{for(var a in t)x(r,a,{get:t[a],enumerable:!0})},ee=(r,t,a,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of X(t))!Y.call(r,o)&&o!==a&&x(r,o,{get:()=>t[o],enumerable:!(l=Q(t,o))||l.enumerable});return r};var te=r=>ee(x({},"__esModule",{value:!0}),r);var se={};_(se,{ChartContainer:()=>oe});module.exports=te(se);var c=require("react"),d=require("../../lib/cn.cjs"),P=require("../../lib/i18n.cjs"),I=require("../circular-progress/CircularProgress.cjs"),T=require("./exportSource.cjs"),z=require("./useChartSize.cjs"),e=require("react/jsx-runtime"),re=(0,e.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",className:"text-red-600 dark:text-red-400",children:[(0,e.jsx)("path",{d:"M10 3.5 2.5 16.5h15L10 3.5Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"}),(0,e.jsx)("path",{d:"M10 8v3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"10",cy:"14",r:"0.9",fill:"currentColor"})]}),ae={sm:"text-xs",md:"text-sm",lg:"text-base"};function oe({title:r,description:t,height:a=240,width:l,size:o="md",legend:i,legendPosition:u="bottom",actions:g,exportSource:A,loading:n=!1,empty:y=!1,emptyState:j,error:f=!1,errorState:H,onRetry:v,errorLabel:W,errorHintLabel:B,retryLabel:D,table:m,tableView:C=!1,showTableLabel:M,hideTableLabel:O,noDataLabel:$,loadingLabel:U,ariaLabel:w,children:h,className:V,...Z}){let s=(0,P.useUILabels)(),[p,q]=(0,c.useState)(!1),b=(0,c.useId)(),N=`${b}-table`,k=`${b}-title`,L=`${b}-description`,{ref:F,width:G,measured:J}=(0,z.useChartSize)({width:l}),R=!!m&&C==="toggle",S=!!m&&(C===!0||R&&p),E=(0,e.jsx)("div",{ref:F,className:"relative w-full",style:{height:a},"aria-busy":n||void 0,children:n&&(y||f)?(0,e.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,e.jsx)(I.CircularProgress,{indeterminate:!0,size:"md","aria-label":U??s.chartLoading})}):f&&!n?(0,e.jsx)("div",{role:"alert",className:"flex h-full w-full flex-col items-center justify-center gap-2 px-4 text-center",children:H??(0,e.jsxs)(e.Fragment,{children:[re,(0,e.jsx)("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:W??s.chartError}),(0,e.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:B??s.chartErrorHint}),v?(0,e.jsx)("button",{type:"button",onClick:v,className:"mt-1 cursor-pointer rounded-md border border-gray-300 bg-white px-3 py-1.5 text-xs font-medium text-gray-700 transition-colors hover:bg-gray-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",children:D??s.chartRetry}):null]})}):y&&!n&&!f?(0,e.jsx)("div",{className:"flex h-full w-full items-center justify-center text-sm text-gray-500 dark:text-gray-400",children:j??$??s.chartNoData}):(0,e.jsx)("div",{className:(0,d.cn)("h-full w-full transition-opacity duration-200",n&&"opacity-60"),children:typeof h=="function"?h({width:G,height:a,measured:J}):h})});return(0,e.jsxs)("figure",{className:(0,d.cn)("flex w-full flex-col gap-3",V),"aria-label":w,"aria-labelledby":!w&&r?k:void 0,"aria-describedby":t?L:void 0,...Z,children:[r||t||g?(0,e.jsxs)("figcaption",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-0.5",children:[r?(0,e.jsx)("span",{id:k,className:(0,d.cn)("font-semibold text-gray-900 dark:text-gray-100",ae[o]),children:r}):null,t?(0,e.jsx)("span",{id:L,className:"text-xs text-gray-500 dark:text-gray-400",children:t}):null]}),(0,e.jsx)(T.ChartExportContext.Provider,{value:A??null,children:g})]}):null,i&&u==="top"?i:null,i&&u==="right"?(0,e.jsxs)("div",{className:"flex items-start gap-4",children:[(0,e.jsx)("div",{className:"min-w-0 grow",children:E}),i]}):E,i&&u==="bottom"?i:null,R&&(0,e.jsx)("div",{className:"flex",children:(0,e.jsx)("button",{type:"button",onClick:()=>q(K=>!K),"aria-expanded":p,"aria-controls":S?N:void 0,className:"cursor-pointer rounded-sm text-xs font-medium text-gray-600 underline underline-offset-2 hover:text-gray-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500 dark:text-gray-400 dark:hover:text-white",children:p?O??s.chartHideTable:M??s.chartShowTable})}),S&&(0,e.jsx)("div",{id:N,children:m})]})}0&&(module.exports={ChartContainer});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useId as
|
|
1
|
+
"use client";import{useId as q,useState as F}from"react";import{cn as m}from"../../lib/cn.js";import{useUILabels as G}from"../../lib/i18n.js";import{CircularProgress as J}from"../circular-progress/CircularProgress.js";import{ChartExportContext as K}from"./exportSource.js";import{useChartSize as Q}from"./useChartSize.js";import{Fragment as _,jsx as e,jsxs as a}from"react/jsx-runtime";var X=a("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",className:"text-red-600 dark:text-red-400",children:[e("path",{d:"M10 3.5 2.5 16.5h15L10 3.5Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"}),e("path",{d:"M10 8v3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e("circle",{cx:"10",cy:"14",r:"0.9",fill:"currentColor"})]}),Y={sm:"text-xs",md:"text-sm",lg:"text-base"};function de({title:s,description:i,height:h=240,width:R,size:S="md",legend:r,legendPosition:n="bottom",actions:p,exportSource:E,loading:o=!1,empty:b=!1,emptyState:P,error:l=!1,errorState:I,onRetry:x,errorLabel:T,errorHintLabel:z,retryLabel:A,table:d,tableView:g=!1,showTableLabel:j,hideTableLabel:H,noDataLabel:W,loadingLabel:B,ariaLabel:y,children:c,className:D,...M}){let t=G(),[u,O]=F(!1),f=q(),v=`${f}-table`,C=`${f}-title`,w=`${f}-description`,{ref:$,width:U,measured:V}=Q({width:R}),N=!!d&&g==="toggle",k=!!d&&(g===!0||N&&u),L=e("div",{ref:$,className:"relative w-full",style:{height:h},"aria-busy":o||void 0,children:o&&(b||l)?e("div",{className:"flex h-full w-full items-center justify-center",children:e(J,{indeterminate:!0,size:"md","aria-label":B??t.chartLoading})}):l&&!o?e("div",{role:"alert",className:"flex h-full w-full flex-col items-center justify-center gap-2 px-4 text-center",children:I??a(_,{children:[X,e("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:T??t.chartError}),e("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:z??t.chartErrorHint}),x?e("button",{type:"button",onClick:x,className:"mt-1 cursor-pointer rounded-md border border-gray-300 bg-white px-3 py-1.5 text-xs font-medium text-gray-700 transition-colors hover:bg-gray-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",children:A??t.chartRetry}):null]})}):b&&!o&&!l?e("div",{className:"flex h-full w-full items-center justify-center text-sm text-gray-500 dark:text-gray-400",children:P??W??t.chartNoData}):e("div",{className:m("h-full w-full transition-opacity duration-200",o&&"opacity-60"),children:typeof c=="function"?c({width:U,height:h,measured:V}):c})});return a("figure",{className:m("flex w-full flex-col gap-3",D),"aria-label":y,"aria-labelledby":!y&&s?C:void 0,"aria-describedby":i?w:void 0,...M,children:[s||i||p?a("figcaption",{className:"flex items-start justify-between gap-3",children:[a("div",{className:"flex flex-col gap-0.5",children:[s?e("span",{id:C,className:m("font-semibold text-gray-900 dark:text-gray-100",Y[S]),children:s}):null,i?e("span",{id:w,className:"text-xs text-gray-500 dark:text-gray-400",children:i}):null]}),e(K.Provider,{value:E??null,children:p})]}):null,r&&n==="top"?r:null,r&&n==="right"?a("div",{className:"flex items-start gap-4",children:[e("div",{className:"min-w-0 grow",children:L}),r]}):L,r&&n==="bottom"?r:null,N&&e("div",{className:"flex",children:e("button",{type:"button",onClick:()=>O(Z=>!Z),"aria-expanded":u,"aria-controls":k?v:void 0,className:"cursor-pointer rounded-sm text-xs font-medium text-gray-600 underline underline-offset-2 hover:text-gray-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500 dark:text-gray-400 dark:hover:text-white",children:u?H??t.chartHideTable:j??t.chartShowTable})}),k&&e("div",{id:v,children:d})]})}export{de as ChartContainer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var m=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var U=(e,t)=>{for(var s in t)m(e,s,{get:t[s],enumerable:!0})},W=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of J(t))!R.call(e,n)&&n!==s&&m(e,n,{get:()=>t[n],enumerable:!(i=j(t,n))||i.enumerable});return e};var q=e=>W(m({},"__esModule",{value:!0}),e);var H={};U(H,{ChartExportButton:()=>G});module.exports=q(H);var L=require("react"),F=require("../../lib/cn.cjs"),S=require("../../lib/i18n.cjs"),B=require("../dropdown/Dropdown.cjs"),I=require("../dropdown/DropdownContent.cjs"),N=require("../dropdown/DropdownItem.cjs"),O=require("../dropdown/DropdownTrigger.cjs"),z=require("./exportSource.cjs"),P=require("./utils/export.cjs"),o=require("react/jsx-runtime"),A={sm:"h-7 px-2.5 text-xs",md:"h-8 px-3 text-sm",lg:"h-10 px-4 text-sm"},D=(0,o.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0",children:(0,o.jsx)("path",{d:"M8 2v8m0 0 3-3m-3 3L5 7M2.5 12.5h11",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})});function G({data:e,series:t,xKey:s,xLabel:i,formatX:n,neutralizeFormulas:g,formats:c=["csv","json"],filename:x="chart",size:K="md",label:M,onExport:d,className:T,disabled:u}){let l=(0,S.useUILabels)(),a=(0,z.useChartExportSource)(),h=e??a?.data??[],f=t??a?.series??[],p=s??a?.xKey,b=i??a?.xLabel,C=n??a?.formatX,y=(0,L.useCallback)(r=>{if(p===void 0)return;let k={data:h,series:f,xKey:p,xLabel:b,formatX:C,neutralizeFormulas:g};d?d(r,k):(0,P.downloadChartData)(r,k,x)},[h,f,p,b,C,g,d,x]),w=h.length===0||p===void 0,E=M??l.chartExport,X=r=>r==="csv"?l.chartExportCsv:l.chartExportJson,v=(0,F.cn)("inline-flex cursor-pointer items-center gap-2 rounded-full border border-gray-300 bg-white font-medium text-gray-700 transition-colors hover:bg-gray-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",A[K],T);if(c.length<=1){let r=c[0]??"csv";return(0,o.jsxs)("button",{type:"button",onClick:()=>y(r),disabled:u||w,className:v,children:[D,(0,o.jsx)("span",{children:E})]})}return(0,o.jsxs)(B.Dropdown,{children:[(0,o.jsxs)(O.DropdownTrigger,{disabled:u||w,className:v,children:[D,(0,o.jsx)("span",{children:E})]}),(0,o.jsx)(I.DropdownContent,{children:c.map(r=>(0,o.jsx)(N.DropdownItem,{onSelect:()=>y(r),children:X(r)},r))})]})}0&&(module.exports={ChartExportButton});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useCallback as
|
|
1
|
+
"use client";import{useCallback as I}from"react";import{cn as N}from"../../lib/cn.js";import{useUILabels as O}from"../../lib/i18n.js";import{Dropdown as z}from"../dropdown/Dropdown.js";import{DropdownContent as P}from"../dropdown/DropdownContent.js";import{DropdownItem as K}from"../dropdown/DropdownItem.js";import{DropdownTrigger as M}from"../dropdown/DropdownTrigger.js";import{useChartExportSource as T}from"./exportSource.js";import{downloadChartData as X}from"./utils/export.js";import{jsx as o,jsxs as p}from"react/jsx-runtime";var j={sm:"h-7 px-2.5 text-xs",md:"h-8 px-3 text-sm",lg:"h-10 px-4 text-sm"},y=o("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0",children:o("path",{d:"M8 2v8m0 0 3-3m-3 3L5 7M2.5 12.5h11",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})});function V({data:w,series:E,xKey:v,xLabel:k,formatX:D,neutralizeFormulas:c,formats:n=["csv","json"],filename:d="chart",size:L="md",label:F,onExport:s,className:S,disabled:l}){let a=O(),r=T(),i=w??r?.data??[],h=E??r?.series??[],e=v??r?.xKey,m=k??r?.xLabel,g=D??r?.formatX,x=I(t=>{if(e===void 0)return;let C={data:i,series:h,xKey:e,xLabel:m,formatX:g,neutralizeFormulas:c};s?s(t,C):X(t,C,d)},[i,h,e,m,g,c,s,d]),u=i.length===0||e===void 0,f=F??a.chartExport,B=t=>t==="csv"?a.chartExportCsv:a.chartExportJson,b=N("inline-flex cursor-pointer items-center gap-2 rounded-full border border-gray-300 bg-white font-medium text-gray-700 transition-colors hover:bg-gray-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-synertech-primary-500 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",j[L],S);if(n.length<=1){let t=n[0]??"csv";return p("button",{type:"button",onClick:()=>x(t),disabled:l||u,className:b,children:[y,o("span",{children:f})]})}return p(z,{children:[p(M,{disabled:l||u,className:b,children:[y,o("span",{children:f})]}),o(P,{children:n.map(t=>o(K,{onSelect:()=>x(t),children:B(t)},t))})]})}export{V as ChartExportButton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var f=Object.defineProperty;var
|
|
1
|
+
"use strict";var f=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var C=(t,r)=>{for(var n in r)f(t,n,{get:r[n],enumerable:!0})},P=(t,r,n,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of h(r))!m.call(t,o)&&o!==n&&f(t,o,{get:()=>r[o],enumerable:!(i=b(r,o))||i.enumerable});return t};var $=t=>P(f({},"__esModule",{value:!0}),t);var R={};C(R,{CHART_PATTERNS:()=>k,CHART_SURFACE_COLOR:()=>s.CHART_SURFACE_COLOR,ChartPatternDefs:()=>S,getPattern:()=>g,patternBackground:()=>w,patternFill:()=>y,patternId:()=>p});module.exports=$(R);var s=require("./palette.cjs"),a=require("react/jsx-runtime");var k=["solid","diagonal","diagonal-reverse","cross","dots","diagonal-wide","diagonal-reverse-wide","dots-wide"],x={solid:null,diagonal:{tile:6,rotate:45,stroke:2},"diagonal-reverse":{tile:6,rotate:-45,stroke:2},cross:{tile:6,rotate:45,stroke:1.25,crossed:!0},dots:{tile:6,rotate:0,stroke:0,dot:1.5},"diagonal-wide":{tile:10,rotate:45,stroke:3},"diagonal-reverse-wide":{tile:10,rotate:-45,stroke:3},"dots-wide":{tile:10,rotate:0,stroke:0,dot:2.6}};function g(t){return!Number.isFinite(t)||t<0?"solid":k[Math.floor(t)%k.length]}function p(t,r){return`${t.replace(/[^a-zA-Z0-9_-]/g,"")}-texture-${Math.max(0,Math.floor(r))}`}function y(t,r,n,i){return!t||g(n)==="solid"?i:`url(#${p(r,n)})`}function S({id:t,entries:r}){return(0,a.jsx)("defs",{children:r.map(({slot:n,color:i})=>{let o=x[g(n)];if(!o)return null;let{tile:e,rotate:c,stroke:l,crossed:d,dot:u}=o;return(0,a.jsxs)("pattern",{id:p(t,n),width:e,height:e,patternUnits:"userSpaceOnUse",patternTransform:c===0?void 0:`rotate(${c})`,children:[(0,a.jsx)("rect",{width:e,height:e,fill:i}),u?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("circle",{cx:e/4,cy:e/4,r:u,fill:s.CHART_SURFACE_COLOR}),(0,a.jsx)("circle",{cx:e*3/4,cy:e*3/4,r:u,fill:s.CHART_SURFACE_COLOR})]}):null,l>0?(0,a.jsx)("line",{x1:e/2,y1:0,x2:e/2,y2:e,stroke:s.CHART_SURFACE_COLOR,strokeWidth:l}):null,d?(0,a.jsx)("line",{x1:0,y1:e/2,x2:e,y2:e/2,stroke:s.CHART_SURFACE_COLOR,strokeWidth:l}):null]},p(t,n))})})}function w(t,r){let n=x[g(t)];if(!n)return{backgroundColor:r};let{tile:i,rotate:o,stroke:e,crossed:c,dot:l}=n;if(l)return{backgroundColor:r,backgroundImage:`radial-gradient(${s.CHART_SURFACE_COLOR} ${l-.4}px, transparent ${l}px)`,backgroundSize:`${i/2}px ${i/2}px`};let d=u=>`repeating-linear-gradient(${u}deg, ${s.CHART_SURFACE_COLOR} 0 ${e}px, transparent ${e}px ${i}px)`;return{backgroundColor:r,backgroundImage:c?`${d(o)}, ${d(o+90)}`:d(o)}}0&&(module.exports={CHART_PATTERNS,CHART_SURFACE_COLOR,ChartPatternDefs,getPattern,patternBackground,patternFill,patternId});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fragment as
|
|
1
|
+
import{CHART_SURFACE_COLOR as l}from"./palette.js";import{Fragment as b,jsx as s,jsxs as k}from"react/jsx-runtime";var f=["solid","diagonal","diagonal-reverse","cross","dots","diagonal-wide","diagonal-reverse-wide","dots-wide"],x={solid:null,diagonal:{tile:6,rotate:45,stroke:2},"diagonal-reverse":{tile:6,rotate:-45,stroke:2},cross:{tile:6,rotate:45,stroke:1.25,crossed:!0},dots:{tile:6,rotate:0,stroke:0,dot:1.5},"diagonal-wide":{tile:10,rotate:45,stroke:3},"diagonal-reverse-wide":{tile:10,rotate:-45,stroke:3},"dots-wide":{tile:10,rotate:0,stroke:0,dot:2.6}};function g(r){return!Number.isFinite(r)||r<0?"solid":f[Math.floor(r)%f.length]}function p(r,e){return`${r.replace(/[^a-zA-Z0-9_-]/g,"")}-texture-${Math.max(0,Math.floor(e))}`}function m(r,e,n,o){return!r||g(n)==="solid"?o:`url(#${p(e,n)})`}function C({id:r,entries:e}){return s("defs",{children:e.map(({slot:n,color:o})=>{let i=x[g(n)];if(!i)return null;let{tile:t,rotate:c,stroke:a,crossed:d,dot:u}=i;return k("pattern",{id:p(r,n),width:t,height:t,patternUnits:"userSpaceOnUse",patternTransform:c===0?void 0:`rotate(${c})`,children:[s("rect",{width:t,height:t,fill:o}),u?k(b,{children:[s("circle",{cx:t/4,cy:t/4,r:u,fill:l}),s("circle",{cx:t*3/4,cy:t*3/4,r:u,fill:l})]}):null,a>0?s("line",{x1:t/2,y1:0,x2:t/2,y2:t,stroke:l,strokeWidth:a}):null,d?s("line",{x1:0,y1:t/2,x2:t,y2:t/2,stroke:l,strokeWidth:a}):null]},p(r,n))})})}function P(r,e){let n=x[g(r)];if(!n)return{backgroundColor:e};let{tile:o,rotate:i,stroke:t,crossed:c,dot:a}=n;if(a)return{backgroundColor:e,backgroundImage:`radial-gradient(${l} ${a-.4}px, transparent ${a}px)`,backgroundSize:`${o/2}px ${o/2}px`};let d=u=>`repeating-linear-gradient(${u}deg, ${l} 0 ${t}px, transparent ${t}px ${o}px)`;return{backgroundColor:e,backgroundImage:c?`${d(i)}, ${d(i+90)}`:d(i)}}export{f as CHART_PATTERNS,l as CHART_SURFACE_COLOR,C as ChartPatternDefs,g as getPattern,P as patternBackground,m as patternFill,p as patternId};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var p=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var u=(t,r)=>{for(var n in r)p(t,n,{get:r[n],enumerable:!0})},P=(t,r,n,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of a(r))!l.call(t,e)&&e!==n&&p(t,e,{get:()=>r[e],enumerable:!(i=h(r,e))||i.enumerable});return t};var c=t=>P(p({},"__esModule",{value:!0}),t);var s={};u(s,{ChartPlotClip:()=>g,isOnPlot:()=>C,plotClipId:()=>m});module.exports=c(s);var o=require("react/jsx-runtime");function m(t){return`${t.replace(/[^a-zA-Z0-9_-]/g,"")}-plot`}function C(t,r){return Number.isFinite(t)&&t>=-.5&&t<=r+.5}function g({id:t,width:r,height:n,bleed:i=0}){return(0,o.jsx)("defs",{children:(0,o.jsx)("clipPath",{id:t,children:(0,o.jsx)("rect",{x:-i,y:-i,width:Math.max(0,r+i*2),height:Math.max(0,n+i*2)})})})}0&&(module.exports={ChartPlotClip,isOnPlot,plotClipId});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as n}from"react/jsx-runtime";function o(t){return`${t.replace(/[^a-zA-Z0-9_-]/g,"")}-plot`}function p(t,i){return Number.isFinite(t)&&t>=-.5&&t<=i+.5}function h({id:t,width:i,height:e,bleed:r=0}){return n("defs",{children:n("clipPath",{id:t,children:n("rect",{x:-r,y:-r,width:Math.max(0,i+r*2),height:Math.max(0,e+r*2)})})})}export{h as ChartPlotClip,p as isOnPlot,o as plotClipId};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var d=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var D=(e,t)=>{for(var r in t)d(e,r,{get:t[r],enumerable:!0})},H=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of X(t))!b.call(e,l)&&l!==r&&d(e,l,{get:()=>t[l],enumerable:!(o=g(t,l))||o.enumerable});return e};var T=e=>H(d({},"__esModule",{value:!0}),e);var O={};D(O,{ChartSyncProvider:()=>w,brushToPeriod:()=>N,useChartSync:()=>k});module.exports=T(O);var n=require("react"),h=require("./utils/period.cjs"),v=require("./utils/scales.cjs"),B=require("./utils/timestamp.cjs"),x=require("react/jsx-runtime"),S=(0,n.createContext)(null);function k(){return(0,n.useContext)(S)}function w({children:e,hover:t=!0,brush:r,defaultBrush:o=null,onBrushChange:l}){let[u,c]=(0,n.useState)(null),[R,V]=(0,n.useState)(o),C=r!==void 0,f=C?r:R,m=(0,n.useCallback)(a=>{if(!t)return;let p=s=>s===null?"\0":(0,v.toKey)(s);c(s=>p(s)===p(a)?s:a)},[t]),y=(0,n.useCallback)(a=>{C||V(a),l?.(a)},[C,l]),P=(0,n.useMemo)(()=>({hovered:t?u:null,brush:f??null,hoverShared:t,setHovered:m,setBrush:y}),[t,u,f,m,y]);return(0,x.jsx)(S.Provider,{value:P,children:e})}function N(e){let t=i(e.from),r=i(e.to);if(!t||!r)return null;let[o,l]=t<=r?[t,r]:[r,t],u=e.end===void 0?null:i(e.end),c=u!==null&&u>l?new Date(u.getTime()-1):l;return{preset:"custom",from:(0,h.startOfDay)(o),to:(0,h.endOfDay)(c)}}function i(e){let t=(0,B.toTimestamp)(e);return t===null?null:new Date(t)}0&&(module.exports={ChartSyncProvider,brushToPeriod,useChartSync});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{createContext as x,useCallback as
|
|
1
|
+
"use client";import{createContext as x,useCallback as m,useContext as R,useMemo as V,useState as y}from"react";import{endOfDay as P,startOfDay as g}from"./utils/period.js";import{toKey as X}from"./utils/scales.js";import{toTimestamp as b}from"./utils/timestamp.js";import{jsx as D}from"react/jsx-runtime";var p=x(null);function N(){return R(p)}function O({children:e,hover:t=!0,brush:r,defaultBrush:a=null,onBrushChange:l}){let[n,s]=y(null),[v,B]=y(a),h=r!==void 0,C=h?r:v,d=m(o=>{if(!t)return;let f=u=>u===null?"\0":X(u);s(u=>f(u)===f(o)?u:o)},[t]),i=m(o=>{h||B(o),l?.(o)},[h,l]),S=V(()=>({hovered:t?n:null,brush:C??null,hoverShared:t,setHovered:d,setBrush:i}),[t,n,C,d,i]);return D(p.Provider,{value:S,children:e})}function I(e){let t=c(e.from),r=c(e.to);if(!t||!r)return null;let[a,l]=t<=r?[t,r]:[r,t],n=e.end===void 0?null:c(e.end),s=n!==null&&n>l?new Date(n.getTime()-1):l;return{preset:"custom",from:g(a),to:P(s)}}function c(e){let t=b(e);return t===null?null:new Date(t)}export{O as ChartSyncProvider,I as brushToPeriod,N as useChartSync};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var f=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var D=(a,t)=>{for(var m in t)f(a,m,{get:t[m],enumerable:!0})},L=(a,t,m,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of P(t))!S.call(a,o)&&o!==m&&f(a,o,{get:()=>t[o],enumerable:!(n=X(t,o))||n.enumerable});return a};var B=a=>L(f({},"__esModule",{value:!0}),a);var F={};D(F,{ChartTableView:()=>W});module.exports=B(F);var p=require("../../lib/cn.cjs"),T=require("../table/Table.cjs"),y=require("../table/TableBody.cjs"),d=require("../table/TableCell.cjs"),k=require("../table/TableHeader.cjs"),c=require("../table/TableHeaderCell.cjs"),v=require("../table/TableRow.cjs"),x=require("./palette.cjs"),s=require("./utils/data.cjs"),u=require("./utils/format.cjs"),r=require("react/jsx-runtime");function W({data:a,series:t,xKey:m,xLabel:n,formatX:o,formatValue:V,columnFormats:w,caption:g,emptyLabel:N,className:h,...C}){let b=t.filter(e=>!e.hidden);if(a.length===0||b.length===0)return(0,r.jsx)("div",{className:(0,p.cn)("text-sm text-gray-500 dark:text-gray-400",h),...C,children:N});let R=(e,i)=>{let l=(0,s.readXValue)(e,m,i);return o?o(l,i):(0,u.formatXValue)(l)},H=(e,i)=>{if(e===null)return"\u2014";let l=w?.[i]??V;return l?l(e):(0,u.formatNumber)(e)};return(0,r.jsx)("div",{className:(0,p.cn)("w-full overflow-x-auto",h),...C,children:(0,r.jsxs)(T.Table,{children:[g?(0,r.jsx)("caption",{className:"sr-only",children:g}):null,(0,r.jsxs)(k.TableHeader,{children:[(0,r.jsx)(c.TableHeaderCell,{children:n??m}),b.map(e=>(0,r.jsx)(c.TableHeaderCell,{className:"text-right",children:(0,x.getSeriesLabel)(e)},e.key))]}),(0,r.jsx)(y.TableBody,{children:a.map((e,i)=>(0,r.jsxs)(v.TableRow,{clickable:!1,children:[(0,r.jsx)(d.TableCell,{className:"font-medium text-gray-900 dark:text-gray-100",children:R(e,i)}),b.map(l=>(0,r.jsx)(d.TableCell,{className:"text-right [font-variant-numeric:tabular-nums]",children:H((0,s.readNumber)(e,l.key),l.key)},l.key))]},i))})]})})}0&&(module.exports={ChartTableView});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cn as f}from"../../lib/cn.js";import{Table as
|
|
1
|
+
import{cn as f}from"../../lib/cn.js";import{Table as v}from"../table/Table.js";import{TableBody as x}from"../table/TableBody.js";import{TableCell as p}from"../table/TableCell.js";import{TableHeader as V}from"../table/TableHeader.js";import{TableHeaderCell as d}from"../table/TableHeaderCell.js";import{TableRow as w}from"../table/TableRow.js";import{getSeriesLabel as N}from"./palette.js";import{readNumber as R,readXValue as H}from"./utils/data.js";import{formatNumber as X,formatXValue as P}from"./utils/format.js";import{jsx as t,jsxs as o}from"react/jsx-runtime";function G({data:m,series:c,xKey:i,xLabel:g,formatX:n,formatValue:h,columnFormats:C,caption:s,emptyLabel:T,className:u,...b}){let l=c.filter(e=>!e.hidden);if(m.length===0||l.length===0)return t("div",{className:f("text-sm text-gray-500 dark:text-gray-400",u),...b,children:T});let y=(e,a)=>{let r=H(e,i,a);return n?n(r,a):P(r)},k=(e,a)=>{if(e===null)return"\u2014";let r=C?.[a]??h;return r?r(e):X(e)};return t("div",{className:f("w-full overflow-x-auto",u),...b,children:o(v,{children:[s?t("caption",{className:"sr-only",children:s}):null,o(V,{children:[t(d,{children:g??i}),l.map(e=>t(d,{className:"text-right",children:N(e)},e.key))]}),t(x,{children:m.map((e,a)=>o(w,{clickable:!1,children:[t(p,{className:"font-medium text-gray-900 dark:text-gray-100",children:y(e,a)}),l.map(r=>t(p,{className:"text-right [font-variant-numeric:tabular-nums]",children:k(R(e,r.key),r.key)},r.key))]},a))})]})})}export{G as ChartTableView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";"use client";var n=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var a=(r,t)=>{for(var e in t)n(r,e,{get:t[e],enumerable:!0})},h=(r,t,e,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of l(t))!C.call(r,o)&&o!==e&&n(r,o,{get:()=>t[o],enumerable:!(p=c(t,o))||p.enumerable});return r};var i=r=>h(n({},"__esModule",{value:!0}),r);var E={};a(E,{ChartExportContext:()=>x,useChartExportSource:()=>s});module.exports=i(E);var u=require("react"),x=(0,u.createContext)(null);function s(){return(0,u.useContext)(x)}0&&(module.exports={ChartExportContext,useChartExportSource});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{createContext as t,useContext as r}from"react";var o=t(null);function u(){return r(o)}export{o as ChartExportContext,u as useChartExportSource};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var p=Object.defineProperty;var
|
|
1
|
+
"use strict";var p=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var P=(r,e)=>{for(var t in e)p(r,t,{get:e[t],enumerable:!0})},G=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of q(e))!k.call(r,o)&&o!==t&&p(r,o,{get:()=>e[o],enumerable:!(n=M(e,o))||n.enumerable});return r};var U=r=>G(p({},"__esModule",{value:!0}),r);var J={};P(J,{CHART_ALL_PAIRS_LIMIT:()=>K,CHART_DIVERGING_COLORS:()=>f,CHART_DIVERGING_DARK_STOPS:()=>E,CHART_DIVERGING_NEUTRAL_INDEX:()=>y,CHART_DOWN_COLOR:()=>$,CHART_MAX_COLOR_CLASSES:()=>X,CHART_MUTED_COLOR:()=>u,CHART_ORDINAL_COLORS:()=>S,CHART_ORDINAL_DARK_STOPS:()=>Q,CHART_PALETTE_SIZE:()=>d,CHART_SEQUENTIAL_COLORS:()=>v,CHART_SEQUENTIAL_DARK_STOPS:()=>I,CHART_SERIES_COLORS:()=>O,CHART_SURFACE_COLOR:()=>w,CHART_UP_COLOR:()=>F,createDivergingScale:()=>Z,createSequentialScale:()=>z,getOrdinalColor:()=>B,getSeriesColor:()=>A,getSeriesLabel:()=>L,rampColor:()=>g,resetPaletteWarnings:()=>W,resolveSeriesColor:()=>T,toLegendItems:()=>V});module.exports=U(J);var x=require("../../lib/css-value.cjs"),d=8,O=["var(--color-chart-1)","var(--color-chart-2)","var(--color-chart-3)","var(--color-chart-4)","var(--color-chart-5)","var(--color-chart-6)","var(--color-chart-7)","var(--color-chart-8)"],u="var(--color-chart-muted)",w="var(--color-chart-surface)",F="var(--color-chart-up)",$="var(--color-chart-down)",K=3,C=!1;function A(r,e){let t=(0,x.safeCssColor)(e);return t||(r<0||r>=d?(C||(C=!0,console.warn(`[@synertech/ui] A chart was given more than ${d} series. Extra series share the de-emphasis grey: fold the tail into an "Other" bucket, or split the chart, instead of relying on a ninth colour.`)),u):O[r])}function T(r,e,t){return t&&r.key!==t?u:A(e,r.color)}function L(r){return r.label??r.key}function V(r,e,t=!1){return r.map((n,o)=>({key:n.key,label:L(n),color:T(n,o,e),hidden:n.hidden,...n.type==="line"?{marker:"line"}:{},...t&&n.type!=="line"?{pattern:o}:{}}))}function W(){C=!1}var v=["var(--color-chart-seq-1)","var(--color-chart-seq-2)","var(--color-chart-seq-3)","var(--color-chart-seq-4)","var(--color-chart-seq-5)","var(--color-chart-seq-6)"],S=["var(--color-chart-ord-1)","var(--color-chart-ord-2)","var(--color-chart-ord-3)","var(--color-chart-ord-4)","var(--color-chart-ord-5)"],f=["var(--color-chart-div-1)","var(--color-chart-div-2)","var(--color-chart-div-3)","var(--color-chart-div-4)","var(--color-chart-div-5)","var(--color-chart-div-6)","var(--color-chart-div-7)"],y=3,I=[!1,!1,!1,!1,!0,!0],Q=[!1,!1,!0,!0,!0],E=[!0,!1,!1,!1,!1,!1,!0],X=7;function h(r){return Number.isFinite(r)?r<0?0:r>1?1:r:0}function g(r,e){if(r.length===0)return u;if(r.length===1)return r[0];let t=h(e)*(r.length-1),n=Math.min(r.length-2,Math.floor(t)),o=t-n;if(o<=.005)return r[n];if(o>=.995)return r[n+1];let a=Math.round(o*1e3)/10;return`color-mix(in oklab, ${r[n+1]} ${a}%, ${r[n]})`}function j(r,e){return e<=1?.5:Math.min(e-1,Math.floor(h(r)*e))/(e-1)}function D(r,e,t,n,o){let a=c=>{let l=n(c);return t===null?l:j(l,t)},s=(c=>Number.isFinite(c)?g(e,a(c)):u);return Object.defineProperties(s,{domain:{value:[r[0],r[1]],enumerable:!0},colors:{value:e,enumerable:!0},steps:{value:t,enumerable:!0},position:{value:c=>Number.isFinite(c)?a(c):0,enumerable:!0},onDark:{value:c=>{if(!Number.isFinite(c)||o.length===0)return!1;let l=Math.round(a(c)*(o.length-1));return o[l]??!1},enumerable:!0}}),s}function z(r,e={}){let{steps:t,colors:n=v,darkStops:o}=e,[a,s]=r,c=s-a;return D(r,n,t??null,l=>c===0?0:(l-a)/c,o??(n===v?I:[]))}function Z(r,e={}){let{steps:t,colors:n=f,darkStops:o,center:a=0,symmetric:s=!0}=e,[c,l]=r;if(s){let i=Math.max(Math.abs(l-a),Math.abs(a-c));c=a-i,l=a+i}let m=n===f?y:(n.length-1)/2,b=n.length-1;return D([c,l],n,t??null,i=>{if(i>=a){let _=l-a,N=_<=0?0:h((i-a)/_);return(m+N*(b-m))/b}let R=a-c,H=R<=0?0:h((a-i)/R);return(m-H*m)/b},o??(n===f?E:[]))}function B(r,e=S.length,t=S){return e<=1?t[t.length-1]??u:g(t,h(r/(e-1)))}0&&(module.exports={CHART_ALL_PAIRS_LIMIT,CHART_DIVERGING_COLORS,CHART_DIVERGING_DARK_STOPS,CHART_DIVERGING_NEUTRAL_INDEX,CHART_DOWN_COLOR,CHART_MAX_COLOR_CLASSES,CHART_MUTED_COLOR,CHART_ORDINAL_COLORS,CHART_ORDINAL_DARK_STOPS,CHART_PALETTE_SIZE,CHART_SEQUENTIAL_COLORS,CHART_SEQUENTIAL_DARK_STOPS,CHART_SERIES_COLORS,CHART_SURFACE_COLOR,CHART_UP_COLOR,createDivergingScale,createSequentialScale,getOrdinalColor,getSeriesColor,getSeriesLabel,rampColor,resetPaletteWarnings,resolveSeriesColor,toLegendItems});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
import{safeCssColor as A}from"../../lib/css-value.js";var v=8,T=["var(--color-chart-1)","var(--color-chart-2)","var(--color-chart-3)","var(--color-chart-4)","var(--color-chart-5)","var(--color-chart-6)","var(--color-chart-7)","var(--color-chart-8)"],h="var(--color-chart-muted)",q="var(--color-chart-surface)",k="var(--color-chart-up)",P="var(--color-chart-down)",G=3,p=!1;function L(r,n){let e=A(n);return e||(r<0||r>=v?(p||(p=!0,console.warn(`[@synertech/ui] A chart was given more than ${v} series. Extra series share the de-emphasis grey: fold the tail into an "Other" bucket, or split the chart, instead of relying on a ninth colour.`)),h):T[r])}function y(r,n,e){return e&&r.key!==e?h:L(n,r.color)}function I(r){return r.label??r.key}function U(r,n,e=!1){return r.map((t,c)=>({key:t.key,label:I(t),color:y(t,c,n),hidden:t.hidden,...t.type==="line"?{marker:"line"}:{},...e&&t.type!=="line"?{pattern:c}:{}}))}function w(){p=!1}var S=["var(--color-chart-seq-1)","var(--color-chart-seq-2)","var(--color-chart-seq-3)","var(--color-chart-seq-4)","var(--color-chart-seq-5)","var(--color-chart-seq-6)"],g=["var(--color-chart-ord-1)","var(--color-chart-ord-2)","var(--color-chart-ord-3)","var(--color-chart-ord-4)","var(--color-chart-ord-5)"],b=["var(--color-chart-div-1)","var(--color-chart-div-2)","var(--color-chart-div-3)","var(--color-chart-div-4)","var(--color-chart-div-5)","var(--color-chart-div-6)","var(--color-chart-div-7)"],E=3,D=[!1,!1,!1,!1,!0,!0],F=[!1,!1,!0,!0,!0],H=[!0,!1,!1,!1,!1,!1,!0],$=7;function u(r){return Number.isFinite(r)?r<0?0:r>1?1:r:0}function R(r,n){if(r.length===0)return h;if(r.length===1)return r[0];let e=u(n)*(r.length-1),t=Math.min(r.length-2,Math.floor(e)),c=e-t;if(c<=.005)return r[t];if(c>=.995)return r[t+1];let o=Math.round(c*1e3)/10;return`color-mix(in oklab, ${r[t+1]} ${o}%, ${r[t]})`}function N(r,n){return n<=1?.5:Math.min(n-1,Math.floor(u(r)*n))/(n-1)}function _(r,n,e,t,c){let o=a=>{let l=t(a);return e===null?l:N(l,e)},s=(a=>Number.isFinite(a)?R(n,o(a)):h);return Object.defineProperties(s,{domain:{value:[r[0],r[1]],enumerable:!0},colors:{value:n,enumerable:!0},steps:{value:e,enumerable:!0},position:{value:a=>Number.isFinite(a)?o(a):0,enumerable:!0},onDark:{value:a=>{if(!Number.isFinite(a)||c.length===0)return!1;let l=Math.round(o(a)*(c.length-1));return c[l]??!1},enumerable:!0}}),s}function K(r,n={}){let{steps:e,colors:t=S,darkStops:c}=n,[o,s]=r,a=s-o;return _(r,t,e??null,l=>a===0?0:(l-o)/a,c??(t===S?D:[]))}function V(r,n={}){let{steps:e,colors:t=b,darkStops:c,center:o=0,symmetric:s=!0}=n,[a,l]=r;if(s){let i=Math.max(Math.abs(l-o),Math.abs(o-a));a=o-i,l=o+i}let m=t===b?E:(t.length-1)/2,f=t.length-1;return _([a,l],t,e??null,i=>{if(i>=o){let C=l-o,O=C<=0?0:u((i-o)/C);return(m+O*(f-m))/f}let d=o-a,x=d<=0?0:u((o-i)/d);return(m-x*m)/f},c??(t===b?H:[]))}function W(r,n=g.length,e=g){return n<=1?e[e.length-1]??h:R(e,u(r/(n-1)))}export{G as CHART_ALL_PAIRS_LIMIT,b as CHART_DIVERGING_COLORS,H as CHART_DIVERGING_DARK_STOPS,E as CHART_DIVERGING_NEUTRAL_INDEX,P as CHART_DOWN_COLOR,$ as CHART_MAX_COLOR_CLASSES,h as CHART_MUTED_COLOR,g as CHART_ORDINAL_COLORS,F as CHART_ORDINAL_DARK_STOPS,v as CHART_PALETTE_SIZE,S as CHART_SEQUENTIAL_COLORS,D as CHART_SEQUENTIAL_DARK_STOPS,T as CHART_SERIES_COLORS,q as CHART_SURFACE_COLOR,k as CHART_UP_COLOR,V as createDivergingScale,K as createSequentialScale,W as getOrdinalColor,L as getSeriesColor,I as getSeriesLabel,R as rampColor,w as resetPaletteWarnings,y as resolveSeriesColor,U as toLegendItems};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var l=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var w=(t,e)=>{for(var u in e)l(t,u,{get:e[u],enumerable:!0})},C=(t,e,u,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of T(e))!p.call(t,n)&&n!==u&&l(t,n,{get:()=>e[n],enumerable:!(c=b(e,n))||c.enumerable});return t};var R=t=>C(l({},"__esModule",{value:!0}),t);var z={};w(z,{DEFAULT_CHART_WIDTH:()=>h,useChartSize:()=>v});module.exports=R(z);var r=require("react"),h=640;function v(t={}){let{width:e,fallbackWidth:u=h}=t,c=(0,r.useRef)(null),[n,m]=(0,r.useState)(0),i=(0,r.useRef)(null);return(0,r.useEffect)(()=>{let s=e===void 0?c.current:null;if(i.current?.element===s||(i.current?.disconnect(),i.current=null,!s))return;let f=d=>{m(o=>Math.abs(o-d)<1?o:d)};if(f(s.getBoundingClientRect().width),typeof ResizeObserver>"u"){i.current={element:s,disconnect:()=>{}};return}let a=new ResizeObserver(d=>{if(s.isConnected)for(let o of d)f(o.contentRect.width)});a.observe(s),i.current={element:s,disconnect:()=>a.disconnect()}}),(0,r.useEffect)(()=>()=>{i.current?.disconnect(),i.current=null},[]),e!==void 0?{ref:c,width:e,measured:!0}:{ref:c,width:n>0?n:u,measured:n>0}}0&&(module.exports={DEFAULT_CHART_WIDTH,useChartSize});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useEffect as
|
|
1
|
+
"use client";import{useEffect as o,useRef as l,useState as m}from"react";var b=640;function p(f={}){let{width:i,fallbackWidth:a=b}=f,s=l(null),[u,h]=m(0),e=l(null);return o(()=>{let t=i===void 0?s.current:null;if(e.current?.element===t||(e.current?.disconnect(),e.current=null,!t))return;let c=n=>{h(r=>Math.abs(r-n)<1?r:n)};if(c(t.getBoundingClientRect().width),typeof ResizeObserver>"u"){e.current={element:t,disconnect:()=>{}};return}let d=new ResizeObserver(n=>{if(t.isConnected)for(let r of n)c(r.contentRect.width)});d.observe(t),e.current={element:t,disconnect:()=>d.disconnect()}}),o(()=>()=>{e.current?.disconnect(),e.current=null},[]),i!==void 0?{ref:s,width:i,measured:!0}:{ref:s,width:u>0?u:a,measured:u>0}}export{b as DEFAULT_CHART_WIDTH,p as useChartSize};
|