@synertech/ui 0.46.3 → 0.47.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/.claude/skills/use-synertech-ui/SKILL.md +102 -3
  2. package/README.md +50 -0
  3. package/dist/components/area-chart/AreaChart.cjs +1 -1
  4. package/dist/components/area-chart/AreaChart.js +1 -1
  5. package/dist/components/badge/Badge.cjs +1 -1
  6. package/dist/components/badge/Badge.js +1 -1
  7. package/dist/components/bar-chart/BarChart.cjs +1 -1
  8. package/dist/components/bar-chart/BarChart.js +1 -1
  9. package/dist/components/box-plot/BoxPlot.cjs +1 -1
  10. package/dist/components/box-plot/BoxPlot.js +1 -1
  11. package/dist/components/breadcrumb/Breadcrumb.cjs +1 -1
  12. package/dist/components/breadcrumb/Breadcrumb.js +1 -1
  13. package/dist/components/bullet-chart/BulletChart.cjs +1 -1
  14. package/dist/components/bullet-chart/BulletChart.js +1 -1
  15. package/dist/components/button/Button.cjs +1 -1
  16. package/dist/components/button/Button.js +1 -1
  17. package/dist/components/calendar/Calendar.cjs +1 -1
  18. package/dist/components/calendar/Calendar.js +1 -1
  19. package/dist/components/candlestick-chart/CandlestickChart.cjs +1 -1
  20. package/dist/components/candlestick-chart/CandlestickChart.js +1 -1
  21. package/dist/components/chart/ChartBrush.cjs +1 -1
  22. package/dist/components/chart/ChartBrush.js +1 -1
  23. package/dist/components/chart/ChartContainer.cjs +1 -1
  24. package/dist/components/chart/ChartContainer.js +1 -1
  25. package/dist/components/chart/ChartExportButton.cjs +1 -1
  26. package/dist/components/chart/ChartExportButton.js +1 -1
  27. package/dist/components/chart/ChartLegend.cjs +1 -1
  28. package/dist/components/chart/ChartLegend.js +1 -1
  29. package/dist/components/chart/ChartPeriodPicker.cjs +1 -1
  30. package/dist/components/chart/ChartPeriodPicker.js +1 -1
  31. package/dist/components/checkbox/Checkbox.cjs +1 -1
  32. package/dist/components/checkbox/Checkbox.js +1 -1
  33. package/dist/components/checkbox/CheckboxGroup.cjs +1 -1
  34. package/dist/components/checkbox/CheckboxGroup.js +1 -1
  35. package/dist/components/chip/Chip.cjs +1 -1
  36. package/dist/components/chip/Chip.js +1 -1
  37. package/dist/components/circular-progress/CircularProgress.cjs +1 -1
  38. package/dist/components/circular-progress/CircularProgress.js +1 -1
  39. package/dist/components/datagrid/DataGrid.cjs +1 -1
  40. package/dist/components/datagrid/DataGrid.js +1 -1
  41. package/dist/components/dropdown/DropdownCheckboxItem.cjs +1 -1
  42. package/dist/components/dropdown/DropdownCheckboxItem.js +1 -1
  43. package/dist/components/dropdown/DropdownRadio.cjs +1 -1
  44. package/dist/components/dropdown/DropdownRadio.js +1 -1
  45. package/dist/components/dropdown/DropdownTrigger.cjs +1 -1
  46. package/dist/components/dropdown/DropdownTrigger.js +1 -1
  47. package/dist/components/dumbbell-chart/DumbbellChart.cjs +1 -1
  48. package/dist/components/dumbbell-chart/DumbbellChart.js +1 -1
  49. package/dist/components/file-selector/FileSelector.cjs +1 -1
  50. package/dist/components/file-selector/FileSelector.js +1 -1
  51. package/dist/components/footer/FooterLink.cjs +1 -1
  52. package/dist/components/footer/FooterLink.js +1 -1
  53. package/dist/components/footer/FooterSocial.cjs +1 -1
  54. package/dist/components/footer/FooterSocial.js +1 -1
  55. package/dist/components/form/number-input/NumberInput.cjs +1 -1
  56. package/dist/components/form/number-input/NumberInput.js +1 -1
  57. package/dist/components/funnel-chart/FunnelChart.cjs +1 -1
  58. package/dist/components/funnel-chart/FunnelChart.js +1 -1
  59. package/dist/components/gantt-chart/GanttChart.cjs +1 -1
  60. package/dist/components/gantt-chart/GanttChart.js +1 -1
  61. package/dist/components/header/Header.cjs +1 -1
  62. package/dist/components/header/Header.js +1 -1
  63. package/dist/components/heat-map/Heatmap.cjs +1 -1
  64. package/dist/components/heat-map/Heatmap.js +1 -1
  65. package/dist/components/help-button/HelpButton.cjs +6 -6
  66. package/dist/components/help-button/HelpButton.js +7 -7
  67. package/dist/components/help-button/sanitize-html.cjs +1 -0
  68. package/dist/components/help-button/sanitize-html.js +1 -0
  69. package/dist/components/image-uploader/ImageUploader.cjs +1 -1
  70. package/dist/components/image-uploader/ImageUploader.js +1 -1
  71. package/dist/components/indicator/Indicator.cjs +1 -1
  72. package/dist/components/indicator/Indicator.js +1 -1
  73. package/dist/components/label/Label.cjs +1 -1
  74. package/dist/components/label/Label.js +1 -1
  75. package/dist/components/line-chart/LineChart.cjs +1 -1
  76. package/dist/components/line-chart/LineChart.js +1 -1
  77. package/dist/components/modal/Modal.cjs +1 -1
  78. package/dist/components/modal/Modal.js +1 -1
  79. package/dist/components/pagination/Pagination.cjs +1 -1
  80. package/dist/components/pagination/Pagination.js +1 -1
  81. package/dist/components/pie-chart/PieChart.cjs +1 -1
  82. package/dist/components/pie-chart/PieChart.js +1 -1
  83. package/dist/components/progress-bar/ProgressBar.cjs +1 -1
  84. package/dist/components/progress-bar/ProgressBar.js +1 -1
  85. package/dist/components/radio-button/RadioButton.cjs +1 -1
  86. package/dist/components/radio-button/RadioButton.js +1 -1
  87. package/dist/components/scatter-chart/ScatterChart.cjs +1 -1
  88. package/dist/components/scatter-chart/ScatterChart.js +1 -1
  89. package/dist/components/schema-editor/SchemaEditor.cjs +1 -1
  90. package/dist/components/schema-editor/SchemaEditor.js +1 -1
  91. package/dist/components/schema-editor/tables/SchemaTableRenderer.cjs +1 -1
  92. package/dist/components/schema-editor/tables/SchemaTableRenderer.js +1 -1
  93. package/dist/components/select/Select.cjs +1 -1
  94. package/dist/components/select/Select.js +1 -1
  95. package/dist/components/sidebar/Sidebar.cjs +1 -1
  96. package/dist/components/sidebar/Sidebar.js +1 -1
  97. package/dist/components/slider/Slider.cjs +1 -1
  98. package/dist/components/slider/Slider.js +1 -1
  99. package/dist/components/tabs/TabsContent.cjs +1 -1
  100. package/dist/components/tabs/TabsContent.js +1 -1
  101. package/dist/components/tabs/TabsTrigger.cjs +1 -1
  102. package/dist/components/tabs/TabsTrigger.js +1 -1
  103. package/dist/components/waterfall-chart/WaterfallChart.cjs +1 -1
  104. package/dist/components/waterfall-chart/WaterfallChart.js +1 -1
  105. package/dist/components/wizard/Wizard.cjs +1 -1
  106. package/dist/components/wizard/Wizard.js +1 -1
  107. package/dist/components/workflow-editor/edges/WorkflowEdgeRenderer.cjs +1 -1
  108. package/dist/components/workflow-editor/edges/WorkflowEdgeRenderer.js +1 -1
  109. package/dist/components/workflow-editor/nodes/WorkflowNodeRenderer.cjs +1 -1
  110. package/dist/components/workflow-editor/nodes/WorkflowNodeRenderer.js +1 -1
  111. package/dist/index.d.cts +170 -12
  112. package/dist/index.d.ts +170 -12
  113. package/dist/lib/safe-href.cjs +1 -0
  114. package/dist/lib/safe-href.js +1 -0
  115. package/dist/styles.css +618 -249
  116. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
- "use client";import{useState as x,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:b="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]=x(!1),[l,p]=x(!1),[v,y]=x(""),[T,k]=x(!1),[O,o]=x(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[b]}
1
+ "use client";import{useState as b,useRef as C,useEffect as W,useCallback as B}from"react";import K from"react-markdown";import G from"remark-gfm";import{useUILabels as q}from"../../lib/i18n.js";import{sanitizeHelpHtml as V}from"./sanitize-html.js";import{Fragment as ne,jsx as e,jsxs as n}from"react/jsx-runtime";var j=n("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=n("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=n("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=n("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=n("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=[G],re=["img"],oe={h1:({node:o,...t})=>e("h1",{className:"text-xl font-bold mb-2 text-gray-900 dark:text-gray-100",...t}),h2:({node:o,...t})=>e("h2",{className:"text-lg font-semibold mt-4 mb-2 text-gray-900 dark:text-gray-100",...t}),h3:({node:o,...t})=>e("h3",{className:"text-base font-semibold mt-3 mb-1 text-gray-900 dark:text-gray-100",...t}),p:({node:o,...t})=>e("p",{className:"my-1 text-gray-700 dark:text-gray-300",...t}),ul:({node:o,...t})=>e("ul",{className:"list-disc list-inside space-y-1 my-2 text-gray-700 dark:text-gray-300",...t}),ol:({node:o,...t})=>e("ol",{className:"list-decimal list-inside space-y-1 my-2 text-gray-700 dark:text-gray-300",...t}),code:({node:o,className:t,children:i,...d})=>!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",...d,children:i}):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",...d,children:i}),pre:({node:o,...t})=>e("pre",{className:"my-2",...t}),a:({node:o,...t})=>e("a",{className:"text-synertech-primary-600 dark:text-synertech-primary-400 hover:underline",...t}),strong:({node:o,...t})=>e("strong",{className:"font-semibold text-gray-900 dark:text-gray-100",...t}),em:({node:o,...t})=>e("em",{className:"italic",...t}),blockquote:({node:o,...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 ae({content:o,markdown:t=!1,position:i="bottom",size:d="sm",className:f="",visible:_=!0,editable:h=!1,onSave:g,onReset:c,width:R="md",title:m,markdownEditor:v,markdownEditorUnavailableLabel:L,labels:M}){let r=q(M),[p,S]=b(!1),[l,y]=b(!1),[k,x]=b(""),[I,N]=b(!1),[T,a]=b(null),H=C(null),O=C(null),P=C(null),s=C(null);W(()=>{if(!p)return;let u=E=>{H.current&&!H.current.contains(E.target)&&O.current&&!O.current.contains(E.target)&&(l||S(!1))},z=E=>{E.key==="Escape"&&(l?(y(!1),x("")):S(!1))};return document.addEventListener("mousedown",u),document.addEventListener("keydown",z),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",z)}},[p,l]),W(()=>{l&&P.current&&P.current.focus()},[l]),W(()=>()=>{s.current&&clearTimeout(s.current)},[]);let A=B(()=>{x(typeof o=="string"?o:""),y(!0),a(null)},[o]),D=B(()=>{y(!1),x(""),a(null)},[]),U=B(async()=>{if(!g){a({type:"error",text:r.helpButtonNoSave});return}N(!0);try{await g(k)?(a({type:"success",text:r.helpButtonSaved}),y(!1),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>a(null),2e3)):a({type:"error",text:r.helpButtonSaveError})}catch{a({type:"error",text:r.helpButtonSaveError})}finally{N(!1)}},[k,g,r]),$=B(async()=>{if(c&&confirm(r.helpButtonResetConfirm)){N(!0);try{await c()?(a({type:"success",text:r.helpButtonResetDone}),y(!1),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>a(null),2e3)):a({type:"error",text:r.helpButtonResetError})}catch{a({type:"error",text:r.helpButtonResetError})}finally{N(!1)}}},[c,r]),w=o;return _?n("div",{className:"relative inline-flex items-center",children:[e("button",{type:"button",ref:H,onClick:()=>S(!p),className:`
2
+ ${Y[d]}
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
@@ -9,14 +9,14 @@
9
9
  hover:text-gray-700 dark:hover:text-gray-200
10
10
  hover:border-gray-400 dark:hover:border-gray-500
11
11
  transition-all duration-150
12
- focus:outline-none focus:ring-2 focus:ring-blue-500/50
13
- ${B}
14
- `,"aria-label":r.helpButtonShow,"aria-expanded":m,children:e("span",{className:"font-medium",children:"?"})}),m&&a("div",{ref:H,className:`
12
+ focus:outline-none focus:ring-2 focus:ring-synertech-primary-500/50
13
+ ${f}
14
+ `,"aria-label":r.helpButtonShow,"aria-expanded":p,children:e("span",{className:"font-medium",children:"?"})}),p&&n("div",{ref:O,className:`
15
15
  absolute z-50 ${Z[i]}
16
- ${ee[M]} max-h-[80vh] overflow-hidden flex flex-col
16
+ ${ee[R]} 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:[(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-700 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 dark:text-gray-400 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-700 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 dark:text-gray-400 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-700 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-700 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:b="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:b,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};
22
+ `,role:"tooltip",children:[(m||h)&&n("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:m&&e("h3",{className:"text-sm font-semibold",children:m})}),h&&e("div",{className:"flex items-center gap-1",children:l?n(ne,{children:[e("button",{type:"button",onClick:U,disabled:I,className:"p-1.5 rounded-md hover:bg-green-100 dark:hover:bg-green-900/30 text-green-700 dark:text-green-400 transition-colors disabled:opacity-50 cursor-pointer",title:r.helpButtonSave,children:I?X:F}),e("button",{type:"button",onClick:D,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:r.helpButtonCancel,children:J}),c&&e("button",{type:"button",onClick:$,disabled:I,className:"p-1.5 rounded-md hover:bg-orange-100 dark:hover:bg-orange-900/30 text-orange-700 dark:text-orange-400 transition-colors disabled:opacity-50 cursor-pointer",title:r.helpButtonReset,children:Q})]}):e("button",{type:"button",onClick:A,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:r.helpButtonEdit,children:j})})]}),T&&e("div",{className:`px-4 py-2 text-xs ${T.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400"}`,children:T.text}),e("div",{className:"flex-1 overflow-y-auto p-4",children:l?t?v?e(v,{value:k,onChange:x,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:P,"aria-label":r.helpButtonContent,value:k,onChange:u=>x(u.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-synertech-primary-500/50 text-gray-700 dark:text-gray-300 font-mono",placeholder:r.helpButtonContentPlaceholder})}):typeof w=="string"?e("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:t?e(K,{remarkPlugins:te,components:oe,disallowedElements:re,children:w}):e("div",{dangerouslySetInnerHTML:{__html:V(w)}})}):w})]})]}):null}function ue({children:o,content:t,markdown:i=!1,position:d="bottom",size:f="sm",visible:_=!0,editable:h=!1,onSave:g,onReset:c,width:R="md",title:m,className:v,markdownEditor:L,markdownEditorUnavailableLabel:M,labels:r}){return n("div",{className:"inline-flex items-center gap-2.5",children:[o,e(ae,{content:t,markdown:i,position:d,size:f,visible:_,editable:h,onSave:g,onReset:c,width:R,title:m,className:v,markdownEditor:L,markdownEditorUnavailableLabel:M,labels:r})]})}export{ae as HelpButton,ue as WithHelpButton};
@@ -0,0 +1 @@
1
+ "use strict";var a=Object.create;var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var A=(t,e)=>{for(var n in e)i(t,n,{get:e[n],enumerable:!0})},f=(t,e,n,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of d(e))!p.call(t,r)&&r!==n&&i(t,r,{get:()=>e[r],enumerable:!(l=c(e,r))||l.enumerable});return t};var L=(t,e,n)=>(n=t!=null?a(h(t)):{},f(e||!t||!t.__esModule?i(n,"default",{value:t,enumerable:!0}):n,t)),T=t=>f(i({},"__esModule",{value:!0}),t);var y={};A(y,{sanitizeHelpHtml:()=>S});module.exports=T(y);var u=L(require("dompurify"),1),s=require("../../lib/safe-href.cjs"),b=["h1","h2","h3","h4","h5","h6","p","br","hr","blockquote","pre","div","span","ul","ol","li","table","thead","tbody","tr","th","td","a","strong","b","em","i","del","s","code","kbd"],g={ALLOWED_TAGS:b,ALLOWED_ATTR:["href","title"],ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1};function m(t){try{let e=new URL(t,window.location.href);return(e.protocol==="http:"||e.protocol==="https:")&&e.origin!==window.location.origin}catch{return!1}}function _(t){if(t.nodeType!==1)return;let e=t,n=e.getAttribute("href");if(n!==null){if(e.tagName!=="A"||(0,s.safeHref)(n)===void 0){e.removeAttribute("href");return}m(n)&&e.setAttribute("rel","noopener noreferrer")}}var o=null;function w(){if(o)return o;if(typeof window>"u")return null;let t=(0,u.default)(window);return t.isSupported?(t.addHook("afterSanitizeAttributes",_),o=t,o):null}function S(t){let e=w();return e?e.sanitize(t,g):""}0&&(module.exports={sanitizeHelpHtml});
@@ -0,0 +1 @@
1
+ import i from"dompurify";import{safeHref as o}from"../../lib/safe-href.js";var l=["h1","h2","h3","h4","h5","h6","p","br","hr","blockquote","pre","div","span","ul","ol","li","table","thead","tbody","tr","th","td","a","strong","b","em","i","del","s","code","kbd"],f={ALLOWED_TAGS:l,ALLOWED_ATTR:["href","title"],ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1};function u(e){try{let t=new URL(e,window.location.href);return(t.protocol==="http:"||t.protocol==="https:")&&t.origin!==window.location.origin}catch{return!1}}function s(e){if(e.nodeType!==1)return;let t=e,r=t.getAttribute("href");if(r!==null){if(t.tagName!=="A"||o(r)===void 0){t.removeAttribute("href");return}u(r)&&t.setAttribute("rel","noopener noreferrer")}}var n=null;function a(){if(n)return n;if(typeof window>"u")return null;let e=i(window);return e.isSupported?(e.addHook("afterSanitizeAttributes",s),n=e,n):null}function h(e){let t=a();return t?t.sanitize(e,f):""}export{h as sanitizeHelpHtml};
@@ -1 +1 @@
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-600 text-white rounded-full w-6 h-6 flex items-center justify-center text-xs hover:bg-red-700 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-700 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
+ "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 y=g.target?.result;s(y)},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:y,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,[f,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-600 text-white rounded-full w-6 h-6 flex items-center justify-center text-xs hover:bg-red-700 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||f}),(0,r.jsx)("button",{type:"button",onClick:T,disabled:b||f,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:f?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-synertech-primary-500 focus:border-synertech-primary-500 dark:bg-gray-800 dark:text-gray-200 disabled:opacity-50 disabled:cursor-not-allowed"})]}),I&&(0,r.jsxs)("div",{className:"text-red-700 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:y||F})]})}0&&(module.exports={ImageUploader});
@@ -1 +1 @@
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-600 text-white rounded-full w-6 h-6 flex items-center justify-center text-xs hover:bg-red-700 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-700 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
+ "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 y=n.target?.result;i(y)},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:y,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,[f,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-600 text-white rounded-full w-6 h-6 flex items-center justify-center text-xs hover:bg-red-700 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||f}),a("button",{type:"button",onClick:H,disabled:p||f,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:f?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-synertech-primary-500 focus:border-synertech-primary-500 dark:bg-gray-800 dark:text-gray-200 disabled:opacity-50 disabled:cursor-not-allowed"})]}),k&&m("div",{className:"text-red-700 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:y||R})]})}export{W as ImageUploader};
@@ -1 +1 @@
1
- "use strict";var g=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var r in t)g(e,r,{get:t[r],enumerable:!0})},P=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of w(t))!I.call(e,n)&&n!==r&&g(e,n,{get:()=>t[n],enumerable:!(a=y(t,n))||a.enumerable});return e};var k=e=>P(g({},"__esModule",{value:!0}),e);var W={};C(W,{Indicator:()=>b});module.exports=k(W);var i=require("../../lib/cn.cjs"),o=require("react/jsx-runtime"),m={default:"bg-gray-400",primary:"bg-blue-600",success:"bg-green-500",warning:"bg-yellow-400",error:"bg-red-500",info:"bg-cyan-500",dark:"bg-gray-900 dark:bg-gray-700",purple:"bg-purple-600",indigo:"bg-indigo-600",teal:"bg-teal-500"},z={default:"bg-gray-500 text-white",primary:"bg-blue-600 text-white",success:"bg-green-700 text-white",warning:"bg-yellow-400 text-gray-900",error:"bg-red-600 text-white",info:"bg-cyan-700 text-white",dark:"bg-gray-900 text-white dark:bg-gray-700",purple:"bg-purple-600 text-white",indigo:"bg-indigo-600 text-white",teal:"bg-teal-700 text-white"},p={xs:"w-2 h-2",sm:"w-2.5 h-2.5",md:"w-3 h-3",lg:"w-3.5 h-3.5",xl:"w-4 h-4"},N={xs:"min-w-4 h-4 text-[10px] px-1",sm:"min-w-5 h-5 text-xs px-1",md:"min-w-5 h-5 text-xs px-1.5",lg:"min-w-6 h-6 text-sm px-1.5",xl:"min-w-7 h-7 text-sm px-2"},u={"top-left":"top-0 left-0 -translate-x-1/2 -translate-y-1/2","top-center":"top-0 left-1/2 -translate-x-1/2 -translate-y-1/2","top-right":"top-0 right-0 translate-x-1/2 -translate-y-1/2","center-left":"top-1/2 left-0 -translate-x-1/2 -translate-y-1/2",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","center-right":"top-1/2 right-0 translate-x-1/2 -translate-y-1/2","bottom-left":"bottom-0 left-0 -translate-x-1/2 translate-y-1/2","bottom-center":"bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2","bottom-right":"bottom-0 right-0 translate-x-1/2 translate-y-1/2"},f={"top-left":"top-0 left-0","top-center":"top-0 left-1/2 -translate-x-1/2","top-right":"top-0 right-0","center-left":"top-1/2 left-0 -translate-y-1/2",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","center-right":"top-1/2 right-0 -translate-y-1/2","bottom-left":"bottom-0 left-0","bottom-center":"bottom-0 left-1/2 -translate-x-1/2","bottom-right":"bottom-0 right-0"};function R(e,t){return e>t?`${t}+`:`${e}`}function v({color:e="primary",size:t="md",placement:r="top-right",bordered:a=!1,borderColor:n,pulse:l=!1,offset:s=!1,className:c,...d}){return(0,o.jsx)("span",{"data-testid":"indicator",className:(0,i.cn)("absolute z-10 rounded-full",m[e],p[t],s?f[r]:u[r],a&&(0,i.cn)("ring-2 ring-white dark:ring-gray-900",n),l&&"animate-pulse",c),...d})}function S({color:e="error",size:t="md",placement:r="top-right",count:a=0,maxCount:n=99,bordered:l=!1,borderColor:s,pulse:c=!1,offset:d=!1,className:x,...h}){return(0,o.jsx)("span",{"data-testid":"indicator",className:(0,i.cn)("absolute z-10 inline-flex items-center justify-center rounded-full font-semibold",z[e],N[t],d?f[r]:u[r],l&&(0,i.cn)("ring-2 ring-white dark:ring-gray-900",s),c&&"animate-pulse",x),...h,children:R(a,n)})}function O({color:e="success",size:t="md",placement:r="bottom-right",bordered:a=!0,borderColor:n,pulse:l=!1,offset:s=!1,className:c,...d}){return(0,o.jsx)("span",{"data-testid":"indicator",className:(0,i.cn)("absolute z-10 rounded-full",m[e],p[t],s?f[r]:u[r],a&&(0,i.cn)("ring-2 ring-white dark:ring-gray-900",n),l&&"animate-pulse",c),...d})}function V({color:e="primary",size:t="sm",label:r,className:a,...n}){return(0,o.jsxs)("span",{"data-testid":"indicator",className:(0,i.cn)("inline-flex items-center gap-2",a),...n,children:[(0,o.jsx)("span",{className:(0,i.cn)("rounded-full shrink-0",m[e],p[t])}),r?(0,o.jsx)("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:r}):null]})}function b({variant:e="dot",children:t,...r}){if(e==="legend")return(0,o.jsx)(V,{...r});let a=(()=>{switch(e){case"count":return(0,o.jsx)(S,{...r});case"status":return(0,o.jsx)(O,{...r});default:return(0,o.jsx)(v,{...r})}})();return t?(0,o.jsxs)("div",{className:"relative inline-flex",children:[t,a]}):a}b.displayName="Indicator";0&&(module.exports={Indicator});
1
+ "use strict";var g=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var r in t)g(e,r,{get:t[r],enumerable:!0})},P=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of w(t))!I.call(e,a)&&a!==r&&g(e,a,{get:()=>t[a],enumerable:!(n=y(t,a))||n.enumerable});return e};var k=e=>P(g({},"__esModule",{value:!0}),e);var W={};C(W,{Indicator:()=>b});module.exports=k(W);var i=require("../../lib/cn.cjs"),o=require("react/jsx-runtime"),m={default:"bg-gray-400",primary:"bg-synertech-primary-600",success:"bg-green-500",warning:"bg-yellow-400",error:"bg-red-500",info:"bg-cyan-500",dark:"bg-gray-900 dark:bg-gray-700",purple:"bg-purple-600",indigo:"bg-indigo-600",teal:"bg-teal-500"},z={default:"bg-gray-500 text-white",primary:"bg-synertech-primary-600 text-synertech-on-primary",success:"bg-green-700 text-white",warning:"bg-yellow-400 text-gray-900",error:"bg-red-600 text-white",info:"bg-cyan-700 text-white",dark:"bg-gray-900 text-white dark:bg-gray-700",purple:"bg-purple-600 text-white",indigo:"bg-indigo-600 text-white",teal:"bg-teal-700 text-white"},p={xs:"w-2 h-2",sm:"w-2.5 h-2.5",md:"w-3 h-3",lg:"w-3.5 h-3.5",xl:"w-4 h-4"},N={xs:"min-w-4 h-4 text-[10px] px-1",sm:"min-w-5 h-5 text-xs px-1",md:"min-w-5 h-5 text-xs px-1.5",lg:"min-w-6 h-6 text-sm px-1.5",xl:"min-w-7 h-7 text-sm px-2"},u={"top-left":"top-0 left-0 -translate-x-1/2 -translate-y-1/2","top-center":"top-0 left-1/2 -translate-x-1/2 -translate-y-1/2","top-right":"top-0 right-0 translate-x-1/2 -translate-y-1/2","center-left":"top-1/2 left-0 -translate-x-1/2 -translate-y-1/2",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","center-right":"top-1/2 right-0 translate-x-1/2 -translate-y-1/2","bottom-left":"bottom-0 left-0 -translate-x-1/2 translate-y-1/2","bottom-center":"bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2","bottom-right":"bottom-0 right-0 translate-x-1/2 translate-y-1/2"},f={"top-left":"top-0 left-0","top-center":"top-0 left-1/2 -translate-x-1/2","top-right":"top-0 right-0","center-left":"top-1/2 left-0 -translate-y-1/2",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","center-right":"top-1/2 right-0 -translate-y-1/2","bottom-left":"bottom-0 left-0","bottom-center":"bottom-0 left-1/2 -translate-x-1/2","bottom-right":"bottom-0 right-0"};function R(e,t){return e>t?`${t}+`:`${e}`}function v({color:e="primary",size:t="md",placement:r="top-right",bordered:n=!1,borderColor:a,pulse:s=!1,offset:l=!1,className:c,...d}){return(0,o.jsx)("span",{"data-testid":"indicator",className:(0,i.cn)("absolute z-10 rounded-full",m[e],p[t],l?f[r]:u[r],n&&(0,i.cn)("ring-2 ring-white dark:ring-gray-900",a),s&&"animate-pulse",c),...d})}function S({color:e="error",size:t="md",placement:r="top-right",count:n=0,maxCount:a=99,bordered:s=!1,borderColor:l,pulse:c=!1,offset:d=!1,className:x,...h}){return(0,o.jsx)("span",{"data-testid":"indicator",className:(0,i.cn)("absolute z-10 inline-flex items-center justify-center rounded-full font-semibold",z[e],N[t],d?f[r]:u[r],s&&(0,i.cn)("ring-2 ring-white dark:ring-gray-900",l),c&&"animate-pulse",x),...h,children:R(n,a)})}function O({color:e="success",size:t="md",placement:r="bottom-right",bordered:n=!0,borderColor:a,pulse:s=!1,offset:l=!1,className:c,...d}){return(0,o.jsx)("span",{"data-testid":"indicator",className:(0,i.cn)("absolute z-10 rounded-full",m[e],p[t],l?f[r]:u[r],n&&(0,i.cn)("ring-2 ring-white dark:ring-gray-900",a),s&&"animate-pulse",c),...d})}function V({color:e="primary",size:t="sm",label:r,className:n,...a}){return(0,o.jsxs)("span",{"data-testid":"indicator",className:(0,i.cn)("inline-flex items-center gap-2",n),...a,children:[(0,o.jsx)("span",{className:(0,i.cn)("rounded-full shrink-0",m[e],p[t])}),r?(0,o.jsx)("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:r}):null]})}function b({variant:e="dot",children:t,...r}){if(e==="legend")return(0,o.jsx)(V,{...r});let n=(()=>{switch(e){case"count":return(0,o.jsx)(S,{...r});case"status":return(0,o.jsx)(O,{...r});default:return(0,o.jsx)(v,{...r})}})();return t?(0,o.jsxs)("div",{className:"relative inline-flex",children:[t,n]}):n}b.displayName="Indicator";0&&(module.exports={Indicator});
@@ -1 +1 @@
1
- import{cn as o}from"../../lib/cn.js";import{jsx as n,jsxs as f}from"react/jsx-runtime";var g={default:"bg-gray-400",primary:"bg-blue-600",success:"bg-green-500",warning:"bg-yellow-400",error:"bg-red-500",info:"bg-cyan-500",dark:"bg-gray-900 dark:bg-gray-700",purple:"bg-purple-600",indigo:"bg-indigo-600",teal:"bg-teal-500"},h={default:"bg-gray-500 text-white",primary:"bg-blue-600 text-white",success:"bg-green-700 text-white",warning:"bg-yellow-400 text-gray-900",error:"bg-red-600 text-white",info:"bg-cyan-700 text-white",dark:"bg-gray-900 text-white dark:bg-gray-700",purple:"bg-purple-600 text-white",indigo:"bg-indigo-600 text-white",teal:"bg-teal-700 text-white"},m={xs:"w-2 h-2",sm:"w-2.5 h-2.5",md:"w-3 h-3",lg:"w-3.5 h-3.5",xl:"w-4 h-4"},y={xs:"min-w-4 h-4 text-[10px] px-1",sm:"min-w-5 h-5 text-xs px-1",md:"min-w-5 h-5 text-xs px-1.5",lg:"min-w-6 h-6 text-sm px-1.5",xl:"min-w-7 h-7 text-sm px-2"},p={"top-left":"top-0 left-0 -translate-x-1/2 -translate-y-1/2","top-center":"top-0 left-1/2 -translate-x-1/2 -translate-y-1/2","top-right":"top-0 right-0 translate-x-1/2 -translate-y-1/2","center-left":"top-1/2 left-0 -translate-x-1/2 -translate-y-1/2",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","center-right":"top-1/2 right-0 translate-x-1/2 -translate-y-1/2","bottom-left":"bottom-0 left-0 -translate-x-1/2 translate-y-1/2","bottom-center":"bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2","bottom-right":"bottom-0 right-0 translate-x-1/2 translate-y-1/2"},u={"top-left":"top-0 left-0","top-center":"top-0 left-1/2 -translate-x-1/2","top-right":"top-0 right-0","center-left":"top-1/2 left-0 -translate-y-1/2",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","center-right":"top-1/2 right-0 -translate-y-1/2","bottom-left":"bottom-0 left-0","bottom-center":"bottom-0 left-1/2 -translate-x-1/2","bottom-right":"bottom-0 right-0"};function w(e,r){return e>r?`${r}+`:`${e}`}function I({color:e="primary",size:r="md",placement:t="top-right",bordered:a=!1,borderColor:i,pulse:l=!1,offset:s=!1,className:c,...d}){return n("span",{"data-testid":"indicator",className:o("absolute z-10 rounded-full",g[e],m[r],s?u[t]:p[t],a&&o("ring-2 ring-white dark:ring-gray-900",i),l&&"animate-pulse",c),...d})}function C({color:e="error",size:r="md",placement:t="top-right",count:a=0,maxCount:i=99,bordered:l=!1,borderColor:s,pulse:c=!1,offset:d=!1,className:b,...x}){return n("span",{"data-testid":"indicator",className:o("absolute z-10 inline-flex items-center justify-center rounded-full font-semibold",h[e],y[r],d?u[t]:p[t],l&&o("ring-2 ring-white dark:ring-gray-900",s),c&&"animate-pulse",b),...x,children:w(a,i)})}function P({color:e="success",size:r="md",placement:t="bottom-right",bordered:a=!0,borderColor:i,pulse:l=!1,offset:s=!1,className:c,...d}){return n("span",{"data-testid":"indicator",className:o("absolute z-10 rounded-full",g[e],m[r],s?u[t]:p[t],a&&o("ring-2 ring-white dark:ring-gray-900",i),l&&"animate-pulse",c),...d})}function k({color:e="primary",size:r="sm",label:t,className:a,...i}){return f("span",{"data-testid":"indicator",className:o("inline-flex items-center gap-2",a),...i,children:[n("span",{className:o("rounded-full shrink-0",g[e],m[r])}),t?n("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:t}):null]})}function z({variant:e="dot",children:r,...t}){if(e==="legend")return n(k,{...t});let a=(()=>{switch(e){case"count":return n(C,{...t});case"status":return n(P,{...t});default:return n(I,{...t})}})();return r?f("div",{className:"relative inline-flex",children:[r,a]}):a}z.displayName="Indicator";export{z as Indicator};
1
+ import{cn as o}from"../../lib/cn.js";import{jsx as a,jsxs as f}from"react/jsx-runtime";var g={default:"bg-gray-400",primary:"bg-synertech-primary-600",success:"bg-green-500",warning:"bg-yellow-400",error:"bg-red-500",info:"bg-cyan-500",dark:"bg-gray-900 dark:bg-gray-700",purple:"bg-purple-600",indigo:"bg-indigo-600",teal:"bg-teal-500"},h={default:"bg-gray-500 text-white",primary:"bg-synertech-primary-600 text-synertech-on-primary",success:"bg-green-700 text-white",warning:"bg-yellow-400 text-gray-900",error:"bg-red-600 text-white",info:"bg-cyan-700 text-white",dark:"bg-gray-900 text-white dark:bg-gray-700",purple:"bg-purple-600 text-white",indigo:"bg-indigo-600 text-white",teal:"bg-teal-700 text-white"},m={xs:"w-2 h-2",sm:"w-2.5 h-2.5",md:"w-3 h-3",lg:"w-3.5 h-3.5",xl:"w-4 h-4"},y={xs:"min-w-4 h-4 text-[10px] px-1",sm:"min-w-5 h-5 text-xs px-1",md:"min-w-5 h-5 text-xs px-1.5",lg:"min-w-6 h-6 text-sm px-1.5",xl:"min-w-7 h-7 text-sm px-2"},p={"top-left":"top-0 left-0 -translate-x-1/2 -translate-y-1/2","top-center":"top-0 left-1/2 -translate-x-1/2 -translate-y-1/2","top-right":"top-0 right-0 translate-x-1/2 -translate-y-1/2","center-left":"top-1/2 left-0 -translate-x-1/2 -translate-y-1/2",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","center-right":"top-1/2 right-0 translate-x-1/2 -translate-y-1/2","bottom-left":"bottom-0 left-0 -translate-x-1/2 translate-y-1/2","bottom-center":"bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2","bottom-right":"bottom-0 right-0 translate-x-1/2 translate-y-1/2"},u={"top-left":"top-0 left-0","top-center":"top-0 left-1/2 -translate-x-1/2","top-right":"top-0 right-0","center-left":"top-1/2 left-0 -translate-y-1/2",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","center-right":"top-1/2 right-0 -translate-y-1/2","bottom-left":"bottom-0 left-0","bottom-center":"bottom-0 left-1/2 -translate-x-1/2","bottom-right":"bottom-0 right-0"};function w(e,r){return e>r?`${r}+`:`${e}`}function I({color:e="primary",size:r="md",placement:t="top-right",bordered:n=!1,borderColor:i,pulse:s=!1,offset:l=!1,className:c,...d}){return a("span",{"data-testid":"indicator",className:o("absolute z-10 rounded-full",g[e],m[r],l?u[t]:p[t],n&&o("ring-2 ring-white dark:ring-gray-900",i),s&&"animate-pulse",c),...d})}function C({color:e="error",size:r="md",placement:t="top-right",count:n=0,maxCount:i=99,bordered:s=!1,borderColor:l,pulse:c=!1,offset:d=!1,className:b,...x}){return a("span",{"data-testid":"indicator",className:o("absolute z-10 inline-flex items-center justify-center rounded-full font-semibold",h[e],y[r],d?u[t]:p[t],s&&o("ring-2 ring-white dark:ring-gray-900",l),c&&"animate-pulse",b),...x,children:w(n,i)})}function P({color:e="success",size:r="md",placement:t="bottom-right",bordered:n=!0,borderColor:i,pulse:s=!1,offset:l=!1,className:c,...d}){return a("span",{"data-testid":"indicator",className:o("absolute z-10 rounded-full",g[e],m[r],l?u[t]:p[t],n&&o("ring-2 ring-white dark:ring-gray-900",i),s&&"animate-pulse",c),...d})}function k({color:e="primary",size:r="sm",label:t,className:n,...i}){return f("span",{"data-testid":"indicator",className:o("inline-flex items-center gap-2",n),...i,children:[a("span",{className:o("rounded-full shrink-0",g[e],m[r])}),t?a("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:t}):null]})}function z({variant:e="dot",children:r,...t}){if(e==="legend")return a(k,{...t});let n=(()=>{switch(e){case"count":return a(C,{...t});case"status":return a(P,{...t});default:return a(I,{...t})}})();return r?f("div",{className:"relative inline-flex",children:[r,n]}):n}z.displayName="Indicator";export{z as Indicator};
@@ -1 +1 @@
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-600 dark:text-blue-300",strong:"text-blue-700 dark:text-blue-300"},secondary:{default:"text-purple-600 dark:text-purple-400",light:"text-purple-600 dark:text-purple-300",strong:"text-purple-700 dark:text-purple-300"},success:{default:"text-green-700 dark:text-green-400",light:"text-green-700 dark:text-green-300",strong:"text-green-800 dark:text-green-300"},warning:{default:"text-yellow-700 dark:text-yellow-400",light:"text-yellow-700 dark:text-yellow-300",strong:"text-yellow-800 dark:text-yellow-300"},error:{default:"text-red-600 dark:text-red-400",light:"text-red-600 dark:text-red-300",strong:"text-red-700 dark:text-red-300"},info:{default:"text-cyan-700 dark:text-cyan-400",light:"text-cyan-700 dark:text-cyan-300",strong:"text-cyan-800 dark:text-cyan-300"},muted:{default:"text-gray-500 dark:text-gray-400",light:"text-gray-500 dark:text-gray-400",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-600 dark:text-red-400 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-500 dark:text-gray-400 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
+ "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"},g={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-synertech-primary-600 dark:text-synertech-primary-400",light:"text-synertech-primary-600 dark:text-synertech-primary-300",strong:"text-synertech-primary-700 dark:text-synertech-primary-300"},secondary:{default:"text-purple-600 dark:text-purple-400",light:"text-purple-600 dark:text-purple-300",strong:"text-purple-700 dark:text-purple-300"},success:{default:"text-green-700 dark:text-green-400",light:"text-green-700 dark:text-green-300",strong:"text-green-800 dark:text-green-300"},warning:{default:"text-yellow-700 dark:text-yellow-400",light:"text-yellow-700 dark:text-yellow-300",strong:"text-yellow-800 dark:text-yellow-300"},error:{default:"text-red-600 dark:text-red-400",light:"text-red-600 dark:text-red-300",strong:"text-red-700 dark:text-red-300"},info:{default:"text-cyan-700 dark:text-cyan-400",light:"text-cyan-700 dark:text-cyan-300",strong:"text-cyan-800 dark:text-cyan-300"},muted:{default:"text-gray-500 dark:text-gray-400",light:"text-gray-500 dark:text-gray-400",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:y,required:n=!1,requiredIndicator:b="*",requiredLabel:u=i.serverUILabels.labelRequired,optional:h=!1,optionalText:f=i.serverUILabels.labelOptional,tooltip:k,icon:x,endIcon:c,disabled:p=!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=y||I[l][o];return(0,a.jsxs)(R,{className:(0,s.cn)(S,z,p?"opacity-50 cursor-not-allowed":"cursor-default",C),title:k,"aria-disabled":p,...N,children:[x&&(0,a.jsx)("span",{className:(0,s.cn)("shrink-0",g[e]),children:x}),(0,a.jsxs)("span",{className:(0,s.cn)(L&&"truncate"),children:[t,n&&(0,a.jsx)("span",{className:"text-red-600 dark:text-red-400 ml-0.5","aria-hidden":"true",children:b}),n&&(0,a.jsx)("span",{className:"sr-only",children:u})]}),h&&!n&&(0,a.jsx)("span",{className:"text-gray-500 dark:text-gray-400 font-normal",children:f}),c&&(0,a.jsx)("span",{className:(0,s.cn)("shrink-0",g[e]),children:c})]})}m.displayName="Label";0&&(module.exports={Label});
@@ -1 +1 @@
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-600 dark:text-blue-300",strong:"text-blue-700 dark:text-blue-300"},secondary:{default:"text-purple-600 dark:text-purple-400",light:"text-purple-600 dark:text-purple-300",strong:"text-purple-700 dark:text-purple-300"},success:{default:"text-green-700 dark:text-green-400",light:"text-green-700 dark:text-green-300",strong:"text-green-800 dark:text-green-300"},warning:{default:"text-yellow-700 dark:text-yellow-400",light:"text-yellow-700 dark:text-yellow-300",strong:"text-yellow-800 dark:text-yellow-300"},error:{default:"text-red-600 dark:text-red-400",light:"text-red-600 dark:text-red-300",strong:"text-red-700 dark:text-red-300"},info:{default:"text-cyan-700 dark:text-cyan-400",light:"text-cyan-700 dark:text-cyan-300",strong:"text-cyan-800 dark:text-cyan-300"},muted:{default:"text-gray-500 dark:text-gray-400",light:"text-gray-500 dark:text-gray-400",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-600 dark:text-red-400 ml-0.5","aria-hidden":"true",children:b}),r&&t("span",{className:"sr-only",children:u})]}),y&&!r&&t("span",{className:"text-gray-500 dark:text-gray-400 font-normal",children:f}),s&&t("span",{className:e("shrink-0",d[a]),children:s})]})}M.displayName="Label";export{M as Label};
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-synertech-primary-600 dark:text-synertech-primary-400",light:"text-synertech-primary-600 dark:text-synertech-primary-300",strong:"text-synertech-primary-700 dark:text-synertech-primary-300"},secondary:{default:"text-purple-600 dark:text-purple-400",light:"text-purple-600 dark:text-purple-300",strong:"text-purple-700 dark:text-purple-300"},success:{default:"text-green-700 dark:text-green-400",light:"text-green-700 dark:text-green-300",strong:"text-green-800 dark:text-green-300"},warning:{default:"text-yellow-700 dark:text-yellow-400",light:"text-yellow-700 dark:text-yellow-300",strong:"text-yellow-800 dark:text-yellow-300"},error:{default:"text-red-600 dark:text-red-400",light:"text-red-600 dark:text-red-300",strong:"text-red-700 dark:text-red-300"},info:{default:"text-cyan-700 dark:text-cyan-400",light:"text-cyan-700 dark:text-cyan-300",strong:"text-cyan-800 dark:text-cyan-300"},muted:{default:"text-gray-500 dark:text-gray-400",light:"text-gray-500 dark:text-gray-400",strong:"text-gray-600 dark:text-gray-300"}};function M({children:x,size:a="md",color:c="default",variant:p="default",weight:g="medium",textColor:m,required:r=!1,requiredIndicator:y="*",requiredLabel:b=n.labelRequired,optional:u=!1,optionalText:h=n.labelOptional,tooltip:f,icon:l,endIcon:s,disabled:o=!1,truncate:k=!1,as:L="label",className:w,...C}){let N=L,R=e("inline-flex items-center gap-1.5 transition-colors",z[a],T[g]),S=m||H[c][p];return i(N,{className:e(R,S,o?"opacity-50 cursor-not-allowed":"cursor-default",w),title:f,"aria-disabled":o,...C,children:[l&&t("span",{className:e("shrink-0",d[a]),children:l}),i("span",{className:e(k&&"truncate"),children:[x,r&&t("span",{className:"text-red-600 dark:text-red-400 ml-0.5","aria-hidden":"true",children:y}),r&&t("span",{className:"sr-only",children:b})]}),u&&!r&&t("span",{className:"text-gray-500 dark:text-gray-400 font-normal",children:h}),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 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
+ "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-synertech-primary-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 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
+ "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-synertech-primary-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 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 xe={};ge(xe,{Modal:()=>F});module.exports=ve(xe);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:x,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,h=(0,s.useId)(),y=`${h}-title`,p=`${h}-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?y:void 0,"aria-label":u?void 0:J,"aria-describedby":c?p: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:[x&&(0,e.jsx)("div",{className:"shrink-0 text-gray-500 dark:text-gray-300",children:x}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{id:y,className:(0,o.cn)("text-xl font-semibold text-gray-900 dark:text-white",$),children:u}),c&&(0,e.jsx)("p",{id:p,className:(0,o.cn)("mt-1 text-sm text-gray-500 dark:text-gray-300",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-500 dark:text-gray-300 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-500 dark:text-gray-300 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",O),children:oe})]})]})})});return typeof document<"u"?(0,N.createPortal)(k,document.body):k});F.displayName="Modal";0&&(module.exports={Modal});
1
+ "use strict";"use client";var L=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var Ee=Object.getOwnPropertyNames;var Pe=Object.prototype.hasOwnProperty;var Re=(t,o)=>{for(var a in o)L(t,a,{get:o[a],enumerable:!0})},je=(t,o,a,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of Ee(o))!Pe.call(t,s)&&s!==a&&L(t,s,{get:()=>o[s],enumerable:!(c=De(o,s))||c.enumerable});return t};var He=t=>je(L({},"__esModule",{value:!0}),t);var We={};Re(We,{Modal:()=>$,resetModalTitleWarning:()=>Ie});module.exports=He(We);var n=require("react"),O=require("react-dom"),W=require("../../hooks/useDialogA11y.cjs"),l=require("../../lib/cn.cjs"),z=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime"),Be={sm:"max-w-sm",md:"max-w-2xl",lg:"max-w-4xl",xl:"max-w-6xl",full:"max-w-full"};function Ae(t){return typeof t=="object"&&t!==null&&typeof t.then=="function"}var F=!1;function Ie(){F=!1}function Oe(t){F||(F=!0,console.warn(`[@synertech/ui] Modal has no \`title\`: the placeholder "${t}" is shown in its place. Pass a \`title\`, or an \`aria-label\` for a dialog without a visible title.`))}var $=(0,n.forwardRef)(({isOpen:t,open:o,onClose:a,title:c,children:s,buttonLabel:U,onButtonClick:V,className:q,panelClassName:G,allowFullScreen:J=!1,showSubmit:S=!0,submitLabel:K,onSubmitClick:Q,closeOnSubmit:X=!0,onSubmitError:T,showCancel:D=!1,cancelLabel:Y,onCancelClick:Z,buttonsPosition:E="right",showHeaderDivider:_=!0,showFooterDivider:ee=!0,description:x,icon:P,size:te="md",reverseButtons:ne=!1,headerClassName:re,contentClassName:oe,footerClassName:le,titleClassName:ae,descriptionClassName:se,submitClassName:ie,cancelClassName:de,closeLabel:ue,enterFullScreenLabel:ce,exitFullScreenLabel:me,"aria-label":w,closeOnEscape:be=!0,trapFocus:fe=!0,initialFocus:ge,returnFocus:ve,lockScroll:pe=!0},ye)=>{let m=o??t??!1,[b,he]=(0,n.useState)(!1),[i,k]=(0,n.useState)(null),d=(0,z.useUILabels)(),xe=c===void 0&&!w,v=c??(w?"":d.modalDefaultTitle),R=(0,n.useId)(),j=`${R}-title`,H=`${R}-description`,{dialogRef:N,dialogProps:we}=(0,W.useDialogA11y)({open:m,onClose:a,closeOnEscape:be,trapFocus:fe,initialFocus:ge,returnFocus:ve,lockScroll:pe}),M=(0,n.useRef)(0),f=(0,n.useRef)(!1),p=(0,n.useRef)(null);if((0,n.useEffect)(()=>{if(m)return()=>{M.current+=1,f.current=!1,p.current=null,k(null)}},[m]),(0,n.useEffect)(()=>{if(i!==null)return;let r=p.current;p.current=null;let u=N.current;if(!r||!u||!u.contains(r))return;let y=u.ownerDocument.activeElement;(!y||y===u.ownerDocument.body)&&r.focus()},[i,N]),!m)return null;xe&&Oe(v);let ke=U??K??d.confirm,Ne=Y??d.cancel,Me=ue??d.closeModal,Ce=b?me??d.exitFullScreen:ce??d.enterFullScreen,Le=V??Q,B=async(r,u,y)=>{if(f.current)return;let Te=M.current,C,h=null;try{let g=u?.();Ae(g)?(f.current=!0,p.current=y,k(r),C=await g):C=g}catch(g){h={error:g}}let I=M.current===Te;if(I&&f.current&&(f.current=!1,k(null)),h){if(r==="submit"&&T){T(h.error);return}throw h.error}!I||C===!1||r==="submit"&&!X||a()},Fe=r=>B("submit",Le,r.currentTarget),Se=r=>B("cancel",Z,r.currentTarget),A=(0,e.jsx)("div",{className:(0,l.cn)("overflow-y-auto overflow-x-hidden fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm",q),"aria-hidden":!m,children:(0,e.jsx)("div",{className:(0,l.cn)("relative p-4 w-full max-h-full transition-all duration-300",b?"max-w-full h-full p-0":Be[te]),ref:ye,children:(0,e.jsxs)("div",{...we,ref:N,"aria-labelledby":v?j:void 0,"aria-label":v?void 0:w,"aria-describedby":x?H:void 0,className:(0,l.cn)("relative bg-white shadow dark:bg-gray-700 border-b-4 transition-all duration-300 focus:outline-none",b?"rounded-none h-full flex flex-col":"rounded-lg",G),children:[(0,e.jsxs)("div",{className:(0,l.cn)("flex items-center justify-between p-4 md:p-5 rounded-t",_&&"border-b border-gray-200 dark:border-gray-600",re),children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[P&&(0,e.jsx)("div",{className:"shrink-0 text-gray-500 dark:text-gray-300",children:P}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{id:j,className:(0,l.cn)("text-xl font-semibold text-gray-900 dark:text-white",ae),children:v}),x&&(0,e.jsx)("p",{id:H,className:(0,l.cn)("mt-1 text-sm text-gray-500 dark:text-gray-300",se),children:x})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 ms-auto",children:[J&&(0,e.jsx)("button",{type:"button",onClick:()=>he(r=>!r),className:"text-gray-500 dark:text-gray-300 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":Ce,children:b?(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:a,className:"text-gray-500 dark:text-gray-300 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:Me})]})]})]}),(0,e.jsx)("div",{className:(0,l.cn)("p-4 md:p-5 space-y-4",b&&"flex-1 overflow-y-auto",oe),children:s}),(S||D)&&(0,e.jsxs)("div",{className:(0,l.cn)("flex items-center gap-2 p-4 md:p-5 rounded-b",ee&&"border-t border-gray-200 dark:border-gray-600",E==="right"?"justify-end":E==="center"?"justify-center":"justify-start",ne&&"flex-row-reverse",le),children:[D&&(0,e.jsx)("button",{type:"button",onClick:Se,disabled:i!==null,"aria-busy":i==="cancel"||void 0,className:(0,l.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 disabled:opacity-50 disabled:cursor-not-allowed",de),children:Ne}),S&&(0,e.jsx)("button",{type:"button",onClick:Fe,disabled:i!==null,"aria-busy":i==="submit"||void 0,className:(0,l.cn)("text-synertech-on-primary bg-synertech-primary-600 hover:bg-synertech-primary-700 focus:ring-4 focus:outline-none focus:ring-synertech-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center disabled:opacity-50 disabled:cursor-not-allowed",ie),children:ke})]})]})})});return typeof document<"u"?(0,O.createPortal)(A,document.body):A});$.displayName="Modal";0&&(module.exports={Modal,resetModalTitleWarning});
@@ -1 +1 @@
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:y,children:p,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=y??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,x=k??F,re=async()=>{x&&await x(),l()},oe=async()=>{u&&await u(),l()},h=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-300",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-300",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-500 dark:text-gray-300 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-500 dark:text-gray-300 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:p}),(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",E),children:Z})]})]})})});return typeof document<"u"?ie(h,document.body):h});me.displayName="Modal";export{me as Modal};
1
+ "use client";import{forwardRef as Se,useEffect as A,useId as Te,useRef as N,useState as I}from"react";import{createPortal as De}from"react-dom";import{useDialogA11y as Ee}from"../../hooks/useDialogA11y.js";import{cn as n}from"../../lib/cn.js";import{useUILabels as Pe}from"../../lib/i18n.js";import{jsx as e,jsxs as o}from"react/jsx-runtime";var Re={sm:"max-w-sm",md:"max-w-2xl",lg:"max-w-4xl",xl:"max-w-6xl",full:"max-w-full"};function je(r){return typeof r=="object"&&r!==null&&typeof r.then=="function"}var M=!1;function $e(){M=!1}function He(r){M||(M=!0,console.warn(`[@synertech/ui] Modal has no \`title\`: the placeholder "${r}" is shown in its place. Pass a \`title\`, or an \`aria-label\` for a dialog without a visible title.`))}var Be=Se(({isOpen:r,open:O,onClose:v,title:C,children:W,buttonLabel:z,onButtonClick:$,className:U,panelClassName:V,allowFullScreen:q=!1,showSubmit:L=!0,submitLabel:G,onSubmitClick:J,closeOnSubmit:K=!0,onSubmitError:F,showCancel:S=!1,cancelLabel:Q,onCancelClick:X,buttonsPosition:T="right",showHeaderDivider:Y=!0,showFooterDivider:Z=!0,description:p,icon:D,size:_="md",reverseButtons:ee=!1,headerClassName:te,contentClassName:ne,footerClassName:re,titleClassName:oe,descriptionClassName:le,submitClassName:ae,cancelClassName:se,closeLabel:ie,enterFullScreenLabel:de,exitFullScreenLabel:ue,"aria-label":y,closeOnEscape:ce=!0,trapFocus:me=!0,initialFocus:be,returnFocus:fe,lockScroll:ge=!0},ve)=>{let i=O??r??!1,[d,pe]=I(!1),[l,h]=I(null),a=Pe(),ye=C===void 0&&!y,m=C??(y?"":a.modalDefaultTitle),E=Te(),P=`${E}-title`,R=`${E}-description`,{dialogRef:x,dialogProps:he}=Ee({open:i,onClose:v,closeOnEscape:ce,trapFocus:me,initialFocus:be,returnFocus:fe,lockScroll:ge}),w=N(0),u=N(!1),b=N(null);if(A(()=>{if(i)return()=>{w.current+=1,u.current=!1,b.current=null,h(null)}},[i]),A(()=>{if(l!==null)return;let t=b.current;b.current=null;let s=x.current;if(!t||!s||!s.contains(t))return;let f=s.ownerDocument.activeElement;(!f||f===s.ownerDocument.body)&&t.focus()},[l,x]),!i)return null;ye&&He(m);let xe=z??G??a.confirm,we=Q??a.cancel,ke=ie??a.closeModal,Ne=d?ue??a.exitFullScreen:de??a.enterFullScreen,Me=$??J,j=async(t,s,f)=>{if(u.current)return;let Fe=w.current,k,g=null;try{let c=s?.();je(c)?(u.current=!0,b.current=f,h(t),k=await c):k=c}catch(c){g={error:c}}let B=w.current===Fe;if(B&&u.current&&(u.current=!1,h(null)),g){if(t==="submit"&&F){F(g.error);return}throw g.error}!B||k===!1||t==="submit"&&!K||v()},Ce=t=>j("submit",Me,t.currentTarget),Le=t=>j("cancel",X,t.currentTarget),H=e("div",{className:n("overflow-y-auto overflow-x-hidden fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm",U),"aria-hidden":!i,children:e("div",{className:n("relative p-4 w-full max-h-full transition-all duration-300",d?"max-w-full h-full p-0":Re[_]),ref:ve,children:o("div",{...he,ref:x,"aria-labelledby":m?P:void 0,"aria-label":m?void 0:y,"aria-describedby":p?R:void 0,className:n("relative bg-white shadow dark:bg-gray-700 border-b-4 transition-all duration-300 focus:outline-none",d?"rounded-none h-full flex flex-col":"rounded-lg",V),children:[o("div",{className:n("flex items-center justify-between p-4 md:p-5 rounded-t",Y&&"border-b border-gray-200 dark:border-gray-600",te),children:[o("div",{className:"flex items-center gap-3",children:[D&&e("div",{className:"shrink-0 text-gray-500 dark:text-gray-300",children:D}),o("div",{children:[e("h3",{id:P,className:n("text-xl font-semibold text-gray-900 dark:text-white",oe),children:m}),p&&e("p",{id:R,className:n("mt-1 text-sm text-gray-500 dark:text-gray-300",le),children:p})]})]}),o("div",{className:"flex items-center gap-1 ms-auto",children:[q&&e("button",{type:"button",onClick:()=>pe(t=>!t),className:"text-gray-500 dark:text-gray-300 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:d?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"})})}),o("button",{type:"button",onClick:v,className:"text-gray-500 dark:text-gray-300 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:ke})]})]})]}),e("div",{className:n("p-4 md:p-5 space-y-4",d&&"flex-1 overflow-y-auto",ne),children:W}),(L||S)&&o("div",{className:n("flex items-center gap-2 p-4 md:p-5 rounded-b",Z&&"border-t border-gray-200 dark:border-gray-600",T==="right"?"justify-end":T==="center"?"justify-center":"justify-start",ee&&"flex-row-reverse",re),children:[S&&e("button",{type:"button",onClick:Le,disabled:l!==null,"aria-busy":l==="cancel"||void 0,className:n("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 disabled:opacity-50 disabled:cursor-not-allowed",se),children:we}),L&&e("button",{type:"button",onClick:Ce,disabled:l!==null,"aria-busy":l==="submit"||void 0,className:n("text-synertech-on-primary bg-synertech-primary-600 hover:bg-synertech-primary-700 focus:ring-4 focus:outline-none focus:ring-synertech-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center disabled:opacity-50 disabled:cursor-not-allowed",ae),children:xe})]})]})})});return typeof document<"u"?De(H,document.body):H});Be.displayName="Modal";export{Be as Modal,$e as resetModalTitleWarning};
@@ -1 +1 @@
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",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-500 dark:text-gray-400"),"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
+ "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 c in r)L(e,c,{get:r[c],enumerable:!0})},$=(e,r,c,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let u of _(r))!O.call(e,u)&&u!==c&&L(e,u,{get:()=>r[u],enumerable:!(i=F(r,u))||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"),v=require("../../lib/i18n.cjs"),n=require("react/jsx-runtime");function D(e,r,c,i){let u=c*2+1+i*2+2;if(r<=u)return Array.from({length:r},(t,m)=>m+1);let k=Array.from({length:i},(t,m)=>m+1).filter(t=>t<=r),N=Array.from({length:i},(t,m)=>r-i+1+m).filter(t=>t>=1),h=Math.max(e-c,i+1),s=Math.min(e+c,r-i),p=h>i+2,y=s<r-i-1,o=[];for(let t of k)o.push(t);if(p)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(y)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-synertech-primary-600 text-synertech-on-primary hover:bg-synertech-primary-700",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"},outlined:{base:"rounded-md border font-medium transition-colors",idle:"border-gray-300 text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",active:"border-synertech-primary-600 bg-synertech-primary-50 text-synertech-primary-600 hover:bg-synertech-primary-100 dark:border-synertech-primary-400 dark:bg-synertech-primary-900/30 dark:text-synertech-primary-400 dark:hover:bg-synertech-primary-900/50",disabled:"border-gray-200 text-gray-300 cursor-not-allowed dark:border-gray-700 dark:text-gray-600"},minimal:{base:"rounded-md font-medium transition-colors",idle:"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200",active:"text-synertech-primary-600 font-semibold hover:text-synertech-primary-700 dark:text-synertech-primary-400 dark:hover:text-synertech-primary-300",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"}};function V({page:e,totalPages:r,onPageChange:c,size:i="md",variant:u="default",showFirstLast:k=!1,siblings:N=1,boundaries:h=1,disabled:s=!1,labels:p,totalItems:y,pageSize:o,pageSizeOptions:t,onPageSizeChange:m,className:I,...P}){let g=(0,v.useUILabels)(p),l=Q[i],f=T[u],W=(0,C.useMemo)(()=>D(e,r,N,h),[e,r,N,h]),b=(0,C.useCallback)(a=>{s||a<1||a>r||a===e||c(a)},[s,r,e,c]),R=e<=1,M=e>=r,B=(0,d.cn)("inline-flex items-center justify-center select-none",l.button,f.base),w=(a,x,U,A)=>(0,n.jsx)("button",{type:"button",onClick:a,disabled:s||x,"aria-label":U,"aria-disabled":s||x,className:(0,d.cn)(B,s||x?f.disabled:f.idle),children:A}),j=y!==void 0&&o?(e-1)*o+1:void 0,E=y!==void 0&&o?Math.min(e*o,y):void 0;return(0,n.jsxs)("nav",{"aria-label":g.paginationLabel,className:(0,d.cn)("flex items-center",l.gap,I),...P,children:[y!==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,v.formatUILabel)(g.paginationRange,{start:j??0,end:E??0,total:y})}),t&&t.length>0&&m&&(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:g.paginationRowsPerPage}),(0,n.jsx)("select",{id:"pagination-page-size",value:o,onChange:a=>m(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(()=>b(1),R,p?.first??g.paginationFirst,(0,n.jsx)(J,{className:l.icon})),w(()=>b(e-1),R,p?.previous??g.paginationPrevious,(0,n.jsx)(G,{className:l.icon})),W.map((a,x)=>a==="ellipsis"?(0,n.jsx)("span",{className:(0,d.cn)("inline-flex items-center justify-center select-none",l.button,"text-gray-500 dark:text-gray-400"),"aria-hidden":"true",children:"\u2026"},`ellipsis-${x}`):(0,n.jsx)("button",{type:"button",onClick:()=>b(a),disabled:s,"aria-current":a===e?"page":void 0,"aria-label":(0,v.formatUILabel)(g.paginationPage,{page:a}),className:(0,d.cn)(B,a===e?f.active:s?f.disabled:f.idle),children:a},a)),w(()=>b(e+1),M,p?.next??g.paginationNext,(0,n.jsx)(H,{className:l.icon})),k&&w(()=>b(r),M,p?.last??g.paginationLast,(0,n.jsx)(K,{className:l.icon}))]})]})}0&&(module.exports={Pagination});
@@ -1 +1 @@
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",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-500 dark:text-gray-400"),"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
+ "use client";import{useCallback as A,useMemo as F}from"react";import{cn as c}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,p,s){let N=p*2+1+s*2+2;if(o<=N)return Array.from({length:o},(e,d)=>d+1);let x=Array.from({length:s},(e,d)=>d+1).filter(e=>e<=o),v=Array.from({length:s},(e,d)=>o-s+1+d).filter(e=>e>=1),y=Math.max(t-p,s+1),i=Math.min(t+p,o-s),m=y>s+2,g=i<o-s-1,a=[];for(let e of x)a.push(e);if(m)a.push("ellipsis");else for(let e=s+1;e<y;e++)a.push(e);for(let e=y;e<=i;e++)a.push(e);if(g)a.push("ellipsis");else for(let e=i+1;e<=o-s;e++)a.push(e);for(let e of v)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-synertech-primary-600 text-synertech-on-primary hover:bg-synertech-primary-700",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"},outlined:{base:"rounded-md border font-medium transition-colors",idle:"border-gray-300 text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",active:"border-synertech-primary-600 bg-synertech-primary-50 text-synertech-primary-600 hover:bg-synertech-primary-100 dark:border-synertech-primary-400 dark:bg-synertech-primary-900/30 dark:text-synertech-primary-400 dark:hover:bg-synertech-primary-900/50",disabled:"border-gray-200 text-gray-300 cursor-not-allowed dark:border-gray-700 dark:text-gray-600"},minimal:{base:"rounded-md font-medium transition-colors",idle:"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200",active:"text-synertech-primary-600 font-semibold hover:text-synertech-primary-700 dark:text-synertech-primary-400 dark:hover:text-synertech-primary-300",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"}};function T({page:t,totalPages:o,onPageChange:p,size:s="md",variant:N="default",showFirstLast:x=!1,siblings:v=1,boundaries:y=1,disabled:i=!1,labels:m,totalItems:g,pageSize:a,pageSizeOptions:e,onPageSizeChange:d,className:B,...I}){let u=_(m),l=G[s],h=H[N],P=F(()=>O(t,o,v,y),[t,o,v,y]),f=A(r=>{i||r<1||r>o||r===t||p(r)},[i,o,t,p]),C=t<=1,L=t>=o,R=c("inline-flex items-center justify-center select-none",l.button,h.base),k=(r,b,E,U)=>n("button",{type:"button",onClick:r,disabled:i||b,"aria-label":E,"aria-disabled":i||b,className:c(R,i||b?h.disabled:h.idle),children:U}),W=g!==void 0&&a?(t-1)*a+1:void 0,j=g!==void 0&&a?Math.min(t*a,g):void 0;return w("nav",{"aria-label":u.paginationLabel,className:c("flex items-center",l.gap,B),...I,children:[g!==void 0&&a&&n("span",{className:c("mr-2 text-gray-600 dark:text-gray-400 whitespace-nowrap",l.text),children:M(u.paginationRange,{start:W??0,end:j??0,total:g})}),e&&e.length>0&&d&&w("div",{className:c("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:u.paginationRowsPerPage}),n("select",{id:"pagination-page-size",value:a,onChange:r=>d(Number(r.target.value)),disabled:i,className:c("rounded border border-gray-300 bg-white px-1.5 py-0.5 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200",l.text,i&&"cursor-not-allowed opacity-50"),children:e.map(r=>n("option",{value:r,children:r},r))})]}),w("div",{className:c("flex items-center",l.gap),children:[x&&k(()=>f(1),C,m?.first??u.paginationFirst,n(q,{className:l.icon})),k(()=>f(t-1),C,m?.previous??u.paginationPrevious,n(z,{className:l.icon})),P.map((r,b)=>r==="ellipsis"?n("span",{className:c("inline-flex items-center justify-center select-none",l.button,"text-gray-500 dark:text-gray-400"),"aria-hidden":"true",children:"\u2026"},`ellipsis-${b}`):n("button",{type:"button",onClick:()=>f(r),disabled:i,"aria-current":r===t?"page":void 0,"aria-label":M(u.paginationPage,{page:r}),className:c(R,r===t?h.active:i?h.disabled:h.idle),children:r},r)),k(()=>f(t+1),L,m?.next??u.paginationNext,n($,{className:l.icon})),x&&k(()=>f(o),L,m?.last??u.paginationLast,n(D,{className:l.icon}))]})]})}export{T as Pagination};
@@ -1 +1 @@
1
- "use strict";"use client";var F=Object.defineProperty;var he=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var de=Object.prototype.hasOwnProperty;var pe=(s,t)=>{for(var a in t)F(s,a,{get:t[a],enumerable:!0})},ge=(s,t,a,C)=>{if(t&&typeof t=="object"||typeof t=="function")for(let m of me(t))!de.call(s,m)&&m!==a&&F(s,m,{get:()=>t[m],enumerable:!(C=he(t,m))||C.enumerable});return s};var be=s=>ge(F({},"__esModule",{value:!0}),s);var Le={};pe(Le,{PieChart:()=>Re,resetPieWarnings:()=>xe});module.exports=be(Le);var h=require("react"),ee=require("../../lib/i18n.cjs"),te=require("../chart/ChartContainer.cjs"),ae=require("../chart/ChartLegend.cjs"),O=require("../chart/ChartPatterns.cjs"),oe=require("../chart/ChartTableView.cjs"),D=require("../chart/ChartTooltip.cjs"),K=require("../chart/palette.cjs"),V=require("../chart/utils/data.cjs"),L=require("../chart/utils/format.cjs"),ne=require("../chart/utils/keyboard.cjs"),re=require("../chart/utils/path.cjs"),le=require("../chart/utils/touch.cjs"),n=require("react/jsx-runtime"),fe=.62,ye=2,Ce=3,ve=.16,Ae=64,ke=22,j=6,q=!1;function Pe({width:s,height:t,slices:a,variant:C,innerRadius:m,showLabels:v,centerLabel:A,tooltip:k,patterns:I,patternBaseId:T,plotLabel:$,formatValue:M,locale:X,onSliceClick:x}){let[P,N]=(0,h.useState)(null),d=P!==null&&P<a.length?P:null,w=(0,h.useMemo)(()=>{let e=v?Ae:8,o=v?ke:8,u=Math.max(0,Math.min((s-e*2)/2,(t-o*2)/2));return{cx:s/2,cy:t/2,outerRadius:u,inner:C==="donut"?u*(m??fe):(m??0)*u,pad:u>0&&a.length>1?ye/u/2:0}},[s,t,C,m,v,a.length]),{cx:b,cy:f,outerRadius:p,inner:W,pad:E}=w,z=(0,h.useCallback)(e=>{let o=(e.startAngle+e.endAngle)/2,u=Math.sin(o)>=0,g={x:b+Math.sin(o)*(p+4),y:f-Math.cos(o)*(p+4)},y={x:b+Math.sin(o)*(p+14),y:f-Math.cos(o)*(p+14)},B={x:u?y.x+10:y.x-10,y:y.y};return{from:g,elbow:y,end:B,anchor:u?"start":"end"}},[b,f,p]),_=(0,h.useCallback)(e=>{let o=a[e];o&&x?.({key:o.key,label:o.label,value:o.value,share:o.share})},[a,x]),R=(0,h.useCallback)(e=>(0,ne.handleChartKeyDown)(e,{count:a.length,current:d,axis:"both",onMove:N,pick:x&&d!==null?()=>_(d):null}),[a.length,d,x,_]),r=d===null?null:a[d];return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("svg",{width:s,height:t,role:"img","aria-label":$??a.map(e=>e.label).join(", "),tabIndex:0,className:`${le.CHART_TOUCH} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500`,onPointerLeave:()=>N(null),onBlur:()=>N(null),onKeyDown:R,children:[I?(0,n.jsx)(O.ChartPatternDefs,{id:T,entries:a.map(e=>({slot:e.slot,color:e.color}))}):null,a.map((e,o)=>(0,n.jsx)("path",{d:(0,re.buildArcPath)({cx:b,cy:f,innerRadius:W,outerRadius:p+(d===o?Ce:0),startAngle:e.startAngle+E,endAngle:Math.max(e.startAngle+E,e.endAngle-E)}),fill:(0,O.patternFill)(I,T,e.slot,e.color),onPointerEnter:()=>k===!1?void 0:N(o),onClick:()=>_(o)},e.key)),v?a.filter(e=>e.endAngle-e.startAngle>=ve).map(e=>{let{from:o,elbow:u,end:g,anchor:y}=z(e);return(0,n.jsxs)("g",{"aria-hidden":"true",children:[(0,n.jsx)("polyline",{points:`${o.x},${o.y} ${u.x},${u.y} ${g.x},${g.y}`,fill:"none",className:"stroke-gray-300 dark:stroke-gray-600",strokeWidth:1}),(0,n.jsx)("text",{x:y==="start"?g.x+3:g.x-3,y:g.y,textAnchor:y,dominantBaseline:"middle",className:"fill-gray-600 text-[10px] dark:fill-gray-300",children:e.label})]},`label-${e.key}`)}):null,C==="donut"&&A?(0,n.jsxs)("g",{"aria-hidden":"true",children:[(0,n.jsx)("text",{x:b,y:f-(A.label?2:0),textAnchor:"middle",dominantBaseline:"middle",className:"fill-gray-900 text-lg font-semibold dark:fill-gray-100",children:A.value}),A.label?(0,n.jsx)("text",{x:b,y:f+14,textAnchor:"middle",dominantBaseline:"middle",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:A.label}):null]}):null]}),r&&k!==!1?(0,n.jsx)(D.ChartTooltip,{x:b+Math.sin((r.startAngle+r.endAngle)/2)*(p*.7),y:f-Math.cos((r.startAngle+r.endAngle)/2)*(p*.7),containerWidth:s,children:typeof k=="function"?k({seriesKey:r.key,seriesLabel:r.label,color:r.color,value:r.value,formattedValue:M(r.value),datum:{},share:r.share}):(0,n.jsx)(D.ChartTooltipContent,{title:r.label,points:[{seriesKey:r.key,seriesLabel:(0,L.formatPercent)(r.share,{locale:X}),color:r.color,value:r.value,formattedValue:M(r.value),datum:{}}]})}):null]})}function Re({data:s,x:t,value:a,variant:C="pie",innerRadius:m,maxSlices:v=j,otherLabel:A,sort:k="desc",showLabels:I=!0,centerLabel:T,patterns:$=!1,height:M=260,width:X,size:x="md",legend:P,tooltip:N=!0,tableView:d=!1,title:w,description:b,loading:f=!1,emptyState:p,error:W=!1,errorState:E,onRetry:z,actions:_,locale:R,plotLabel:r,onSliceClick:e,className:o,...u}){let g=(0,ee.useUILabels)(),y=(0,h.useId)(),B=(0,h.useCallback)(i=>(0,L.formatAuto)(i,R),[R]),J=(0,h.useCallback)(i=>t.format?t.format(i,0):(0,L.formatXValue)(i,R),[t,R]),{slices:G,total:se,rows:ie}=(0,h.useMemo)(()=>{let i=s.map((l,c)=>({key:String((0,V.readXValue)(l,t.key,c)),label:J((0,V.readXValue)(l,t.key,c)),value:(0,V.readNumber)(l,a)??0,color:(0,K.getSeriesColor)(c),slot:c,datum:l})),Y=k==="none"?i:[...i].sort((l,c)=>k==="asc"?l.value-c.value:c.value-l.value),S=Y.slice(0,v),Z=Y.slice(v);Z.length>0&&S.push({key:"__other__",label:A??g.chartOther,value:Z.reduce((l,c)=>l+c.value,0),color:K.CHART_MUTED_COLOR,slot:-1,datum:{}}),S.length>j&&!q&&(q=!0,console.warn(`[@synertech/ui] A PieChart is drawing ${S.length} slices. Past ${j} the slices stop being tellable apart: lower \`maxSlices\`, or use a BarChart, which compares lengths rather than angles.`));let H=S.reduce((l,c)=>l+Math.max(0,c.value),0),U=0;return{slices:S.map(l=>{let c=H===0?0:Math.max(0,l.value)/H,ce=U;return U+=c*Math.PI*2,{...l,share:c,startAngle:ce,endAngle:U}}),total:H,rows:S.map(l=>({[t.key]:l.label,[a]:l.value}))}},[s,t.key,a,k,v,A,g.chartOther,J]),ue=P===void 0?!0:P!==!1,Q=typeof P=="string"?P:"bottom";return(0,n.jsx)(te.ChartContainer,{title:w,description:b,height:M,width:X,size:x,loading:f,empty:G.length===0||se===0,emptyState:p,error:W,errorState:E,onRetry:z,actions:_,tableView:d,legendPosition:Q,legend:ue?(0,n.jsx)(ae.ChartLegend,{items:G.map(i=>({key:i.key,label:`${i.label} \xB7 ${(0,L.formatPercent)(i.share,{locale:R})}`,color:i.color,...$?{pattern:i.slot}:{}})),position:Q,marker:"rect",size:x}):void 0,table:d?(0,n.jsx)(oe.ChartTableView,{data:ie,series:[{key:a,label:t.label??a}],xKey:t.key,xLabel:t.label??t.key,formatValue:B,caption:typeof w=="string"?w:void 0}):void 0,className:o,...u,children:({width:i})=>(0,n.jsx)(Pe,{width:i,height:M,slices:G,variant:C,innerRadius:m,showLabels:I,centerLabel:T,tooltip:N,patterns:$,patternBaseId:y,plotLabel:r,formatValue:B,locale:R,onSliceClick:e})})}function xe(){q=!1}0&&(module.exports={PieChart,resetPieWarnings});
1
+ "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"),re=require("../chart/utils/keyboard.cjs"),ne=require("../chart/utils/path.cjs"),le=require("../chart/utils/touch.cjs"),r=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,re.handleChartKeyDown)(e,{count:a.length,current:d,axis:"both",onMove:N,pick:x&&d!==null?()=>_(d):null}),[a.length,d,x,_]),n=d===null?null:a[d];return(0,r.jsxs)(r.Fragment,{children:[(0,r.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-synertech-primary-500`,onPointerLeave:()=>N(null),onBlur:()=>N(null),onKeyDown:R,children:[I?(0,r.jsx)(O.ChartPatternDefs,{id:T,entries:a.map(e=>({slot:e.slot,color:e.color}))}):null,a.map((e,o)=>(0,r.jsx)("path",{d:(0,ne.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,r.jsxs)("g",{"aria-hidden":"true",children:[(0,r.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,r.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,r.jsxs)("g",{"aria-hidden":"true",children:[(0,r.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,r.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]}),n&&k!==!1?(0,r.jsx)(D.ChartTooltip,{x:b+Math.sin((n.startAngle+n.endAngle)/2)*(p*.7),y:f-Math.cos((n.startAngle+n.endAngle)/2)*(p*.7),containerWidth:s,children:typeof k=="function"?k({seriesKey:n.key,seriesLabel:n.label,color:n.color,value:n.value,formattedValue:M(n.value),datum:{},share:n.share}):(0,r.jsx)(D.ChartTooltipContent,{title:n.label,points:[{seriesKey:n.key,seriesLabel:(0,L.formatPercent)(n.share,{locale:X}),color:n.color,value:n.value,formattedValue:M(n.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:n,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,r.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,r.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,r.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,r.jsx)(Pe,{width:i,height:M,slices:G,variant:C,innerRadius:m,showLabels:I,centerLabel:T,tooltip:N,patterns:$,patternBaseId:y,plotLabel:n,formatValue:B,locale:R,onSliceClick:e})})}function xe(){q=!1}0&&(module.exports={PieChart,resetPieWarnings});