@synertech/ui 0.45.1 → 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 +115 -17
- 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/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/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 +814 -172
- package/dist/index.d.ts +814 -172
- 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 +3049 -270
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use client";import{useState as
|
|
2
|
-
${
|
|
1
|
+
"use client";import{useState as b,useRef as E,useEffect as W,useCallback as C}from"react";import G from"dompurify";import K from"react-markdown";import q from"remark-gfm";import{useUILabels as V}from"../../lib/i18n.js";import{Fragment as ae,jsx as e,jsxs as a}from"react/jsx-runtime";var j=a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),e("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),F=a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),e("polyline",{points:"17 21 17 13 7 13 7 21"}),e("polyline",{points:"7 3 7 8 15 8"})]}),J=a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),Q=a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("polyline",{points:"1 4 1 10 7 10"}),e("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]}),X=a("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10"}),e("path",{className:"opacity-75",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z",fill:"currentColor"})]}),Y={xs:"w-4 h-4 text-[10px]",sm:"w-5 h-5 text-xs",md:"w-6 h-6 text-sm",lg:"w-7 h-7 text-base"},Z={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},ee={sm:"w-56",md:"w-72",lg:"w-96",xl:"w-[32rem]"},te=[q],re={h1:({...t})=>e("h1",{className:"text-xl font-bold mb-2 text-gray-900 dark:text-gray-100",...t}),h2:({...t})=>e("h2",{className:"text-lg font-semibold mt-4 mb-2 text-gray-900 dark:text-gray-100",...t}),h3:({...t})=>e("h3",{className:"text-base font-semibold mt-3 mb-1 text-gray-900 dark:text-gray-100",...t}),p:({...t})=>e("p",{className:"my-1 text-gray-700 dark:text-gray-300",...t}),ul:({...t})=>e("ul",{className:"list-disc list-inside space-y-1 my-2 text-gray-700 dark:text-gray-300",...t}),ol:({...t})=>e("ol",{className:"list-decimal list-inside space-y-1 my-2 text-gray-700 dark:text-gray-300",...t}),code:({className:t,children:n,...i})=>!t?.includes("language-")?e("code",{className:"bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded text-sm font-mono text-gray-900 dark:text-gray-100",...i,children:n}):e("code",{className:"block bg-gray-100 dark:bg-gray-800 rounded-lg p-3 my-2 overflow-x-auto text-sm font-mono text-gray-900 dark:text-gray-100",...i,children:n}),pre:({...t})=>e("pre",{className:"my-2",...t}),a:({...t})=>e("a",{className:"text-blue-600 dark:text-blue-400 hover:underline",...t}),strong:({...t})=>e("strong",{className:"font-semibold text-gray-900 dark:text-gray-100",...t}),em:({...t})=>e("em",{className:"italic",...t}),blockquote:({...t})=>e("blockquote",{className:"border-l-4 border-gray-300 dark:border-gray-600 pl-4 my-2 italic text-gray-600 dark:text-gray-400",...t})};function oe({content:t,markdown:n=!1,position:i="bottom",size:x="sm",className:B="",visible:R=!0,editable:f=!1,onSave:u,onReset:d,width:M="md",title:g,markdownEditor:h,markdownEditorUnavailableLabel:L,labels:I}){let r=V(I),[m,S]=b(!1),[l,p]=b(!1),[v,y]=b(""),[T,k]=b(!1),[O,o]=b(null),P=E(null),H=E(null),z=E(null),s=E(null);W(()=>{if(!m)return;let c=w=>{P.current&&!P.current.contains(w.target)&&H.current&&!H.current.contains(w.target)&&(l||S(!1))},_=w=>{w.key==="Escape"&&(l?(p(!1),y("")):S(!1))};return document.addEventListener("mousedown",c),document.addEventListener("keydown",_),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",_)}},[m,l]),W(()=>{l&&z.current&&z.current.focus()},[l]),W(()=>()=>{s.current&&clearTimeout(s.current)},[]);let U=C(()=>{y(typeof t=="string"?t:""),p(!0),o(null)},[t]),A=C(()=>{p(!1),y(""),o(null)},[]),D=C(async()=>{if(!u){o({type:"error",text:r.helpButtonNoSave});return}k(!0);try{await u(v)?(o({type:"success",text:r.helpButtonSaved}),p(!1),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>o(null),2e3)):o({type:"error",text:r.helpButtonSaveError})}catch{o({type:"error",text:r.helpButtonSaveError})}finally{k(!1)}},[v,u,r]),$=C(async()=>{if(d&&confirm(r.helpButtonResetConfirm)){k(!0);try{await d()?(o({type:"success",text:r.helpButtonResetDone}),p(!1),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>o(null),2e3)):o({type:"error",text:r.helpButtonResetError})}catch{o({type:"error",text:r.helpButtonResetError})}finally{k(!1)}}},[d,r]),N=t;return R?a("div",{className:"relative inline-flex items-center",children:[e("button",{type:"button",ref:P,onClick:()=>S(!m),className:`
|
|
2
|
+
${Y[x]}
|
|
3
3
|
inline-flex items-center justify-center
|
|
4
4
|
rounded-full border border-gray-300 dark:border-gray-600
|
|
5
5
|
bg-white dark:bg-gray-800
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
hover:border-gray-400 dark:hover:border-gray-500
|
|
11
11
|
transition-all duration-150
|
|
12
12
|
focus:outline-none focus:ring-2 focus:ring-blue-500/50
|
|
13
|
-
${
|
|
14
|
-
`,"aria-label":
|
|
15
|
-
absolute z-50 ${
|
|
16
|
-
${
|
|
13
|
+
${B}
|
|
14
|
+
`,"aria-label":r.helpButtonShow,"aria-expanded":m,children:e("span",{className:"font-medium",children:"?"})}),m&&a("div",{ref:H,className:`
|
|
15
|
+
absolute z-50 ${Z[i]}
|
|
16
|
+
${ee[M]} max-h-[80vh] overflow-hidden flex flex-col
|
|
17
17
|
bg-white dark:bg-gray-900
|
|
18
18
|
border border-gray-200 dark:border-gray-700
|
|
19
19
|
rounded-xl shadow-xl
|
|
20
20
|
text-sm text-gray-700 dark:text-gray-300
|
|
21
21
|
animate-in fade-in-0 zoom-in-95 duration-150
|
|
22
|
-
`,role:"tooltip",children:[(
|
|
22
|
+
`,role:"tooltip",children:[(g||f)&&a("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:[e("div",{className:"flex items-center gap-2",children:g&&e("h3",{className:"text-sm font-semibold",children:g})}),f&&e("div",{className:"flex items-center gap-1",children:l?a(ae,{children:[e("button",{type:"button",onClick:D,disabled:T,className:"p-1.5 rounded-md hover:bg-green-100 dark:hover:bg-green-900/30 text-green-600 dark:text-green-400 transition-colors disabled:opacity-50 cursor-pointer",title:r.helpButtonSave,children:T?X:F}),e("button",{type:"button",onClick:A,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:r.helpButtonCancel,children:J}),d&&e("button",{type:"button",onClick:$,disabled:T,className:"p-1.5 rounded-md hover:bg-orange-100 dark:hover:bg-orange-900/30 text-orange-600 dark:text-orange-400 transition-colors disabled:opacity-50 cursor-pointer",title:r.helpButtonReset,children:Q})]}):e("button",{type:"button",onClick:U,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:r.helpButtonEdit,children:j})})]}),O&&e("div",{className:`px-4 py-2 text-xs ${O.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400"}`,children:O.text}),e("div",{className:"flex-1 overflow-y-auto p-4",children:l?n?h?e(h,{value:v,onChange:y,placeholder:r.markdownEditorPlaceholder}):e("p",{role:"alert",className:"p-3 text-sm text-gray-500 dark:text-gray-400",children:L??r.markdownEditorUnavailable}):e("div",{className:"space-y-2",children:e("textarea",{ref:z,"aria-label":r.helpButtonContent,value:v,onChange:c=>y(c.target.value),className:"w-full h-64 p-3 text-sm bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg resize-none focus:outline-none focus:ring-2 focus:ring-blue-500/50 text-gray-700 dark:text-gray-300 font-mono",placeholder:r.helpButtonContentPlaceholder})}):typeof N=="string"?e("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:n?e(K,{remarkPlugins:te,components:re,children:N}):e("div",{dangerouslySetInnerHTML:{__html:G.sanitize(N)}})}):N})]})]}):null}function ce({children:t,content:n,markdown:i=!1,position:x="bottom",size:B="sm",visible:R=!0,editable:f=!1,onSave:u,onReset:d,width:M="md",title:g,className:h,markdownEditor:L,markdownEditorUnavailableLabel:I,labels:r}){return a("div",{className:"inline-flex items-center gap-2.5",children:[t,e(oe,{content:n,markdown:i,position:x,size:B,visible:R,editable:f,onSave:u,onReset:d,width:M,title:g,className:h,markdownEditor:L,markdownEditorUnavailableLabel:I,labels:r})]})}export{oe as HelpButton,ce as WithHelpButton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var l=Object.defineProperty;var
|
|
1
|
+
"use strict";"use client";var l=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var c=(n,r)=>{for(var d in r)l(n,d,{get:r[d],enumerable:!0})},k=(n,r,d,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of p(r))!u.call(n,t)&&t!==d&&l(n,t,{get:()=>r[t],enumerable:!(i=m(r,t))||i.enumerable});return n};var P=n=>k(l({},"__esModule",{value:!0}),n);var b={};c(b,{MarkdownEditor:()=>g});module.exports=P(b);var E=require("@mdxeditor/editor/style.css"),o=require("@mdxeditor/editor"),a=require("react"),s=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime"),h=()=>(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(o.UndoRedo,{}),(0,e.jsx)(o.BlockTypeSelect,{}),(0,e.jsx)(o.BoldItalicUnderlineToggles,{}),(0,e.jsx)(o.CodeToggle,{}),(0,e.jsx)(o.CreateLink,{}),(0,e.jsx)(o.ListsToggle,{}),(0,e.jsx)(o.InsertThematicBreak,{})]}),w=[(0,o.headingsPlugin)(),(0,o.listsPlugin)(),(0,o.quotePlugin)(),(0,o.linkPlugin)(),(0,o.linkDialogPlugin)(),(0,o.codeBlockPlugin)({defaultCodeBlockLanguage:""}),(0,o.thematicBreakPlugin)(),(0,o.markdownShortcutPlugin)(),(0,o.toolbarPlugin)({toolbarContents:h})],g=(0,a.forwardRef)(({value:n,onChange:r,placeholder:d},i)=>{let t=(0,s.useUILabels)();return(0,e.jsx)("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden bg-white dark:bg-gray-800",children:(0,e.jsx)(o.MDXEditor,{ref:i,markdown:n,onChange:r,placeholder:d??t.markdownEditorPlaceholder,contentEditableClassName:"prose prose-sm dark:prose-invert max-w-none p-3 min-h-[16rem] focus:outline-none",plugins:w})})});g.displayName="MarkdownEditor";0&&(module.exports={MarkdownEditor});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import"@mdxeditor/editor/style.css";import{MDXEditor as i,headingsPlugin as
|
|
1
|
+
"use client";import"@mdxeditor/editor/style.css";import{MDXEditor as i,headingsPlugin as l,listsPlugin as a,quotePlugin as s,linkPlugin as g,linkDialogPlugin as m,codeBlockPlugin as p,thematicBreakPlugin as u,markdownShortcutPlugin as c,toolbarPlugin as k,BlockTypeSelect as P,BoldItalicUnderlineToggles as h,CodeToggle as w,ListsToggle as b,CreateLink as f,InsertThematicBreak as E,UndoRedo as M}from"@mdxeditor/editor";import{forwardRef as y}from"react";import{useUILabels as T}from"../../lib/i18n.js";import{Fragment as N,jsx as o,jsxs as v}from"react/jsx-runtime";var B=()=>v(N,{children:[o(M,{}),o(P,{}),o(h,{}),o(w,{}),o(f,{}),o(b,{}),o(E,{})]}),C=[l(),a(),s(),g(),m(),p({defaultCodeBlockLanguage:""}),u(),c(),k({toolbarContents:B})],L=y(({value:e,onChange:r,placeholder:n},t)=>{let d=T();return o("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden bg-white dark:bg-gray-800",children:o(i,{ref:t,markdown:e,onChange:r,placeholder:n??d.markdownEditorPlaceholder,contentEditableClassName:"prose prose-sm dark:prose-invert max-w-none p-3 min-h-[16rem] focus:outline-none",plugins:C})})});L.displayName="MarkdownEditor";export{L as MarkdownEditor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var U=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var S=(t,e)=>{for(var s in e)U(t,s,{get:e[s],enumerable:!0})},$=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of B(e))!G.call(t,l)&&l!==s&&U(t,l,{get:()=>e[l],enumerable:!(i=j(e,l))||i.enumerable});return t};var z=t=>$(U({},"__esModule",{value:!0}),t);var W={};S(W,{ImageUploader:()=>O});module.exports=z(W);var a=require("react"),p=require("../../lib/i18n.cjs"),r=require("react/jsx-runtime"),A={"16/9":"aspect-[16/9]","4/3":"aspect-[4/3]","1/1":"aspect-square",auto:""},D=(t,e)=>new Promise((s,i)=>{let l=new FileReader;l.onload=g=>{let f=g.target?.result;s(f)},l.onerror=()=>{i(new Error(e))},l.readAsDataURL(t)});function O({value:t,onChange:e,onUpload:s,label:i,maxSize:l=5*1024*1024,accept:g="image/*",helpText:f,disabled:b=!1,className:L="",showUrlInput:E=!0,urlPlaceholder:C="https://example.com/image.jpg",labels:P,aspectRatio:h="16/9"}){let o=(0,p.useUILabels)(P),v=i??o.imageUploaderLabel,[y,k]=(0,a.useState)(!1),[I,n]=(0,a.useState)(null),c=(0,a.useRef)(null),w=(0,a.useId)(),x=(0,a.useMemo)(()=>(l/(1024*1024)).toFixed(0),[l]),F=(0,p.formatUILabel)(o.imageUploaderHelp,{formats:g==="image/*"?"JPG, PNG, GIF, WebP":g,maxSize:x}),R=(0,a.useCallback)(async u=>{let m=u.target.files?.[0];if(m){if(!m.type.startsWith("image/")){n(o.imageUploaderNotImage);return}if(m.size>l){n((0,p.formatUILabel)(o.imageUploaderTooLarge,{maxSize:x}));return}k(!0),n(null);try{if(s){let d=await s(m);e(d)}else{let d=await D(m,o.imageUploaderReadError);e(d)}c.current&&(c.current.value="")}catch(d){console.error("Upload error:",d),n(d instanceof Error?d.message:o.imageUploaderUploadError)}finally{k(!1)}}},[l,x,e,s,o]),M=(0,a.useCallback)(()=>{e(""),c.current&&(c.current.value=""),n(null)},[e]),N=(0,a.useCallback)(u=>{e(u),n(null)},[e]),T=(0,a.useCallback)(()=>{c.current?.click()},[]),H=(0,a.useCallback)(u=>{N(u.target.value)},[N]);return(0,r.jsxs)("div",{className:`space-y-2 ${L}`,children:[v&&(0,r.jsx)("label",{className:"block text-sm font-semibold text-gray-700 dark:text-gray-300",children:v}),t&&(0,r.jsxs)("div",{className:"relative w-full overflow-hidden rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800/50",children:[(0,r.jsx)("div",{className:`relative ${A[h]} ${h==="auto"?"max-h-64":""} flex items-center justify-center`,children:(0,r.jsx)("img",{src:t,alt:o.imageUploaderPreview,className:"w-full h-full object-contain"})}),(0,r.jsx)("button",{type:"button",onClick:M,disabled:b,className:"absolute top-2 right-2 bg-red-500 text-white rounded-full w-6 h-6 flex items-center justify-center text-xs hover:bg-red-600 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",title:o.imageUploaderRemove,children:"\xD7"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("input",{ref:c,type:"file","aria-label":o.imageUploaderChoose,accept:g,onChange:R,className:"hidden",disabled:b||y}),(0,r.jsx)("button",{type:"button",onClick:T,disabled:b||y,className:"px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200",children:y?o.imageUploaderUploading:t?o.imageUploaderChangeButton:o.imageUploaderChooseButton})]}),E&&(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("label",{htmlFor:w,className:"block text-xs text-gray-500 dark:text-gray-400",children:o.imageUploaderUrlLabel}),(0,r.jsx)("input",{id:w,type:"url",value:t||"",onChange:H,placeholder:C,disabled:b,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-800 dark:text-gray-200 disabled:opacity-50 disabled:cursor-not-allowed"})]}),I&&(0,r.jsxs)("div",{className:"text-red-600 dark:text-red-400 text-sm bg-red-50 dark:bg-red-900/20 p-2 rounded border border-red-200 dark:border-red-800",children:["\u274C ",I]}),(0,r.jsx)("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:f||F})]})}0&&(module.exports={ImageUploader});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useState as
|
|
1
|
+
"use client";import{useState as N,useRef as B,useCallback as u,useMemo as G,useId as S}from"react";import{formatUILabel as L,useUILabels as $}from"../../lib/i18n.js";import{jsx as a,jsxs as m}from"react/jsx-runtime";var z={"16/9":"aspect-[16/9]","4/3":"aspect-[4/3]","1/1":"aspect-square",auto:""},A=(o,r)=>new Promise((i,b)=>{let t=new FileReader;t.onload=n=>{let f=n.target?.result;i(f)},t.onerror=()=>{b(new Error(r))},t.readAsDataURL(o)});function W({value:o,onChange:r,onUpload:i,label:b,maxSize:t=5*1024*1024,accept:n="image/*",helpText:f,disabled:p=!1,className:E="",showUrlInput:C=!0,urlPlaceholder:P="https://example.com/image.jpg",labels:F,aspectRatio:U="16/9"}){let e=$(F),h=b??e.imageUploaderLabel,[y,v]=N(!1),[k,s]=N(null),d=B(null),I=S(),x=G(()=>(t/(1024*1024)).toFixed(0),[t]),R=L(e.imageUploaderHelp,{formats:n==="image/*"?"JPG, PNG, GIF, WebP":n,maxSize:x}),M=u(async c=>{let g=c.target.files?.[0];if(g){if(!g.type.startsWith("image/")){s(e.imageUploaderNotImage);return}if(g.size>t){s(L(e.imageUploaderTooLarge,{maxSize:x}));return}v(!0),s(null);try{if(i){let l=await i(g);r(l)}else{let l=await A(g,e.imageUploaderReadError);r(l)}d.current&&(d.current.value="")}catch(l){console.error("Upload error:",l),s(l instanceof Error?l.message:e.imageUploaderUploadError)}finally{v(!1)}}},[t,x,r,i,e]),T=u(()=>{r(""),d.current&&(d.current.value=""),s(null)},[r]),w=u(c=>{r(c),s(null)},[r]),H=u(()=>{d.current?.click()},[]),j=u(c=>{w(c.target.value)},[w]);return m("div",{className:`space-y-2 ${E}`,children:[h&&a("label",{className:"block text-sm font-semibold text-gray-700 dark:text-gray-300",children:h}),o&&m("div",{className:"relative w-full overflow-hidden rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800/50",children:[a("div",{className:`relative ${z[U]} ${U==="auto"?"max-h-64":""} flex items-center justify-center`,children:a("img",{src:o,alt:e.imageUploaderPreview,className:"w-full h-full object-contain"})}),a("button",{type:"button",onClick:T,disabled:p,className:"absolute top-2 right-2 bg-red-500 text-white rounded-full w-6 h-6 flex items-center justify-center text-xs hover:bg-red-600 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",title:e.imageUploaderRemove,children:"\xD7"})]}),m("div",{className:"flex gap-2",children:[a("input",{ref:d,type:"file","aria-label":e.imageUploaderChoose,accept:n,onChange:M,className:"hidden",disabled:p||y}),a("button",{type:"button",onClick:H,disabled:p||y,className:"px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200",children:y?e.imageUploaderUploading:o?e.imageUploaderChangeButton:e.imageUploaderChooseButton})]}),C&&m("div",{className:"space-y-1",children:[a("label",{htmlFor:I,className:"block text-xs text-gray-500 dark:text-gray-400",children:e.imageUploaderUrlLabel}),a("input",{id:I,type:"url",value:o||"",onChange:j,placeholder:P,disabled:p,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-800 dark:text-gray-200 disabled:opacity-50 disabled:cursor-not-allowed"})]}),k&&m("div",{className:"text-red-600 dark:text-red-400 text-sm bg-red-50 dark:bg-red-900/20 p-2 rounded border border-red-200 dark:border-red-800",children:["\u274C ",k]}),a("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:f||R})]})}export{W as ImageUploader};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var d=Object.defineProperty;var
|
|
1
|
+
"use strict";var d=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var V=(t,e)=>{for(var l in e)d(t,l,{get:e[l],enumerable:!0})},W=(t,e,l,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of H(e))!M.call(t,r)&&r!==l&&d(t,r,{get:()=>e[r],enumerable:!(o=T(e,r))||o.enumerable});return t};var q=t=>W(d({},"__esModule",{value:!0}),t);var P={};V(P,{Label:()=>m});module.exports=q(P);var s=require("../../lib/cn.cjs"),i=require("../../lib/server-labels.cjs"),a=require("react/jsx-runtime"),v={xs:"text-xs",sm:"text-sm",md:"text-sm",lg:"text-base",xl:"text-lg"},p={xs:"w-3 h-3",sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-4.5 h-4.5",xl:"w-5 h-5"},A={normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},I={default:{default:"text-gray-700 dark:text-gray-200",light:"text-gray-500 dark:text-gray-400",strong:"text-gray-900 dark:text-white"},primary:{default:"text-blue-600 dark:text-blue-400",light:"text-blue-400 dark:text-blue-300",strong:"text-blue-700 dark:text-blue-300"},secondary:{default:"text-purple-600 dark:text-purple-400",light:"text-purple-400 dark:text-purple-300",strong:"text-purple-700 dark:text-purple-300"},success:{default:"text-green-600 dark:text-green-400",light:"text-green-400 dark:text-green-300",strong:"text-green-700 dark:text-green-300"},warning:{default:"text-yellow-600 dark:text-yellow-400",light:"text-yellow-400 dark:text-yellow-300",strong:"text-yellow-700 dark:text-yellow-300"},error:{default:"text-red-600 dark:text-red-400",light:"text-red-400 dark:text-red-300",strong:"text-red-700 dark:text-red-300"},info:{default:"text-cyan-600 dark:text-cyan-400",light:"text-cyan-400 dark:text-cyan-300",strong:"text-cyan-700 dark:text-cyan-300"},muted:{default:"text-gray-500 dark:text-gray-400",light:"text-gray-400 dark:text-gray-500",strong:"text-gray-600 dark:text-gray-300"}};function m({children:t,size:e="md",color:l="default",variant:o="default",weight:r="medium",textColor:b,required:n=!1,requiredIndicator:u="*",requiredLabel:y=i.serverUILabels.labelRequired,optional:f=!1,optionalText:k=i.serverUILabels.labelOptional,tooltip:h,icon:x,endIcon:g,disabled:c=!1,truncate:L=!1,as:w="label",className:C,...N}){let R=w,S=(0,s.cn)("inline-flex items-center gap-1.5 transition-colors",v[e],A[r]),z=b||I[l][o];return(0,a.jsxs)(R,{className:(0,s.cn)(S,z,c?"opacity-50 cursor-not-allowed":"cursor-default",C),title:h,"aria-disabled":c,...N,children:[x&&(0,a.jsx)("span",{className:(0,s.cn)("shrink-0",p[e]),children:x}),(0,a.jsxs)("span",{className:(0,s.cn)(L&&"truncate"),children:[t,n&&(0,a.jsx)("span",{className:"text-red-500 ml-0.5","aria-hidden":"true",children:u}),n&&(0,a.jsx)("span",{className:"sr-only",children:y})]}),f&&!n&&(0,a.jsx)("span",{className:"text-gray-400 dark:text-gray-500 font-normal",children:k}),g&&(0,a.jsx)("span",{className:(0,s.cn)("shrink-0",p[e]),children:g})]})}m.displayName="Label";0&&(module.exports={Label});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cn as e}from"../../lib/cn.js";import{jsx as t,jsxs as
|
|
1
|
+
import{cn as e}from"../../lib/cn.js";import{serverUILabels as n}from"../../lib/server-labels.js";import{jsx as t,jsxs as i}from"react/jsx-runtime";var z={xs:"text-xs",sm:"text-sm",md:"text-sm",lg:"text-base",xl:"text-lg"},d={xs:"w-3 h-3",sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-4.5 h-4.5",xl:"w-5 h-5"},T={normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},H={default:{default:"text-gray-700 dark:text-gray-200",light:"text-gray-500 dark:text-gray-400",strong:"text-gray-900 dark:text-white"},primary:{default:"text-blue-600 dark:text-blue-400",light:"text-blue-400 dark:text-blue-300",strong:"text-blue-700 dark:text-blue-300"},secondary:{default:"text-purple-600 dark:text-purple-400",light:"text-purple-400 dark:text-purple-300",strong:"text-purple-700 dark:text-purple-300"},success:{default:"text-green-600 dark:text-green-400",light:"text-green-400 dark:text-green-300",strong:"text-green-700 dark:text-green-300"},warning:{default:"text-yellow-600 dark:text-yellow-400",light:"text-yellow-400 dark:text-yellow-300",strong:"text-yellow-700 dark:text-yellow-300"},error:{default:"text-red-600 dark:text-red-400",light:"text-red-400 dark:text-red-300",strong:"text-red-700 dark:text-red-300"},info:{default:"text-cyan-600 dark:text-cyan-400",light:"text-cyan-400 dark:text-cyan-300",strong:"text-cyan-700 dark:text-cyan-300"},muted:{default:"text-gray-500 dark:text-gray-400",light:"text-gray-400 dark:text-gray-500",strong:"text-gray-600 dark:text-gray-300"}};function M({children:x,size:a="md",color:g="default",variant:c="default",weight:p="medium",textColor:m,required:r=!1,requiredIndicator:b="*",requiredLabel:u=n.labelRequired,optional:y=!1,optionalText:f=n.labelOptional,tooltip:k,icon:l,endIcon:s,disabled:o=!1,truncate:h=!1,as:L="label",className:w,...C}){let N=L,R=e("inline-flex items-center gap-1.5 transition-colors",z[a],T[p]),S=m||H[g][c];return i(N,{className:e(R,S,o?"opacity-50 cursor-not-allowed":"cursor-default",w),title:k,"aria-disabled":o,...C,children:[l&&t("span",{className:e("shrink-0",d[a]),children:l}),i("span",{className:e(h&&"truncate"),children:[x,r&&t("span",{className:"text-red-500 ml-0.5","aria-hidden":"true",children:b}),r&&t("span",{className:"sr-only",children:u})]}),y&&!r&&t("span",{className:"text-gray-400 dark:text-gray-500 font-normal",children:f}),s&&t("span",{className:e("shrink-0",d[a]),children:s})]})}M.displayName="Label";export{M as Label};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var Pe=Object.defineProperty;var Xe=Object.getOwnPropertyDescriptor;var $e=Object.getOwnPropertyNames;var Ge=Object.prototype.hasOwnProperty;var Oe=(h,a)=>{for(var o in a)Pe(h,o,{get:a[o],enumerable:!0})},_e=(h,a,o,s)=>{if(a&&typeof a=="object"||typeof a=="function")for(let u of $e(a))!Ge.call(h,u)&&u!==o&&Pe(h,u,{get:()=>a[u],enumerable:!(s=Xe(a,u))||s.enumerable});return h};var ze=h=>_e(Pe({},"__esModule",{value:!0}),h);var Qe={};Oe(Qe,{LineChart:()=>Je});module.exports=ze(Qe);var l=require("react"),Re=require("../../lib/cn.cjs"),we=require("../../lib/i18n.cjs"),U=require("../chart/ChartAnnotations.cjs"),Le=require("../chart/ChartAxis.cjs"),se=require("../chart/ChartBrush.cjs"),Ae=require("../chart/ChartContainer.cjs"),Ve=require("../chart/ChartGrid.cjs"),Te=require("../chart/ChartLegend.cjs"),Ee=require("../chart/ChartSync.cjs"),Be=require("../chart/ChartTableView.cjs"),ie=require("../chart/ChartTooltip.cjs"),E=require("../chart/palette.cjs"),v=require("../chart/utils/cartesian.cjs"),j=require("../chart/utils/data.cjs"),le=require("../chart/utils/decimate.cjs"),he=require("../chart/utils/format.cjs"),B=require("../chart/utils/path.cjs"),T=require("../chart/utils/scales.cjs"),He=require("../chart/utils/ticks.cjs"),We=require("../chart/utils/timestamp.cjs"),Ie=require("../chart/utils/touch.cjs"),n=require("react/jsx-runtime"),Ue=24,je=10,Fe=10,Ye=(0,l.memo)(function({lines:a,showMarkers:o}){return(0,n.jsx)("g",{children:a.map(s=>(0,n.jsxs)("g",{children:[s.solid?(0,n.jsx)("path",{d:s.solid,fill:"none",stroke:s.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}):null,s.dashed?(0,n.jsx)("path",{d:s.dashed,fill:"none",stroke:s.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:"5 4"}):null,(o?s.markers:s.isolated).map(u=>(0,n.jsx)("circle",{cx:u.x,cy:u.y,r:3,fill:s.color,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},`${u.x}-${u.y}`))]},s.key))})});function qe({width:h,height:a,data:o,resolvedSeries:s,x:u,y:H,grid:x,size:F,curve:k,forecastFrom:D,forecastLabel:P,markers:L,connectNulls:S,referenceLines:ue,annotations:R,annotationsLabel:ce,overlay:de,maxPoints:w,brush:Y,onBrush:q,brushLabel:me,syncEnabled:fe,margin:J,tooltip:A,onPointClick:M,plotLabel:ge,formatValue:V,formatX:W}){let[K,X]=(0,l.useState)(null),c=K!==null&&K<o.length?K:null,[ye,pe]=(0,l.useState)(null),Ce=(0,Ee.useChartSync)(),m=fe?Ce:null,e=(0,l.useMemo)(()=>{let t=s.filter(f=>!f.hidden),r=(0,v.buildCartesianGeometry)({width:h,height:a,data:o,x:u,y:H,bounds:(0,He.extent)((0,j.collectAllValues)(o,t.map(f=>f.key))),margin:J,placement:"point",formatValue:V,formatX:W,extraTop:P?je:0}),d=r.categoryCenters,y=r.valueScale,te=D===void 0?-1:r.xValues.findIndex(f=>(0,T.toKey)(f)===(0,T.toKey)(D)),Ne=t.map(f=>{let z=o.map((ae,Ke)=>{let ve=(0,j.readNumber)(ae,f.key);return{x:d[Ke],y:ve===null?Number.NaN:y(ve),defined:ve!==null}}),Se={connectNulls:S},ne=te>=0,ke=ae=>w&&w>0?(0,le.decimatePath)(ae,w):ae,re=ke(ne?z.slice(0,te+1):z),oe=f.dashed?ke(z):ne?ke(z.slice(te)):[];w||(0,le.warnPointBudget)("LineChart",z.length);let Me=f.dashed?oe:ne?[...re,...oe.slice(1)]:re;return{key:f.key,color:f.color,solid:f.dashed?"":(0,B.buildLinePath)(re,k,Se),dashed:f.dashed||ne?(0,B.buildLinePath)(oe,k,Se):"",markers:[...re,...f.dashed?[]:oe].filter(B.isDrawable),isolated:(0,B.isolatedPoints)(Me,S)}}),De=o.length>1?r.innerWidth/(o.length-1):0;return{visible:t,locate:(0,v.createCategoryLocator)(r),plot:(0,v.createPlotContext)({geometry:r,width:h,height:a,data:o,series:t,formatValue:V,formatX:W}),xValues:r.xValues,xPositions:d,xTicks:r.categoryTicks,yTicks:r.valueTicks,yScale:y,innerWidth:r.innerWidth,innerHeight:r.innerHeight,margin:r.margin,lines:Ne,forecastIndex:te,showMarkers:L==="always"||L==="auto"&&De>=Ue&&o.length>1}},[o,s,u,H,h,a,J,k,S,D,P,L,w,V,W]),p=(0,l.useCallback)(t=>e.visible.map(r=>{let d=(0,j.readNumber)(o[t],r.key);return{seriesKey:r.key,seriesLabel:(0,E.getSeriesLabel)(r),color:r.color,value:d,formattedValue:d===null?"\u2014":V(d),datum:o[t]}}),[o,e.visible,V]),Q=m?m.brush:ye,be=(0,l.useCallback)(t=>{pe(t),m?.setBrush(t),q?.(t)},[m,q]),g=(0,se.useChartBrush)({enabled:Y,active:Q!==null,centers:e.xPositions,xValues:e.xValues,offset:e.margin.left,orientation:"vertical",onCommit:be}),Z=(0,l.useCallback)(t=>{if(g.onPointerMove(t),A===!1||o.length===0)return;let r=t.currentTarget.getBoundingClientRect(),d=t.clientX-r.left-e.margin.left,y=(0,T.nearestIndex)(e.xPositions,d);X(y>=0?y:null),m?.setHovered(y>=0?e.xValues[y]:null)},[g,A,o.length,e.margin.left,e.xPositions,e.xValues,m]),$=(0,l.useCallback)(()=>{X(null),m?.setHovered(null)},[m]),xe=(0,l.useCallback)(t=>{if(o.length===0)return;g.onKeyDown(t,c);let r=o.length-1,d=c??0,y=t.key==="ArrowRight"?Math.min(r,d+1):t.key==="ArrowLeft"?Math.max(0,d-1):t.key==="Home"?0:t.key==="End"?r:t.key==="Escape"?null:void 0;y!==void 0&&(t.preventDefault(),X(y),m?.setHovered(y===null?null:e.xValues[y]))},[o.length,c,g,m,e.xValues]),I=(0,l.useCallback)(()=>{if(g.consumedClick()||!M||c===null)return;let[t]=p(c);t&&M({...t,index:c,x:e.xValues[c]})},[g,M,c,p,e.xValues]),ee=c!==null||!m?.hovered?null:(()=>{let t=(0,T.toKey)(m.hovered),r=e.xValues.findIndex(d=>(0,T.toKey)(d)===t);return r<0?null:r})(),C=c??ee,G=C===null?null:p(C),O=(G??[]).filter(t=>t.value!==null),N=g.dragging??Q,_=(()=>{if(!N)return null;let t=e.locate(N.from),r=e.locate(N.to);return t===null||r===null?null:{from:t,to:r}})(),i=(0,v.splitOverlay)(de),b=c===null||G===null?null:{x:e.xValues[c],xLabel:W(e.xValues[c],c),index:c,points:G};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("svg",{width:h,height:a,role:"img","aria-label":ge??[e.visible.map(t=>(0,E.getSeriesLabel)(t)).join(", "),(0,U.describeAnnotations)(R,ce)].filter(Boolean).join(". "),tabIndex:0,className:(0,Re.cn)(Ie.CHART_TOUCH,"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",Y&&"select-none"),onPointerDown:g.onPointerDown,onPointerMove:Z,onPointerUp:g.onPointerUp,onPointerCancel:g.onPointerUp,onPointerLeave:$,onKeyDown:xe,onBlur:$,onClick:I,children:[(0,n.jsxs)("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[(0,n.jsx)(Ve.ChartGrid,{width:e.innerWidth,height:e.innerHeight,horizontal:x==="y"||x==="both"?e.yTicks.map(t=>t.offset):void 0,vertical:x==="x"||x==="both"?e.xTicks.map(t=>t.offset):void 0}),R?(0,n.jsx)(U.ChartAnnotationLayer,{layer:"under",annotations:R,xAt:e.locate,yAt:e.yScale,width:e.innerWidth,height:e.innerHeight}):null,_?(0,n.jsx)(se.ChartBrushLayer,{from:_.from,to:_.to,width:e.innerWidth,height:e.innerHeight,live:g.dragging!==null,label:me}):null,i.under?.(e.plot),ue?.map(t=>{let r=e.yScale(t.value),d=r<Fe?r+12:r-4;return(0,n.jsxs)("g",{children:[(0,n.jsx)("line",{x1:0,y1:r,x2:e.innerWidth,y2:r,stroke:t.color??"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:t.dashed===!1?void 0:"4 4"}),t.label?(0,n.jsx)("text",{x:e.innerWidth,y:d,textAnchor:"end",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:t.label}):null]},`${t.value}-${t.label??""}`)}),e.forecastIndex>=0?(0,n.jsxs)("g",{children:[(0,n.jsx)("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"}),P?(0,n.jsx)("text",{x:e.xPositions[e.forecastIndex]+4,y:-2,className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:P}):null]}):null,(0,n.jsx)(Ye,{lines:e.lines,showMarkers:e.showMarkers}),R?(0,n.jsx)(U.ChartAnnotationLayer,{annotations:R,xAt:e.locate,yAt:e.yScale,width:e.innerWidth,height:e.innerHeight}):null,i.over?.(e.plot),C!==null?(0,n.jsxs)("g",{"aria-hidden":"true",children:[(0,n.jsx)("line",{x1:e.xPositions[C],y1:0,x2:e.xPositions[C],y2:e.innerHeight,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:1,strokeDasharray:c===null?"3 3":void 0}),O.map(t=>(0,n.jsx)("circle",{cx:e.xPositions[C],cy:e.yScale(t.value),r:4,fill:t.color,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},t.seriesKey))]}):null]}),(0,n.jsx)("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:u.hidden?null:(0,n.jsx)(Le.ChartAxis,{orientation:"bottom",ticks:e.xTicks,length:e.innerWidth,label:u.label,size:F})}),(0,n.jsx)("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:H?.hidden?null:(0,n.jsx)(Le.ChartAxis,{orientation:"left",ticks:e.yTicks,length:e.innerHeight,showLine:!1,label:H?.label,size:F})})]}),b&&A!==!1?(0,n.jsx)(ie.ChartTooltip,{x:e.margin.left+e.xPositions[b.index],y:e.margin.top+(O.length>0?Math.min(...O.map(t=>e.yScale(t.value))):e.innerHeight/2),containerWidth:h,children:typeof A=="function"?A(b):(0,n.jsx)(ie.ChartTooltipContent,{title:b.xLabel,points:b.points})}):null]})}function Je({data:h,series:a,x:o,y:s,height:u=240,width:H,size:x="md",grid:F="y",legend:k,tooltip:D=!0,tableView:P=!1,emphasis:L,title:S,description:ue,loading:R=!1,emptyState:ce,error:de=!1,errorState:w,onRetry:Y,actions:q,onPointClick:me,curve:fe="monotone",forecastFrom:J,forecastLabel:A,markers:M="auto",connectNulls:ge=!1,referenceLines:V,annotations:W,overlay:K,legendToggle:X=!0,maxPoints:c,brush:ye=!1,onBrush:pe,brushLabel:Ce,sync:m=!0,margin:e,locale:p,plotLabel:Q,className:be,...g}){let Z=(0,we.useUILabels)(),[$,xe]=(0,l.useState)(()=>new Set),I=(0,l.useMemo)(()=>a.map((i,b)=>({...i,hidden:i.hidden||$.has(i.key),color:(0,E.resolveSeriesColor)(i,b,L)})),[a,$,L]),ee=(0,l.useMemo)(()=>s?.format??(i=>(0,he.formatAuto)(i,p)),[s?.format,p]),C=(0,l.useMemo)(()=>o.format??(i=>o.scale==="time"?(0,We.formatTimeValue)(i,p):(0,he.formatXValue)(i,p)),[o.format,o.scale,p]),G=(0,l.useCallback)(i=>{xe(b=>{let t=new Set(b);return t.has(i)?t.delete(i):t.add(i),t})},[]),O=k===void 0?a.length>=2:k!==!1,N=typeof k=="string"?k:"bottom",_=I.filter(i=>!i.hidden).length;return(0,n.jsx)(Ae.ChartContainer,{title:S,description:ue,height:u,width:H,size:x,loading:R,empty:h.length===0||_===0,emptyState:ce,error:de,errorState:w,onRetry:Y,actions:q,tableView:P,legendPosition:N,legend:O?(0,n.jsx)(Te.ChartLegend,{items:(0,E.toLegendItems)(I,L),position:N,marker:"line",size:x,onToggle:X?G:void 0}):void 0,table:P?(0,n.jsx)(Be.ChartTableView,{data:h,series:I,xKey:o.key,xLabel:o.label??o.key,formatX:C,formatValue:ee,caption:typeof S=="string"?S:void 0}):void 0,className:be,...g,children:({width:i})=>(0,n.jsx)(qe,{width:i,height:u,data:h,resolvedSeries:I,x:o,y:s,grid:F,size:x,curve:fe,forecastFrom:J,forecastLabel:A,markers:M,connectNulls:ge,referenceLines:V,annotations:W,annotationsLabel:Z.chartAnnotations,overlay:K,maxPoints:c,brush:ye,onBrush:pe,brushLabel:Ce??Z.chartBrush,syncEnabled:m,margin:e,tooltip:D,onPointClick:me,plotLabel:Q,formatValue:ee,formatX:C})})}0&&(module.exports={LineChart});
|
|
1
|
+
"use strict";"use client";var Se=Object.defineProperty;var Ge=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var _e=Object.prototype.hasOwnProperty;var ze=(u,s)=>{for(var r in s)Se(u,r,{get:s[r],enumerable:!0})},Ue=(u,s,r,i)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of Oe(s))!_e.call(u,c)&&c!==r&&Se(u,c,{get:()=>s[c],enumerable:!(i=Ge(s,c))||i.enumerable});return u};var je=u=>Ue(Se({},"__esModule",{value:!0}),u);var et={};ze(et,{LineChart:()=>Ze});module.exports=je(et);var l=require("react"),Ve=require("../../lib/cn.cjs"),Ae=require("../../lib/i18n.cjs"),j=require("../chart/ChartAnnotations.cjs"),Re=require("../chart/ChartAxis.cjs"),le=require("../chart/ChartBrush.cjs"),Te=require("../chart/ChartContainer.cjs"),Be=require("../chart/ChartGrid.cjs"),Ee=require("../chart/ChartLegend.cjs"),He=require("../chart/ChartSync.cjs"),We=require("../chart/ChartTableView.cjs"),he=require("../chart/ChartTooltip.cjs"),E=require("../chart/palette.cjs"),k=require("../chart/utils/cartesian.cjs"),F=require("../chart/utils/data.cjs"),ue=require("../chart/utils/decimate.cjs"),ce=require("../chart/utils/format.cjs"),de=require("../chart/utils/keyboard.cjs"),H=require("../chart/utils/path.cjs"),B=require("../chart/utils/scales.cjs"),Ie=require("../chart/utils/ticks.cjs"),Ne=require("../chart/utils/timestamp.cjs"),De=require("../chart/utils/touch.cjs"),n=require("react/jsx-runtime"),Fe=24,Ye=10,qe=10,Je=(0,l.memo)(function({lines:s,showMarkers:r}){return(0,n.jsx)("g",{children:s.map(i=>(0,n.jsxs)("g",{children:[i.solid?(0,n.jsx)("path",{d:i.solid,fill:"none",stroke:i.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}):null,i.dashed?(0,n.jsx)("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(c=>(0,n.jsx)("circle",{cx:c.x,cy:c.y,r:3,fill:i.color,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},`${c.x}-${c.y}`))]},i.key))})});function Qe({width:u,height:s,data:r,resolvedSeries:i,x:c,y:W,grid:C,size:Y,curve:b,forecastFrom:X,forecastLabel:v,markers:P,connectNulls:L,referenceLines:me,annotations:S,annotationsLabel:fe,overlay:ge,maxPoints:R,brush:q,onBrush:J,brushLabel:pe,syncEnabled:ye,margin:Q,tooltip:w,onPointClick:V,plotLabel:Ce,formatValue:A,formatX:I}){let[$,G]=(0,l.useState)(null),h=$!==null&&$<r.length?$:null,[be,xe]=(0,l.useState)(null),ke=(0,He.useChartSync)(),m=ye?ke:null,e=(0,l.useMemo)(()=>{let t=i.filter(f=>!f.hidden),o=(0,k.buildCartesianGeometry)({width:u,height:s,data:r,x:c,y:W,bounds:(0,Ie.extent)((0,F.collectAllValues)(r,t.map(f=>f.key))),margin:Q,placement:"point",formatValue:A,formatX:I,extraTop:v?Ye:0}),d=o.categoryCenters,T=o.valueScale,re=X===void 0?-1:o.xValues.findIndex(f=>(0,B.toKey)(f)===(0,B.toKey)(X)),Ke=t.map(f=>{let U=r.map((ie,$e)=>{let Le=(0,F.readNumber)(ie,f.key);return{x:d[$e],y:Le===null?Number.NaN:T(Le),defined:Le!==null}}),we={connectNulls:L},oe=re>=0,Pe=ie=>R&&R>0?(0,ue.decimatePath)(ie,R):ie,ae=Pe(oe?U.slice(0,re+1):U),se=f.dashed?Pe(U):oe?Pe(U.slice(re)):[];R||(0,ue.warnPointBudget)("LineChart",U.length);let Xe=f.dashed?se:oe?[...ae,...se.slice(1)]:ae;return{key:f.key,color:f.color,solid:f.dashed?"":(0,H.buildLinePath)(ae,b,we),dashed:f.dashed||oe?(0,H.buildLinePath)(se,b,we):"",markers:[...ae,...f.dashed?[]:se].filter(H.isDrawable),isolated:(0,H.isolatedPoints)(Xe,L)}}),Me=r.length>1?o.innerWidth/(r.length-1):0;return{visible:t,locate:(0,k.createCategoryLocator)(o),plot:(0,k.createPlotContext)({geometry:o,width:u,height:s,data:r,series:t,formatValue:A,formatX:I}),xValues:o.xValues,xPositions:d,xTicks:o.categoryTicks,yTicks:o.valueTicks,yScale:T,innerWidth:o.innerWidth,innerHeight:o.innerHeight,margin:o.margin,lines:Ke,forecastIndex:re,showMarkers:P==="always"||P==="auto"&&Me>=Fe&&r.length>1}},[r,i,c,W,u,s,Q,b,L,X,v,P,R,A,I]),y=(0,l.useCallback)(t=>e.visible.map(o=>{let d=(0,F.readNumber)(r[t],o.key);return{seriesKey:o.key,seriesLabel:(0,E.getSeriesLabel)(o),color:o.color,value:d,formattedValue:d===null?"\u2014":A(d),datum:r[t]}}),[r,e.visible,A]),Z=m?m.brush:be,ve=(0,l.useCallback)(t=>{xe(t),m?.setBrush(t),J?.(t)},[m,J]),g=(0,le.useChartBrush)({enabled:q,active:Z!==null,centers:e.xPositions,xValues:e.xValues,offset:e.margin.left,orientation:"vertical",onCommit:ve}),ee=(0,l.useCallback)(t=>{if(g.onPointerMove(t),w===!1||r.length===0)return;let o=t.currentTarget.getBoundingClientRect(),d=t.clientX-o.left-e.margin.left,T=(0,B.nearestIndex)(e.xPositions,d);G(T>=0?T:null),m?.setHovered(T>=0?e.xValues[T]:null)},[g,w,r.length,e.margin.left,e.xPositions,e.xValues,m]),O=(0,l.useCallback)(()=>{G(null),m?.setHovered(null)},[m]),N=(0,l.useCallback)(()=>{if(!V||h===null)return;let[t]=y(h);t&&V({...t,index:h,x:e.xValues[h]})},[V,h,y,e.xValues]),D=(0,l.useCallback)(t=>{if(r.length===0)return;let o=V&&h!==null&&e.visible.length>0;if((0,de.pressChartMark)(t,o?N:null))return;g.onKeyDown(t,h);let d=(0,de.chartCursorTarget)(t.key,h,r.length,"x");d!==void 0&&(t.preventDefault(),G(d),m?.setHovered(d===null?null:e.xValues[d]))},[r.length,h,g,m,e.xValues,e.visible.length,V,N]),te=(0,l.useCallback)(()=>{g.consumedClick()||N()},[g,N]),ne=h!==null||!m?.hovered?null:(()=>{let t=(0,B.toKey)(m.hovered),o=e.xValues.findIndex(d=>(0,B.toKey)(d)===t);return o<0?null:o})(),x=h??ne,_=x===null?null:y(x),K=(_??[]).filter(t=>t.value!==null),z=g.dragging??Z,a=(()=>{if(!z)return null;let t=e.locate(z.from),o=e.locate(z.to);return t===null||o===null?null:{from:t,to:o}})(),M=(0,k.splitOverlay)(ge),p=h===null||_===null?null:{x:e.xValues[h],xLabel:I(e.xValues[h],h),index:h,points:_};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("svg",{width:u,height:s,role:"img","aria-label":Ce??[e.visible.map(t=>(0,E.getSeriesLabel)(t)).join(", "),(0,j.describeAnnotations)(S,fe)].filter(Boolean).join(". "),tabIndex:0,className:(0,Ve.cn)(De.CHART_TOUCH,"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",q&&"select-none"),onPointerDown:g.onPointerDown,onPointerMove:ee,onPointerUp:g.onPointerUp,onPointerCancel:g.onPointerUp,onPointerLeave:O,onKeyDown:D,onBlur:O,onClick:te,children:[(0,n.jsxs)("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[(0,n.jsx)(Be.ChartGrid,{width:e.innerWidth,height:e.innerHeight,horizontal:C==="y"||C==="both"?e.yTicks.map(t=>t.offset):void 0,vertical:C==="x"||C==="both"?e.xTicks.map(t=>t.offset):void 0}),S?(0,n.jsx)(j.ChartAnnotationLayer,{layer:"under",annotations:S,xAt:e.locate,yAt:e.yScale,width:e.innerWidth,height:e.innerHeight}):null,a?(0,n.jsx)(le.ChartBrushLayer,{from:a.from,to:a.to,width:e.innerWidth,height:e.innerHeight,live:g.dragging!==null,label:pe}):null,M.under?.(e.plot),me?.map(t=>{let o=e.yScale(t.value),d=o<qe?o+12:o-4;return(0,n.jsxs)("g",{children:[(0,n.jsx)("line",{x1:0,y1:o,x2:e.innerWidth,y2:o,stroke:t.color??"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:t.dashed===!1?void 0:"4 4"}),t.label?(0,n.jsx)("text",{x:e.innerWidth,y:d,textAnchor:"end",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:t.label}):null]},`${t.value}-${t.label??""}`)}),e.forecastIndex>=0?(0,n.jsxs)("g",{children:[(0,n.jsx)("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"}),v?(0,n.jsx)("text",{x:e.xPositions[e.forecastIndex]+4,y:-2,className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:v}):null]}):null,(0,n.jsx)(Je,{lines:e.lines,showMarkers:e.showMarkers}),S?(0,n.jsx)(j.ChartAnnotationLayer,{annotations:S,xAt:e.locate,yAt:e.yScale,width:e.innerWidth,height:e.innerHeight}):null,M.over?.(e.plot),x!==null?(0,n.jsxs)("g",{"aria-hidden":"true",children:[(0,n.jsx)("line",{x1:e.xPositions[x],y1:0,x2:e.xPositions[x],y2:e.innerHeight,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:1,strokeDasharray:h===null?"3 3":void 0}),K.map(t=>(0,n.jsx)("circle",{cx:e.xPositions[x],cy:e.yScale(t.value),r:4,fill:t.color,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},t.seriesKey))]}):null]}),(0,n.jsx)("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:c.hidden?null:(0,n.jsx)(Re.ChartAxis,{orientation:"bottom",ticks:e.xTicks,length:e.innerWidth,label:c.label,size:Y})}),(0,n.jsx)("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:W?.hidden?null:(0,n.jsx)(Re.ChartAxis,{orientation:"left",ticks:e.yTicks,length:e.innerHeight,showLine:!1,label:W?.label,size:Y})})]}),p&&w!==!1?(0,n.jsx)(he.ChartTooltip,{x:e.margin.left+e.xPositions[p.index],y:e.margin.top+(K.length>0?Math.min(...K.map(t=>e.yScale(t.value))):e.innerHeight/2),containerWidth:u,children:typeof w=="function"?w(p):(0,n.jsx)(he.ChartTooltipContent,{title:p.xLabel,points:p.points})}):null]})}function Ze({data:u,series:s,x:r,y:i,height:c=240,width:W,size:C="md",grid:Y="y",legend:b,tooltip:X=!0,tableView:v=!1,emphasis:P,title:L,description:me,loading:S=!1,emptyState:fe,error:ge=!1,errorState:R,onRetry:q,actions:J,onPointClick:pe,curve:ye="monotone",forecastFrom:Q,forecastLabel:w,markers:V="auto",connectNulls:Ce=!1,referenceLines:A,annotations:I,overlay:$,legendToggle:G=!0,maxPoints:h,brush:be=!1,onBrush:xe,brushLabel:ke,sync:m=!0,margin:e,locale:y,plotLabel:Z,className:ve,...g}){let ee=(0,Ae.useUILabels)(),[O,N]=(0,l.useState)(()=>new Set),D=(0,l.useMemo)(()=>s.map((a,M)=>({...a,hidden:a.hidden||O.has(a.key),color:(0,E.resolveSeriesColor)(a,M,P)})),[s,O,P]),te=(0,l.useMemo)(()=>i?.format??(a=>(0,ce.formatAuto)(a,y)),[i?.format,y]),ne=(0,l.useMemo)(()=>r.format??(a=>r.scale==="time"?(0,Ne.formatTimeValue)(a,y):(0,ce.formatXValue)(a,y)),[r.format,r.scale,y]),x=(0,l.useCallback)(a=>{N(M=>{let p=new Set(M);return p.has(a)?p.delete(a):p.add(a),p})},[]),_=b===void 0?s.length>=2:b!==!1,K=typeof b=="string"?b:"bottom",z=D.filter(a=>!a.hidden).length;return(0,n.jsx)(Te.ChartContainer,{title:L,description:me,height:c,width:W,size:C,loading:S,empty:u.length===0||z===0,emptyState:fe,error:ge,errorState:R,onRetry:q,actions:J,tableView:v,legendPosition:K,legend:_?(0,n.jsx)(Ee.ChartLegend,{items:(0,E.toLegendItems)(D,P),position:K,marker:"line",size:C,onToggle:G?x:void 0}):void 0,table:v?(0,n.jsx)(We.ChartTableView,{data:u,series:D,xKey:r.key,xLabel:r.label??r.key,formatX:ne,formatValue:te,caption:typeof L=="string"?L:void 0}):void 0,className:ve,...g,children:({width:a})=>(0,n.jsx)(Qe,{width:a,height:c,data:u,resolvedSeries:D,x:r,y:i,grid:Y,size:C,curve:ye,forecastFrom:Q,forecastLabel:w,markers:V,connectNulls:Ce,referenceLines:A,annotations:I,annotationsLabel:ee.chartAnnotations,overlay:$,maxPoints:h,brush:be,onBrush:xe,brushLabel:ke??ee.chartBrush,syncEnabled:m,margin:e,tooltip:X,onPointClick:pe,plotLabel:Z,formatValue:te,formatX:ne})})}0&&(module.exports={LineChart});
|
|
@@ -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});
|