@synertech/ui 0.45.1 → 0.46.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 (144) hide show
  1. package/.claude/skills/use-synertech-ui/SKILL.md +115 -17
  2. package/README.md +47 -5
  3. package/dist/components/area-chart/AreaChart.cjs +1 -1
  4. package/dist/components/area-chart/AreaChart.js +1 -1
  5. package/dist/components/avatar/Avatar.cjs +1 -1
  6. package/dist/components/avatar/Avatar.js +1 -1
  7. package/dist/components/badge/Badge.cjs +1 -1
  8. package/dist/components/badge/Badge.js +1 -1
  9. package/dist/components/banner/Banner.cjs +1 -1
  10. package/dist/components/banner/Banner.js +1 -1
  11. package/dist/components/bar-chart/BarChart.cjs +1 -1
  12. package/dist/components/bar-chart/BarChart.js +1 -1
  13. package/dist/components/box-plot/BoxPlot.cjs +1 -1
  14. package/dist/components/box-plot/BoxPlot.js +1 -1
  15. package/dist/components/breadcrumb/Breadcrumb.cjs +1 -1
  16. package/dist/components/breadcrumb/Breadcrumb.js +1 -1
  17. package/dist/components/bullet-chart/BulletChart.cjs +1 -1
  18. package/dist/components/bullet-chart/BulletChart.js +1 -1
  19. package/dist/components/calendar/Calendar.cjs +1 -1
  20. package/dist/components/calendar/Calendar.js +1 -1
  21. package/dist/components/candlestick-chart/CandlestickChart.cjs +1 -1
  22. package/dist/components/candlestick-chart/CandlestickChart.js +1 -1
  23. package/dist/components/chart/ChartBrush.cjs +1 -1
  24. package/dist/components/chart/ChartBrush.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/utils/export.cjs +1 -2
  28. package/dist/components/chart/utils/export.js +1 -2
  29. package/dist/components/chart/utils/keyboard.cjs +1 -0
  30. package/dist/components/chart/utils/keyboard.js +1 -0
  31. package/dist/components/chip/Chip.cjs +1 -1
  32. package/dist/components/chip/Chip.js +1 -1
  33. package/dist/components/datagrid/DataGrid.cjs +1 -2
  34. package/dist/components/datagrid/DataGrid.js +1 -2
  35. package/dist/components/device-mockup/DeviceMockup.cjs +1 -1
  36. package/dist/components/device-mockup/DeviceMockup.js +1 -1
  37. package/dist/components/dropdown/Dropdown.cjs +1 -1
  38. package/dist/components/dropdown/Dropdown.js +1 -1
  39. package/dist/components/dropdown/DropdownCheckboxItem.cjs +1 -1
  40. package/dist/components/dropdown/DropdownCheckboxItem.js +1 -1
  41. package/dist/components/dropdown/DropdownContent.cjs +1 -1
  42. package/dist/components/dropdown/DropdownContent.js +1 -1
  43. package/dist/components/dropdown/DropdownItem.cjs +1 -1
  44. package/dist/components/dropdown/DropdownItem.js +1 -1
  45. package/dist/components/dropdown/DropdownRadio.cjs +1 -1
  46. package/dist/components/dropdown/DropdownRadio.js +1 -1
  47. package/dist/components/dropdown/DropdownSubMenu.cjs +1 -1
  48. package/dist/components/dropdown/DropdownSubMenu.js +1 -1
  49. package/dist/components/dropdown/hooks/index.cjs +1 -1
  50. package/dist/components/dropdown/hooks/index.js +1 -1
  51. package/dist/components/dropdown/hooks/useClickOutside.cjs +1 -1
  52. package/dist/components/dropdown/hooks/useClickOutside.js +1 -1
  53. package/dist/components/dropdown/index.cjs +1 -1
  54. package/dist/components/dropdown/index.js +1 -1
  55. package/dist/components/dropdown/menu-navigation.cjs +1 -0
  56. package/dist/components/dropdown/menu-navigation.js +1 -0
  57. package/dist/components/dumbbell-chart/DumbbellChart.cjs +1 -1
  58. package/dist/components/dumbbell-chart/DumbbellChart.js +1 -1
  59. package/dist/components/file-selector/FileSelector.cjs +1 -1
  60. package/dist/components/file-selector/FileSelector.js +1 -1
  61. package/dist/components/form/input/Input.cjs +1 -1
  62. package/dist/components/form/input/Input.js +1 -1
  63. package/dist/components/form/mention-input/MentionInput.cjs +1 -1
  64. package/dist/components/form/mention-input/MentionInput.js +1 -1
  65. package/dist/components/form/number-input/NumberInput.cjs +1 -1
  66. package/dist/components/form/number-input/NumberInput.js +1 -1
  67. package/dist/components/funnel-chart/FunnelChart.cjs +1 -1
  68. package/dist/components/funnel-chart/FunnelChart.js +1 -1
  69. package/dist/components/gantt-chart/GanttChart.cjs +1 -1
  70. package/dist/components/gantt-chart/GanttChart.js +1 -1
  71. package/dist/components/header/Header.cjs +1 -1
  72. package/dist/components/header/Header.js +1 -1
  73. package/dist/components/heat-map/Heatmap.cjs +1 -1
  74. package/dist/components/heat-map/Heatmap.js +1 -1
  75. package/dist/components/help-button/HelpButton.cjs +7 -7
  76. package/dist/components/help-button/HelpButton.js +7 -7
  77. package/dist/components/help-button/MarkdownEditor.cjs +1 -1
  78. package/dist/components/help-button/MarkdownEditor.js +1 -1
  79. package/dist/components/image-uploader/ImageUploader.cjs +1 -1
  80. package/dist/components/image-uploader/ImageUploader.js +1 -1
  81. package/dist/components/indicator/Indicator.cjs +1 -1
  82. package/dist/components/indicator/Indicator.js +1 -1
  83. package/dist/components/label/Label.cjs +1 -1
  84. package/dist/components/label/Label.js +1 -1
  85. package/dist/components/line-chart/LineChart.cjs +1 -1
  86. package/dist/components/line-chart/LineChart.js +1 -1
  87. package/dist/components/modal/Modal.cjs +1 -1
  88. package/dist/components/modal/Modal.js +1 -1
  89. package/dist/components/pagination/Pagination.cjs +1 -1
  90. package/dist/components/pagination/Pagination.js +1 -1
  91. package/dist/components/pie-chart/PieChart.cjs +1 -1
  92. package/dist/components/pie-chart/PieChart.js +1 -1
  93. package/dist/components/radio-button/RadioButton.cjs +1 -1
  94. package/dist/components/radio-button/RadioButton.js +1 -1
  95. package/dist/components/scatter-chart/ScatterChart.cjs +1 -1
  96. package/dist/components/scatter-chart/ScatterChart.js +1 -1
  97. package/dist/components/schema-editor/SchemaEditor.cjs +1 -1
  98. package/dist/components/schema-editor/SchemaEditor.js +1 -1
  99. package/dist/components/schema-editor/legend/SchemaLegend.cjs +1 -1
  100. package/dist/components/schema-editor/legend/SchemaLegend.js +1 -1
  101. package/dist/components/schema-editor/tables/SchemaTableRenderer.cjs +1 -1
  102. package/dist/components/schema-editor/tables/SchemaTableRenderer.js +1 -1
  103. package/dist/components/schema-editor/toolbar/SchemaToolbar.cjs +1 -1
  104. package/dist/components/schema-editor/toolbar/SchemaToolbar.js +1 -1
  105. package/dist/components/select/Select.cjs +1 -1
  106. package/dist/components/select/Select.js +1 -1
  107. package/dist/components/tabs/Tabs.cjs +1 -1
  108. package/dist/components/tabs/Tabs.js +1 -1
  109. package/dist/components/tabs/TabsContent.cjs +1 -1
  110. package/dist/components/tabs/TabsContent.js +1 -1
  111. package/dist/components/tabs/TabsContext.cjs +1 -1
  112. package/dist/components/tabs/TabsContext.js +1 -1
  113. package/dist/components/tabs/TabsList.cjs +1 -1
  114. package/dist/components/tabs/TabsList.js +1 -1
  115. package/dist/components/tabs/TabsTrigger.cjs +1 -1
  116. package/dist/components/tabs/TabsTrigger.js +1 -1
  117. package/dist/components/toast/Toast.cjs +1 -1
  118. package/dist/components/toast/Toast.js +1 -1
  119. package/dist/components/tooltip/Tooltip.cjs +1 -1
  120. package/dist/components/tooltip/Tooltip.js +1 -1
  121. package/dist/components/waterfall-chart/WaterfallChart.cjs +1 -1
  122. package/dist/components/waterfall-chart/WaterfallChart.js +1 -1
  123. package/dist/components/wizard/Wizard.cjs +1 -1
  124. package/dist/components/wizard/Wizard.js +1 -1
  125. package/dist/components/workflow-editor/WorkflowEditor.cjs +1 -1
  126. package/dist/components/workflow-editor/WorkflowEditor.js +1 -1
  127. package/dist/components/workflow-editor/toolbar/WorkflowToolbar.cjs +1 -1
  128. package/dist/components/workflow-editor/toolbar/WorkflowToolbar.js +1 -1
  129. package/dist/index.cjs +1 -1
  130. package/dist/index.d.cts +814 -172
  131. package/dist/index.d.ts +814 -172
  132. package/dist/index.js +1 -1
  133. package/dist/lib/aria-hide.cjs +1 -1
  134. package/dist/lib/aria-hide.js +1 -1
  135. package/dist/lib/csv.cjs +2 -0
  136. package/dist/lib/csv.js +2 -0
  137. package/dist/lib/i18n.cjs +1 -1
  138. package/dist/lib/i18n.js +1 -1
  139. package/dist/lib/server-labels.cjs +1 -0
  140. package/dist/lib/server-labels.js +1 -0
  141. package/dist/lib/ui-labels.cjs +1 -0
  142. package/dist/lib/ui-labels.js +1 -0
  143. package/dist/styles.css +3152 -309
  144. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
- "use client";import{useState as p,useRef as w,useEffect as P,useCallback as E}from"react";import $ from"dompurify";import G from"react-markdown";import K from"remark-gfm";import{useUILabels as q}from"../../lib/i18n.js";import{Fragment as ae,jsx as e,jsxs as a}from"react/jsx-runtime";var V=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"})]}),j=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"})]}),F=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"})]}),J=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"})]}),Q=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"})]}),X={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"},Y={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"},Z={sm:"w-56",md:"w-72",lg:"w-96",xl:"w-[32rem]"},ee=[K],te={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:s,...l})=>!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",...l,children:s}):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",...l,children:s}),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 re({content:t,markdown:s=!1,position:l="bottom",size:x="sm",className:C="",visible:M=!0,editable:f=!1,onSave:c,onReset:i,width:R="md",title:u,markdownEditor:b,markdownEditorUnavailableLabel:L}){let T=q(),[g,I]=p(!1),[n,m]=p(!1),[v,y]=p(""),[B,h]=p(!1),[H,r]=p(null),S=w(null),z=w(null),O=w(null),o=w(null);P(()=>{if(!g)return;let d=N=>{S.current&&!S.current.contains(N.target)&&z.current&&!z.current.contains(N.target)&&(n||I(!1))},A=N=>{N.key==="Escape"&&(n?(m(!1),y("")):I(!1))};return document.addEventListener("mousedown",d),document.addEventListener("keydown",A),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",A)}},[g,n]),P(()=>{n&&O.current&&O.current.focus()},[n]),P(()=>()=>{o.current&&clearTimeout(o.current)},[]);let W=E(()=>{y(typeof t=="string"?t:""),m(!0),r(null)},[t]),_=E(()=>{m(!1),y(""),r(null)},[]),D=E(async()=>{if(!c){r({type:"error",text:"Aucune fonction de sauvegarde fournie"});return}h(!0);try{await c(v)?(r({type:"success",text:"Sauvegard\xE9 avec succ\xE8s !"}),m(!1),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>r(null),2e3)):r({type:"error",text:"Erreur lors de la sauvegarde"})}catch{r({type:"error",text:"Erreur lors de la sauvegarde"})}finally{h(!1)}},[v,c]),U=E(async()=>{if(i&&confirm("\xCAtes-vous s\xFBr de vouloir r\xE9initialiser ce contenu ?")){h(!0);try{await i()?(r({type:"success",text:"R\xE9initialis\xE9 avec succ\xE8s !"}),m(!1),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>r(null),2e3)):r({type:"error",text:"Erreur lors de la r\xE9initialisation"})}catch{r({type:"error",text:"Erreur lors de la r\xE9initialisation"})}finally{h(!1)}}},[i]),k=t;return M?a("div",{className:"relative inline-flex items-center",children:[e("button",{type:"button",ref:S,onClick:()=>I(!g),className:`
2
- ${X[x]}
1
+ "use client";import{useState as b,useRef as E,useEffect as W,useCallback as C}from"react";import G from"dompurify";import K from"react-markdown";import q from"remark-gfm";import{useUILabels as V}from"../../lib/i18n.js";import{Fragment as ae,jsx as e,jsxs as a}from"react/jsx-runtime";var j=a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),e("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),F=a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),e("polyline",{points:"17 21 17 13 7 13 7 21"}),e("polyline",{points:"7 3 7 8 15 8"})]}),J=a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),Q=a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("polyline",{points:"1 4 1 10 7 10"}),e("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]}),X=a("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10"}),e("path",{className:"opacity-75",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z",fill:"currentColor"})]}),Y={xs:"w-4 h-4 text-[10px]",sm:"w-5 h-5 text-xs",md:"w-6 h-6 text-sm",lg:"w-7 h-7 text-base"},Z={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},ee={sm:"w-56",md:"w-72",lg:"w-96",xl:"w-[32rem]"},te=[q],re={h1:({...t})=>e("h1",{className:"text-xl font-bold mb-2 text-gray-900 dark:text-gray-100",...t}),h2:({...t})=>e("h2",{className:"text-lg font-semibold mt-4 mb-2 text-gray-900 dark:text-gray-100",...t}),h3:({...t})=>e("h3",{className:"text-base font-semibold mt-3 mb-1 text-gray-900 dark:text-gray-100",...t}),p:({...t})=>e("p",{className:"my-1 text-gray-700 dark:text-gray-300",...t}),ul:({...t})=>e("ul",{className:"list-disc list-inside space-y-1 my-2 text-gray-700 dark:text-gray-300",...t}),ol:({...t})=>e("ol",{className:"list-decimal list-inside space-y-1 my-2 text-gray-700 dark:text-gray-300",...t}),code:({className:t,children:n,...i})=>!t?.includes("language-")?e("code",{className:"bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded text-sm font-mono text-gray-900 dark:text-gray-100",...i,children:n}):e("code",{className:"block bg-gray-100 dark:bg-gray-800 rounded-lg p-3 my-2 overflow-x-auto text-sm font-mono text-gray-900 dark:text-gray-100",...i,children:n}),pre:({...t})=>e("pre",{className:"my-2",...t}),a:({...t})=>e("a",{className:"text-blue-600 dark:text-blue-400 hover:underline",...t}),strong:({...t})=>e("strong",{className:"font-semibold text-gray-900 dark:text-gray-100",...t}),em:({...t})=>e("em",{className:"italic",...t}),blockquote:({...t})=>e("blockquote",{className:"border-l-4 border-gray-300 dark:border-gray-600 pl-4 my-2 italic text-gray-600 dark:text-gray-400",...t})};function oe({content:t,markdown:n=!1,position:i="bottom",size:x="sm",className:B="",visible:R=!0,editable:f=!1,onSave:u,onReset:d,width:M="md",title:g,markdownEditor:h,markdownEditorUnavailableLabel:L,labels:I}){let r=V(I),[m,S]=b(!1),[l,p]=b(!1),[v,y]=b(""),[T,k]=b(!1),[O,o]=b(null),P=E(null),H=E(null),z=E(null),s=E(null);W(()=>{if(!m)return;let c=w=>{P.current&&!P.current.contains(w.target)&&H.current&&!H.current.contains(w.target)&&(l||S(!1))},_=w=>{w.key==="Escape"&&(l?(p(!1),y("")):S(!1))};return document.addEventListener("mousedown",c),document.addEventListener("keydown",_),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",_)}},[m,l]),W(()=>{l&&z.current&&z.current.focus()},[l]),W(()=>()=>{s.current&&clearTimeout(s.current)},[]);let U=C(()=>{y(typeof t=="string"?t:""),p(!0),o(null)},[t]),A=C(()=>{p(!1),y(""),o(null)},[]),D=C(async()=>{if(!u){o({type:"error",text:r.helpButtonNoSave});return}k(!0);try{await u(v)?(o({type:"success",text:r.helpButtonSaved}),p(!1),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>o(null),2e3)):o({type:"error",text:r.helpButtonSaveError})}catch{o({type:"error",text:r.helpButtonSaveError})}finally{k(!1)}},[v,u,r]),$=C(async()=>{if(d&&confirm(r.helpButtonResetConfirm)){k(!0);try{await d()?(o({type:"success",text:r.helpButtonResetDone}),p(!1),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>o(null),2e3)):o({type:"error",text:r.helpButtonResetError})}catch{o({type:"error",text:r.helpButtonResetError})}finally{k(!1)}}},[d,r]),N=t;return R?a("div",{className:"relative inline-flex items-center",children:[e("button",{type:"button",ref:P,onClick:()=>S(!m),className:`
2
+ ${Y[x]}
3
3
  inline-flex items-center justify-center
4
4
  rounded-full border border-gray-300 dark:border-gray-600
5
5
  bg-white dark:bg-gray-800
@@ -10,13 +10,13 @@
10
10
  hover:border-gray-400 dark:hover:border-gray-500
11
11
  transition-all duration-150
12
12
  focus:outline-none focus:ring-2 focus:ring-blue-500/50
13
- ${C}
14
- `,"aria-label":"Afficher l'aide","aria-expanded":g,children:e("span",{className:"font-medium",children:"?"})}),g&&a("div",{ref:z,className:`
15
- absolute z-50 ${Y[l]}
16
- ${Z[R]} max-h-[80vh] overflow-hidden flex flex-col
13
+ ${B}
14
+ `,"aria-label":r.helpButtonShow,"aria-expanded":m,children:e("span",{className:"font-medium",children:"?"})}),m&&a("div",{ref:H,className:`
15
+ absolute z-50 ${Z[i]}
16
+ ${ee[M]} max-h-[80vh] overflow-hidden flex flex-col
17
17
  bg-white dark:bg-gray-900
18
18
  border border-gray-200 dark:border-gray-700
19
19
  rounded-xl shadow-xl
20
20
  text-sm text-gray-700 dark:text-gray-300
21
21
  animate-in fade-in-0 zoom-in-95 duration-150
22
- `,role:"tooltip",children:[(u||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:u&&e("h3",{className:"text-sm font-semibold",children:u})}),f&&e("div",{className:"flex items-center gap-1",children:n?a(ae,{children:[e("button",{type:"button",onClick:D,disabled:B,className:"p-1.5 rounded-md hover:bg-green-100 dark:hover:bg-green-900/30 text-green-600 dark:text-green-400 transition-colors disabled:opacity-50 cursor-pointer",title:"Sauvegarder",children:B?Q:j}),e("button",{type:"button",onClick:_,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:"Annuler",children:F}),i&&e("button",{type:"button",onClick:U,disabled:B,className:"p-1.5 rounded-md hover:bg-orange-100 dark:hover:bg-orange-900/30 text-orange-600 dark:text-orange-400 transition-colors disabled:opacity-50 cursor-pointer",title:"R\xE9initialiser",children:J})]}):e("button",{type:"button",onClick:W,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:"Modifier",children:V})})]}),H&&e("div",{className:`px-4 py-2 text-xs ${H.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400"}`,children:H.text}),e("div",{className:"flex-1 overflow-y-auto p-4",children:n?s?b?e(b,{value:v,onChange:y,placeholder:"\xC9crivez en Markdown..."}):e("p",{role:"alert",className:"p-3 text-sm text-gray-500 dark:text-gray-400",children:L??T.markdownEditorUnavailable}):e("div",{className:"space-y-2",children:e("textarea",{ref:O,"aria-label":"Contenu d'aide",value:v,onChange:d=>y(d.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:"\xC9crivez votre contenu d'aide..."})}):typeof k=="string"?e("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:s?e(G,{remarkPlugins:ee,components:te,children:k}):e("div",{dangerouslySetInnerHTML:{__html:$.sanitize(k)}})}):k})]})]}):null}function de({children:t,content:s,markdown:l=!1,position:x="bottom",size:C="sm",visible:M=!0,editable:f=!1,onSave:c,onReset:i,width:R="md",title:u,className:b,markdownEditor:L,markdownEditorUnavailableLabel:T}){return a("div",{className:"inline-flex items-center gap-2.5",children:[t,e(re,{content:s,markdown:l,position:x,size:C,visible:M,editable:f,onSave:c,onReset:i,width:R,title:u,className:b,markdownEditor:L,markdownEditorUnavailableLabel:T})]})}export{re as HelpButton,de as WithHelpButton};
22
+ `,role:"tooltip",children:[(g||f)&&a("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:[e("div",{className:"flex items-center gap-2",children:g&&e("h3",{className:"text-sm font-semibold",children:g})}),f&&e("div",{className:"flex items-center gap-1",children:l?a(ae,{children:[e("button",{type:"button",onClick:D,disabled:T,className:"p-1.5 rounded-md hover:bg-green-100 dark:hover:bg-green-900/30 text-green-600 dark:text-green-400 transition-colors disabled:opacity-50 cursor-pointer",title:r.helpButtonSave,children:T?X:F}),e("button",{type:"button",onClick:A,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:r.helpButtonCancel,children:J}),d&&e("button",{type:"button",onClick:$,disabled:T,className:"p-1.5 rounded-md hover:bg-orange-100 dark:hover:bg-orange-900/30 text-orange-600 dark:text-orange-400 transition-colors disabled:opacity-50 cursor-pointer",title:r.helpButtonReset,children:Q})]}):e("button",{type:"button",onClick:U,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:r.helpButtonEdit,children:j})})]}),O&&e("div",{className:`px-4 py-2 text-xs ${O.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400"}`,children:O.text}),e("div",{className:"flex-1 overflow-y-auto p-4",children:l?n?h?e(h,{value:v,onChange:y,placeholder:r.markdownEditorPlaceholder}):e("p",{role:"alert",className:"p-3 text-sm text-gray-500 dark:text-gray-400",children:L??r.markdownEditorUnavailable}):e("div",{className:"space-y-2",children:e("textarea",{ref:z,"aria-label":r.helpButtonContent,value:v,onChange:c=>y(c.target.value),className:"w-full h-64 p-3 text-sm bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg resize-none focus:outline-none focus:ring-2 focus:ring-blue-500/50 text-gray-700 dark:text-gray-300 font-mono",placeholder:r.helpButtonContentPlaceholder})}):typeof N=="string"?e("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:n?e(K,{remarkPlugins:te,components:re,children:N}):e("div",{dangerouslySetInnerHTML:{__html:G.sanitize(N)}})}):N})]})]}):null}function ce({children:t,content:n,markdown:i=!1,position:x="bottom",size:B="sm",visible:R=!0,editable:f=!1,onSave:u,onReset:d,width:M="md",title:g,className:h,markdownEditor:L,markdownEditorUnavailableLabel:I,labels:r}){return a("div",{className:"inline-flex items-center gap-2.5",children:[t,e(oe,{content:n,markdown:i,position:x,size:B,visible:R,editable:f,onSave:u,onReset:d,width:M,title:g,className:h,markdownEditor:L,markdownEditorUnavailableLabel:I,labels:r})]})}export{oe as HelpButton,ce as WithHelpButton};
@@ -1 +1 @@
1
- "use strict";"use client";var l=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var p=(n,r)=>{for(var t in r)l(n,t,{get:r[t],enumerable:!0})},u=(n,r,t,d)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of c(r))!k.call(n,i)&&i!==t&&l(n,i,{get:()=>r[i],enumerable:!(d=g(r,i))||d.enumerable});return n};var m=n=>u(l({},"__esModule",{value:!0}),n);var w={};p(w,{MarkdownEditor:()=>s});module.exports=m(w);var f=require("@mdxeditor/editor/style.css"),o=require("@mdxeditor/editor"),a=require("react"),e=require("react/jsx-runtime"),P="\xC9crivez en Markdown...",E=()=>(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(o.UndoRedo,{}),(0,e.jsx)(o.BlockTypeSelect,{}),(0,e.jsx)(o.BoldItalicUnderlineToggles,{}),(0,e.jsx)(o.CodeToggle,{}),(0,e.jsx)(o.CreateLink,{}),(0,e.jsx)(o.ListsToggle,{}),(0,e.jsx)(o.InsertThematicBreak,{})]}),h=[(0,o.headingsPlugin)(),(0,o.listsPlugin)(),(0,o.quotePlugin)(),(0,o.linkPlugin)(),(0,o.linkDialogPlugin)(),(0,o.codeBlockPlugin)({defaultCodeBlockLanguage:""}),(0,o.thematicBreakPlugin)(),(0,o.markdownShortcutPlugin)(),(0,o.toolbarPlugin)({toolbarContents:E})],s=(0,a.forwardRef)(({value:n,onChange:r,placeholder:t=P},d)=>(0,e.jsx)("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden bg-white dark:bg-gray-800",children:(0,e.jsx)(o.MDXEditor,{ref:d,markdown:n,onChange:r,placeholder:t,contentEditableClassName:"prose prose-sm dark:prose-invert max-w-none p-3 min-h-[16rem] focus:outline-none",plugins:h})}));s.displayName="MarkdownEditor";0&&(module.exports={MarkdownEditor});
1
+ "use strict";"use client";var d=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var m=(t,r)=>{for(var n in r)d(t,n,{get:r[n],enumerable:!0})},p=(t,r,n,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of c(r))!k.call(t,a)&&a!==n&&d(t,a,{get:()=>r[a],enumerable:!(i=u(r,a))||i.enumerable});return t};var h=t=>p(d({},"__esModule",{value:!0}),t);var f={};m(f,{MarkdownEditor:()=>g});module.exports=h(f);var P=require("@mdxeditor/editor/style.css"),e=require("@mdxeditor/editor"),l=require("react"),s=require("../../lib/i18n.cjs"),o=require("react/jsx-runtime"),y=()=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(e.UndoRedo,{}),(0,o.jsx)(e.BlockTypeSelect,{}),(0,o.jsx)(e.BoldItalicUnderlineToggles,{}),(0,o.jsx)(e.CodeToggle,{}),(0,o.jsx)(e.CreateLink,{}),(0,o.jsx)(e.ListsToggle,{}),(0,o.jsx)(e.InsertThematicBreak,{})]}),b=[(0,e.headingsPlugin)(),(0,e.listsPlugin)(),(0,e.quotePlugin)(),(0,e.linkPlugin)(),(0,e.linkDialogPlugin)(),(0,e.codeBlockPlugin)({defaultCodeBlockLanguage:""}),(0,e.thematicBreakPlugin)(),(0,e.markdownShortcutPlugin)(),(0,e.toolbarPlugin)({toolbarContents:y})],g=(0,l.forwardRef)(({value:t,onChange:r,placeholder:n},i)=>{let a=(0,s.useUILabels)();return(0,o.jsx)("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden bg-white dark:bg-gray-800",children:(0,o.jsx)(e.MDXEditor,{ref:i,markdown:t,onChange:r,placeholder:n??a.markdownEditorPlaceholder,contentEditableClassName:"prose prose-sm dark:prose-invert dark:text-gray-300! max-w-none p-3 min-h-[16rem] focus:outline-none",plugins:b})})});g.displayName="MarkdownEditor";0&&(module.exports={MarkdownEditor});
@@ -1 +1 @@
1
- "use client";import"@mdxeditor/editor/style.css";import{MDXEditor as i,headingsPlugin as d,listsPlugin as l,quotePlugin as a,linkPlugin as s,linkDialogPlugin as g,codeBlockPlugin as c,thematicBreakPlugin as k,markdownShortcutPlugin as p,toolbarPlugin as u,BlockTypeSelect as m,BoldItalicUnderlineToggles as P,CodeToggle as E,ListsToggle as h,CreateLink as w,InsertThematicBreak as M,UndoRedo as f}from"@mdxeditor/editor";import{forwardRef as T}from"react";import{Fragment as B,jsx as o,jsxs as D}from"react/jsx-runtime";var b="\xC9crivez en Markdown...",y=()=>D(B,{children:[o(f,{}),o(m,{}),o(P,{}),o(E,{}),o(w,{}),o(h,{}),o(M,{})]}),C=[d(),l(),a(),s(),g(),c({defaultCodeBlockLanguage:""}),k(),p(),u({toolbarContents:y})],L=T(({value:e,onChange:r,placeholder:n=b},t)=>o("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden bg-white dark:bg-gray-800",children:o(i,{ref:t,markdown:e,onChange:r,placeholder:n,contentEditableClassName:"prose prose-sm dark:prose-invert max-w-none p-3 min-h-[16rem] focus:outline-none",plugins:C})}));L.displayName="MarkdownEditor";export{L as MarkdownEditor};
1
+ "use client";import"@mdxeditor/editor/style.css";import{MDXEditor as i,headingsPlugin as d,listsPlugin as l,quotePlugin as s,linkPlugin as g,linkDialogPlugin as u,codeBlockPlugin as c,thematicBreakPlugin as k,markdownShortcutPlugin as m,toolbarPlugin as p,BlockTypeSelect as h,BoldItalicUnderlineToggles as y,CodeToggle as b,ListsToggle as f,CreateLink as w,InsertThematicBreak as P,UndoRedo as E}from"@mdxeditor/editor";import{forwardRef as M}from"react";import{useUILabels as T}from"../../lib/i18n.js";import{Fragment as N,jsx as e,jsxs as D}from"react/jsx-runtime";var B=()=>D(N,{children:[e(E,{}),e(h,{}),e(y,{}),e(b,{}),e(w,{}),e(f,{}),e(P,{})]}),C=[d(),l(),s(),g(),u(),c({defaultCodeBlockLanguage:""}),k(),m(),p({toolbarContents:B})],L=M(({value:o,onChange:r,placeholder:t},a)=>{let n=T();return e("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden bg-white dark:bg-gray-800",children:e(i,{ref:a,markdown:o,onChange:r,placeholder:t??n.markdownEditorPlaceholder,contentEditableClassName:"prose prose-sm dark:prose-invert dark:text-gray-300! max-w-none p-3 min-h-[16rem] focus:outline-none",plugins:C})})});L.displayName="MarkdownEditor";export{L as MarkdownEditor};
@@ -1 +1 @@
1
- "use strict";"use client";var f=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var $=Object.prototype.hasOwnProperty;var T=(a,e)=>{for(var s in e)f(a,s,{get:e[s],enumerable:!0})},H=(a,e,s,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of R(e))!$.call(a,l)&&l!==s&&f(a,l,{get:()=>e[l],enumerable:!(o=M(e,l))||o.enumerable});return a};var j=a=>H(f({},"__esModule",{value:!0}),a);var D={};T(D,{ImageUploader:()=>G});module.exports=j(D);var t=require("react"),r=require("react/jsx-runtime"),A={"16/9":"aspect-[16/9]","4/3":"aspect-[4/3]","1/1":"aspect-square",auto:""},B=a=>new Promise((e,s)=>{let o=new FileReader;o.onload=l=>{let u=l.target?.result;e(u)},o.onerror=()=>{s(new Error("Erreur lors de la lecture du fichier"))},o.readAsDataURL(a)});function G({value:a,onChange:e,onUpload:s,label:o="Image",maxSize:l=5*1024*1024,accept:u="image/*",helpText:w,disabled:m=!1,className:N="",showUrlInput:I=!0,urlPlaceholder:U="https://example.com/image.jpg",aspectRatio:y="16/9"}){let[p,x]=(0,t.useState)(!1),[h,n]=(0,t.useState)(null),d=(0,t.useRef)(null),v=(0,t.useId)(),b=(0,t.useMemo)(()=>(l/(1024*1024)).toFixed(0),[l]),E=`Formats accept\xE9s : ${u==="image/*"?"JPG, PNG, GIF, WebP":u} (max ${b}MB)`,C=(0,t.useCallback)(async c=>{let g=c.target.files?.[0];if(g){if(!g.type.startsWith("image/")){n("Le fichier doit \xEAtre une image");return}if(g.size>l){n(`Le fichier est trop volumineux (max ${b}MB)`);return}x(!0),n(null);try{if(s){let i=await s(g);e(i)}else{let i=await B(g);e(i)}d.current&&(d.current.value="")}catch(i){console.error("Upload error:",i),n(i instanceof Error?i.message:"Erreur lors de l'upload")}finally{x(!1)}}},[l,b,e,s]),F=(0,t.useCallback)(()=>{e(""),d.current&&(d.current.value=""),n(null)},[e]),k=(0,t.useCallback)(c=>{e(c),n(null)},[e]),P=(0,t.useCallback)(()=>{d.current?.click()},[]),L=(0,t.useCallback)(c=>{k(c.target.value)},[k]);return(0,r.jsxs)("div",{className:`space-y-2 ${N}`,children:[o&&(0,r.jsx)("label",{className:"block text-sm font-semibold text-gray-700 dark:text-gray-300",children:o}),a&&(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[y]} ${y==="auto"?"max-h-64":""} flex items-center justify-center`,children:(0,r.jsx)("img",{src:a,alt:"Aper\xE7u",className:"w-full h-full object-contain"})}),(0,r.jsx)("button",{type:"button",onClick:F,disabled:m,className:"absolute top-2 right-2 bg-red-500 text-white rounded-full w-6 h-6 flex items-center justify-center text-xs hover:bg-red-600 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",title:"Supprimer l'image",children:"\xD7"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("input",{ref:d,type:"file","aria-label":"Choisir une image",accept:u,onChange:C,className:"hidden",disabled:m||p}),(0,r.jsx)("button",{type:"button",onClick:P,disabled:m||p,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:p?"\u23F3 Upload...":a?"\u{1F4C1} Changer l'image":"\u{1F4C1} Choisir une image"})]}),I&&(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("label",{htmlFor:v,className:"block text-xs text-gray-500 dark:text-gray-400",children:"Ou URL directe :"}),(0,r.jsx)("input",{id:v,type:"url",value:a||"",onChange:L,placeholder:U,disabled:m,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"})]}),h&&(0,r.jsxs)("div",{className:"text-red-600 dark:text-red-400 text-sm bg-red-50 dark:bg-red-900/20 p-2 rounded border border-red-200 dark:border-red-800",children:["\u274C ",h]}),(0,r.jsx)("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:w||E})]})}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 f=g.target?.result;s(f)},l.onerror=()=>{i(new Error(e))},l.readAsDataURL(t)});function O({value:t,onChange:e,onUpload:s,label:i,maxSize:l=5*1024*1024,accept:g="image/*",helpText:f,disabled:b=!1,className:L="",showUrlInput:E=!0,urlPlaceholder:C="https://example.com/image.jpg",labels:P,aspectRatio:h="16/9"}){let o=(0,p.useUILabels)(P),v=i??o.imageUploaderLabel,[y,k]=(0,a.useState)(!1),[I,n]=(0,a.useState)(null),c=(0,a.useRef)(null),w=(0,a.useId)(),x=(0,a.useMemo)(()=>(l/(1024*1024)).toFixed(0),[l]),F=(0,p.formatUILabel)(o.imageUploaderHelp,{formats:g==="image/*"?"JPG, PNG, GIF, WebP":g,maxSize:x}),R=(0,a.useCallback)(async u=>{let m=u.target.files?.[0];if(m){if(!m.type.startsWith("image/")){n(o.imageUploaderNotImage);return}if(m.size>l){n((0,p.formatUILabel)(o.imageUploaderTooLarge,{maxSize:x}));return}k(!0),n(null);try{if(s){let d=await s(m);e(d)}else{let d=await D(m,o.imageUploaderReadError);e(d)}c.current&&(c.current.value="")}catch(d){console.error("Upload error:",d),n(d instanceof Error?d.message:o.imageUploaderUploadError)}finally{k(!1)}}},[l,x,e,s,o]),M=(0,a.useCallback)(()=>{e(""),c.current&&(c.current.value=""),n(null)},[e]),N=(0,a.useCallback)(u=>{e(u),n(null)},[e]),T=(0,a.useCallback)(()=>{c.current?.click()},[]),H=(0,a.useCallback)(u=>{N(u.target.value)},[N]);return(0,r.jsxs)("div",{className:`space-y-2 ${L}`,children:[v&&(0,r.jsx)("label",{className:"block text-sm font-semibold text-gray-700 dark:text-gray-300",children:v}),t&&(0,r.jsxs)("div",{className:"relative w-full overflow-hidden rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800/50",children:[(0,r.jsx)("div",{className:`relative ${A[h]} ${h==="auto"?"max-h-64":""} flex items-center justify-center`,children:(0,r.jsx)("img",{src:t,alt:o.imageUploaderPreview,className:"w-full h-full object-contain"})}),(0,r.jsx)("button",{type:"button",onClick:M,disabled:b,className:"absolute top-2 right-2 bg-red-500 text-white rounded-full w-6 h-6 flex items-center justify-center text-xs hover:bg-red-600 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",title:o.imageUploaderRemove,children:"\xD7"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("input",{ref:c,type:"file","aria-label":o.imageUploaderChoose,accept:g,onChange:R,className:"hidden",disabled:b||y}),(0,r.jsx)("button",{type:"button",onClick:T,disabled:b||y,className:"px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200",children:y?o.imageUploaderUploading:t?o.imageUploaderChangeButton:o.imageUploaderChooseButton})]}),E&&(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("label",{htmlFor:w,className:"block text-xs text-gray-500 dark:text-gray-400",children:o.imageUploaderUrlLabel}),(0,r.jsx)("input",{id:w,type:"url",value:t||"",onChange:H,placeholder:C,disabled:b,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-800 dark:text-gray-200 disabled:opacity-50 disabled:cursor-not-allowed"})]}),I&&(0,r.jsxs)("div",{className:"text-red-600 dark:text-red-400 text-sm bg-red-50 dark:bg-red-900/20 p-2 rounded border border-red-200 dark:border-red-800",children:["\u274C ",I]}),(0,r.jsx)("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:f||F})]})}0&&(module.exports={ImageUploader});
@@ -1 +1 @@
1
- "use client";import{useState as w,useRef as R,useCallback as g,useMemo as $,useId as T}from"react";import{jsx as r,jsxs as m}from"react/jsx-runtime";var H={"16/9":"aspect-[16/9]","4/3":"aspect-[4/3]","1/1":"aspect-square",auto:""},j=a=>new Promise((e,n)=>{let l=new FileReader;l.onload=s=>{let d=s.target?.result;e(d)},l.onerror=()=>{n(new Error("Erreur lors de la lecture du fichier"))},l.readAsDataURL(a)});function B({value:a,onChange:e,onUpload:n,label:l="Image",maxSize:s=5*1024*1024,accept:d="image/*",helpText:N,disabled:p=!1,className:I="",showUrlInput:U=!0,urlPlaceholder:E="https://example.com/image.jpg",aspectRatio:y="16/9"}){let[b,x]=w(!1),[h,o]=w(null),i=R(null),v=T(),f=$(()=>(s/(1024*1024)).toFixed(0),[s]),C=`Formats accept\xE9s : ${d==="image/*"?"JPG, PNG, GIF, WebP":d} (max ${f}MB)`,F=g(async u=>{let c=u.target.files?.[0];if(c){if(!c.type.startsWith("image/")){o("Le fichier doit \xEAtre une image");return}if(c.size>s){o(`Le fichier est trop volumineux (max ${f}MB)`);return}x(!0),o(null);try{if(n){let t=await n(c);e(t)}else{let t=await j(c);e(t)}i.current&&(i.current.value="")}catch(t){console.error("Upload error:",t),o(t instanceof Error?t.message:"Erreur lors de l'upload")}finally{x(!1)}}},[s,f,e,n]),P=g(()=>{e(""),i.current&&(i.current.value=""),o(null)},[e]),k=g(u=>{e(u),o(null)},[e]),L=g(()=>{i.current?.click()},[]),M=g(u=>{k(u.target.value)},[k]);return m("div",{className:`space-y-2 ${I}`,children:[l&&r("label",{className:"block text-sm font-semibold text-gray-700 dark:text-gray-300",children:l}),a&&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:[r("div",{className:`relative ${H[y]} ${y==="auto"?"max-h-64":""} flex items-center justify-center`,children:r("img",{src:a,alt:"Aper\xE7u",className:"w-full h-full object-contain"})}),r("button",{type:"button",onClick:P,disabled:p,className:"absolute top-2 right-2 bg-red-500 text-white rounded-full w-6 h-6 flex items-center justify-center text-xs hover:bg-red-600 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",title:"Supprimer l'image",children:"\xD7"})]}),m("div",{className:"flex gap-2",children:[r("input",{ref:i,type:"file","aria-label":"Choisir une image",accept:d,onChange:F,className:"hidden",disabled:p||b}),r("button",{type:"button",onClick:L,disabled:p||b,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:b?"\u23F3 Upload...":a?"\u{1F4C1} Changer l'image":"\u{1F4C1} Choisir une image"})]}),U&&m("div",{className:"space-y-1",children:[r("label",{htmlFor:v,className:"block text-xs text-gray-500 dark:text-gray-400",children:"Ou URL directe :"}),r("input",{id:v,type:"url",value:a||"",onChange:M,placeholder:E,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"})]}),h&&m("div",{className:"text-red-600 dark:text-red-400 text-sm bg-red-50 dark:bg-red-900/20 p-2 rounded border border-red-200 dark:border-red-800",children:["\u274C ",h]}),r("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:N||C})]})}export{B 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 f=n.target?.result;i(f)},t.onerror=()=>{b(new Error(r))},t.readAsDataURL(o)});function W({value:o,onChange:r,onUpload:i,label:b,maxSize:t=5*1024*1024,accept:n="image/*",helpText:f,disabled:p=!1,className:E="",showUrlInput:C=!0,urlPlaceholder:P="https://example.com/image.jpg",labels:F,aspectRatio:U="16/9"}){let e=$(F),h=b??e.imageUploaderLabel,[y,v]=N(!1),[k,s]=N(null),d=B(null),I=S(),x=G(()=>(t/(1024*1024)).toFixed(0),[t]),R=L(e.imageUploaderHelp,{formats:n==="image/*"?"JPG, PNG, GIF, WebP":n,maxSize:x}),M=u(async c=>{let g=c.target.files?.[0];if(g){if(!g.type.startsWith("image/")){s(e.imageUploaderNotImage);return}if(g.size>t){s(L(e.imageUploaderTooLarge,{maxSize:x}));return}v(!0),s(null);try{if(i){let l=await i(g);r(l)}else{let l=await A(g,e.imageUploaderReadError);r(l)}d.current&&(d.current.value="")}catch(l){console.error("Upload error:",l),s(l instanceof Error?l.message:e.imageUploaderUploadError)}finally{v(!1)}}},[t,x,r,i,e]),T=u(()=>{r(""),d.current&&(d.current.value=""),s(null)},[r]),w=u(c=>{r(c),s(null)},[r]),H=u(()=>{d.current?.click()},[]),j=u(c=>{w(c.target.value)},[w]);return m("div",{className:`space-y-2 ${E}`,children:[h&&a("label",{className:"block text-sm font-semibold text-gray-700 dark:text-gray-300",children:h}),o&&m("div",{className:"relative w-full overflow-hidden rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800/50",children:[a("div",{className:`relative ${z[U]} ${U==="auto"?"max-h-64":""} flex items-center justify-center`,children:a("img",{src:o,alt:e.imageUploaderPreview,className:"w-full h-full object-contain"})}),a("button",{type:"button",onClick:T,disabled:p,className:"absolute top-2 right-2 bg-red-500 text-white rounded-full w-6 h-6 flex items-center justify-center text-xs hover:bg-red-600 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",title:e.imageUploaderRemove,children:"\xD7"})]}),m("div",{className:"flex gap-2",children:[a("input",{ref:d,type:"file","aria-label":e.imageUploaderChoose,accept:n,onChange:M,className:"hidden",disabled:p||y}),a("button",{type:"button",onClick:H,disabled:p||y,className:"px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200",children:y?e.imageUploaderUploading:o?e.imageUploaderChangeButton:e.imageUploaderChooseButton})]}),C&&m("div",{className:"space-y-1",children:[a("label",{htmlFor:I,className:"block text-xs text-gray-500 dark:text-gray-400",children:e.imageUploaderUrlLabel}),a("input",{id:I,type:"url",value:o||"",onChange:j,placeholder:P,disabled:p,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-800 dark:text-gray-200 disabled:opacity-50 disabled:cursor-not-allowed"})]}),k&&m("div",{className:"text-red-600 dark:text-red-400 text-sm bg-red-50 dark:bg-red-900/20 p-2 rounded border border-red-200 dark:border-red-800",children:["\u274C ",k]}),a("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:f||R})]})}export{W as ImageUploader};
@@ -1 +1 @@
1
- "use strict";var p=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var r in t)p(e,r,{get:t[r],enumerable:!0})},P=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of I(t))!w.call(e,a)&&a!==r&&p(e,a,{get:()=>t[a],enumerable:!(n=y(t,a))||n.enumerable});return e};var z=e=>P(p({},"__esModule",{value:!0}),e);var V={};C(V,{Indicator:()=>x});module.exports=z(V);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"},g={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 k({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],g[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="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:b,...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 text-white",m[e],N[t],d?f[r]:u[r],s&&(0,i.cn)("ring-2 ring-white dark:ring-gray-900",l),c&&"animate-pulse",b),...h,children:R(n,a)})}function S({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],g[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 O({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],g[t])}),r?(0,o.jsx)("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:r}):null]})}function x({variant:e="dot",children:t,...r}){if(e==="legend")return(0,o.jsx)(O,{...r});let n=(()=>{switch(e){case"count":return(0,o.jsx)(v,{...r});case"status":return(0,o.jsx)(S,{...r});default:return(0,o.jsx)(k,{...r})}})();return t?(0,o.jsxs)("div",{className:"relative inline-flex",children:[t,n]}):n}x.displayName="Indicator";0&&(module.exports={Indicator});
1
+ "use strict";var p=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var r in t)p(e,r,{get:t[r],enumerable:!0})},P=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of I(t))!w.call(e,a)&&a!==r&&p(e,a,{get:()=>t[a],enumerable:!(n=y(t,a))||n.enumerable});return e};var z=e=>P(p({},"__esModule",{value:!0}),e);var W={};C(W,{Indicator:()=>x});module.exports=z(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"},N={warning:"text-gray-900"},g={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"},R={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 k(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],g[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:b,...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",N[e]??"text-white",m[e],R[t],d?f[r]:u[r],s&&(0,i.cn)("ring-2 ring-white dark:ring-gray-900",l),c&&"animate-pulse",b),...h,children:k(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],g[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],g[t])}),r?(0,o.jsx)("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:r}):null]})}function x({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}x.displayName="Indicator";0&&(module.exports={Indicator});
@@ -1 +1 @@
1
- import{cn as o}from"../../lib/cn.js";import{jsx as a,jsxs as f}from"react/jsx-runtime";var 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"},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"},h={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"},g={"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 y(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",m[e],p[r],l?u[t]:g[t],n&&o("ring-2 ring-white dark:ring-gray-900",i),s&&"animate-pulse",c),...d})}function w({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:x,...b}){return a("span",{"data-testid":"indicator",className:o("absolute z-10 inline-flex items-center justify-center rounded-full font-semibold text-white",m[e],h[r],d?u[t]:g[t],s&&o("ring-2 ring-white dark:ring-gray-900",l),c&&"animate-pulse",x),...b,children:y(n,i)})}function C({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",m[e],p[r],l?u[t]:g[t],n&&o("ring-2 ring-white dark:ring-gray-900",i),s&&"animate-pulse",c),...d})}function P({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",m[e],p[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(P,{...t});let n=(()=>{switch(e){case"count":return a(w,{...t});case"status":return a(C,{...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
+ import{cn as o}from"../../lib/cn.js";import{jsx as a,jsxs as f}from"react/jsx-runtime";var 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"},h={warning:"text-gray-900"},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"},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"},g={"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 I(e,r){return e>r?`${r}+`:`${e}`}function w({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",m[e],p[r],l?u[t]:g[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:x,...b}){return a("span",{"data-testid":"indicator",className:o("absolute z-10 inline-flex items-center justify-center rounded-full font-semibold",h[e]??"text-white",m[e],y[r],d?u[t]:g[t],s&&o("ring-2 ring-white dark:ring-gray-900",l),c&&"animate-pulse",x),...b,children:I(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",m[e],p[r],l?u[t]:g[t],n&&o("ring-2 ring-white dark:ring-gray-900",i),s&&"animate-pulse",c),...d})}function z({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",m[e],p[r])}),t?a("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:t}):null]})}function N({variant:e="dot",children:r,...t}){if(e==="legend")return a(z,{...t});let n=(()=>{switch(e){case"count":return a(C,{...t});case"status":return a(P,{...t});default:return a(w,{...t})}})();return r?f("div",{className:"relative inline-flex",children:[r,n]}):n}N.displayName="Indicator";export{N as Indicator};
@@ -1 +1 @@
1
- "use strict";var d=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var H=(t,e)=>{for(var l in e)d(t,l,{get:e[l],enumerable:!0})},M=(t,e,l,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of z(e))!T.call(t,r)&&r!==l&&d(t,r,{get:()=>e[r],enumerable:!(o=S(e,r))||o.enumerable});return t};var V=t=>M(d({},"__esModule",{value:!0}),t);var q={};H(q,{Label:()=>p});module.exports=V(q);var s=require("../../lib/cn.cjs"),a=require("react/jsx-runtime"),W={xs:"text-xs",sm:"text-sm",md:"text-sm",lg:"text-base",xl:"text-lg"},c={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"},P={default:{default:"text-gray-700 dark:text-gray-200",light:"text-gray-500 dark:text-gray-400",strong:"text-gray-900 dark:text-white"},primary:{default:"text-blue-600 dark:text-blue-400",light:"text-blue-400 dark:text-blue-300",strong:"text-blue-700 dark:text-blue-300"},secondary:{default:"text-purple-600 dark:text-purple-400",light:"text-purple-400 dark:text-purple-300",strong:"text-purple-700 dark:text-purple-300"},success:{default:"text-green-600 dark:text-green-400",light:"text-green-400 dark:text-green-300",strong:"text-green-700 dark:text-green-300"},warning:{default:"text-yellow-600 dark:text-yellow-400",light:"text-yellow-400 dark:text-yellow-300",strong:"text-yellow-700 dark:text-yellow-300"},error:{default:"text-red-600 dark:text-red-400",light:"text-red-400 dark:text-red-300",strong:"text-red-700 dark:text-red-300"},info:{default:"text-cyan-600 dark:text-cyan-400",light:"text-cyan-400 dark:text-cyan-300",strong:"text-cyan-700 dark:text-cyan-300"},muted:{default:"text-gray-500 dark:text-gray-400",light:"text-gray-400 dark:text-gray-500",strong:"text-gray-600 dark:text-gray-300"}};function p({children:t,size:e="md",color:l="default",variant:o="default",weight:r="medium",textColor:m,required:n=!1,requiredIndicator:u="*",optional:b=!1,optionalText:y="(optional)",tooltip:f,icon:i,endIcon:x,disabled:g=!1,truncate:k=!1,as:h="label",className:L,...w}){let C=h,N=(0,s.cn)("inline-flex items-center gap-1.5 transition-colors",W[e],A[r]),R=m||P[l][o];return(0,a.jsxs)(C,{className:(0,s.cn)(N,R,g?"opacity-50 cursor-not-allowed":"cursor-default",L),title:f,"aria-disabled":g,...w,children:[i&&(0,a.jsx)("span",{className:(0,s.cn)("shrink-0",c[e]),children:i}),(0,a.jsxs)("span",{className:(0,s.cn)(k&&"truncate"),children:[t,n&&(0,a.jsx)("span",{className:"text-red-500 ml-0.5","aria-hidden":"true",children:u}),n&&(0,a.jsx)("span",{className:"sr-only",children:"(required)"})]}),b&&!n&&(0,a.jsx)("span",{className:"text-gray-400 dark:text-gray-500 font-normal",children:y}),x&&(0,a.jsx)("span",{className:(0,s.cn)("shrink-0",c[e]),children:x})]})}p.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"},p={xs:"w-3 h-3",sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-4.5 h-4.5",xl:"w-5 h-5"},A={normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},I={default:{default:"text-gray-700 dark:text-gray-200",light:"text-gray-500 dark:text-gray-400",strong:"text-gray-900 dark:text-white"},primary:{default:"text-blue-600 dark:text-blue-400",light:"text-blue-400 dark:text-blue-300",strong:"text-blue-700 dark:text-blue-300"},secondary:{default:"text-purple-600 dark:text-purple-400",light:"text-purple-400 dark:text-purple-300",strong:"text-purple-700 dark:text-purple-300"},success:{default:"text-green-600 dark:text-green-400",light:"text-green-400 dark:text-green-300",strong:"text-green-700 dark:text-green-300"},warning:{default:"text-yellow-600 dark:text-yellow-400",light:"text-yellow-400 dark:text-yellow-300",strong:"text-yellow-700 dark:text-yellow-300"},error:{default:"text-red-600 dark:text-red-400",light:"text-red-400 dark:text-red-300",strong:"text-red-700 dark:text-red-300"},info:{default:"text-cyan-600 dark:text-cyan-400",light:"text-cyan-400 dark:text-cyan-300",strong:"text-cyan-700 dark:text-cyan-300"},muted:{default:"text-gray-500 dark:text-gray-400",light:"text-gray-400 dark:text-gray-500",strong:"text-gray-600 dark:text-gray-300"}};function m({children:t,size:e="md",color:l="default",variant:o="default",weight:r="medium",textColor:b,required:n=!1,requiredIndicator:u="*",requiredLabel:y=i.serverUILabels.labelRequired,optional:f=!1,optionalText:k=i.serverUILabels.labelOptional,tooltip:h,icon:x,endIcon:g,disabled:c=!1,truncate:L=!1,as:w="label",className:C,...N}){let R=w,S=(0,s.cn)("inline-flex items-center gap-1.5 transition-colors",v[e],A[r]),z=b||I[l][o];return(0,a.jsxs)(R,{className:(0,s.cn)(S,z,c?"opacity-50 cursor-not-allowed":"cursor-default",C),title:h,"aria-disabled":c,...N,children:[x&&(0,a.jsx)("span",{className:(0,s.cn)("shrink-0",p[e]),children:x}),(0,a.jsxs)("span",{className:(0,s.cn)(L&&"truncate"),children:[t,n&&(0,a.jsx)("span",{className:"text-red-500 ml-0.5","aria-hidden":"true",children:u}),n&&(0,a.jsx)("span",{className:"sr-only",children:y})]}),f&&!n&&(0,a.jsx)("span",{className:"text-gray-400 dark:text-gray-500 font-normal",children:k}),g&&(0,a.jsx)("span",{className:(0,s.cn)("shrink-0",p[e]),children:g})]})}m.displayName="Label";0&&(module.exports={Label});
@@ -1 +1 @@
1
- import{cn as e}from"../../lib/cn.js";import{jsx as t,jsxs as d}from"react/jsx-runtime";var R={xs:"text-xs",sm:"text-sm",md:"text-sm",lg:"text-base",xl:"text-lg"},n={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"},S={normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},z={default:{default:"text-gray-700 dark:text-gray-200",light:"text-gray-500 dark:text-gray-400",strong:"text-gray-900 dark:text-white"},primary:{default:"text-blue-600 dark:text-blue-400",light:"text-blue-400 dark:text-blue-300",strong:"text-blue-700 dark:text-blue-300"},secondary:{default:"text-purple-600 dark:text-purple-400",light:"text-purple-400 dark:text-purple-300",strong:"text-purple-700 dark:text-purple-300"},success:{default:"text-green-600 dark:text-green-400",light:"text-green-400 dark:text-green-300",strong:"text-green-700 dark:text-green-300"},warning:{default:"text-yellow-600 dark:text-yellow-400",light:"text-yellow-400 dark:text-yellow-300",strong:"text-yellow-700 dark:text-yellow-300"},error:{default:"text-red-600 dark:text-red-400",light:"text-red-400 dark:text-red-300",strong:"text-red-700 dark:text-red-300"},info:{default:"text-cyan-600 dark:text-cyan-400",light:"text-cyan-400 dark:text-cyan-300",strong:"text-cyan-700 dark:text-cyan-300"},muted:{default:"text-gray-500 dark:text-gray-400",light:"text-gray-400 dark:text-gray-500",strong:"text-gray-600 dark:text-gray-300"}};function T({children:i,size:a="md",color:x="default",variant:g="default",weight:c="medium",textColor:p,required:r=!1,requiredIndicator:m="*",optional:u=!1,optionalText:b="(optional)",tooltip:y,icon:l,endIcon:s,disabled:o=!1,truncate:f=!1,as:k="label",className:h,...L}){let w=k,C=e("inline-flex items-center gap-1.5 transition-colors",R[a],S[c]),N=p||z[x][g];return d(w,{className:e(C,N,o?"opacity-50 cursor-not-allowed":"cursor-default",h),title:y,"aria-disabled":o,...L,children:[l&&t("span",{className:e("shrink-0",n[a]),children:l}),d("span",{className:e(f&&"truncate"),children:[i,r&&t("span",{className:"text-red-500 ml-0.5","aria-hidden":"true",children:m}),r&&t("span",{className:"sr-only",children:"(required)"})]}),u&&!r&&t("span",{className:"text-gray-400 dark:text-gray-500 font-normal",children:b}),s&&t("span",{className:e("shrink-0",n[a]),children:s})]})}T.displayName="Label";export{T 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-blue-600 dark:text-blue-400",light:"text-blue-400 dark:text-blue-300",strong:"text-blue-700 dark:text-blue-300"},secondary:{default:"text-purple-600 dark:text-purple-400",light:"text-purple-400 dark:text-purple-300",strong:"text-purple-700 dark:text-purple-300"},success:{default:"text-green-600 dark:text-green-400",light:"text-green-400 dark:text-green-300",strong:"text-green-700 dark:text-green-300"},warning:{default:"text-yellow-600 dark:text-yellow-400",light:"text-yellow-400 dark:text-yellow-300",strong:"text-yellow-700 dark:text-yellow-300"},error:{default:"text-red-600 dark:text-red-400",light:"text-red-400 dark:text-red-300",strong:"text-red-700 dark:text-red-300"},info:{default:"text-cyan-600 dark:text-cyan-400",light:"text-cyan-400 dark:text-cyan-300",strong:"text-cyan-700 dark:text-cyan-300"},muted:{default:"text-gray-500 dark:text-gray-400",light:"text-gray-400 dark:text-gray-500",strong:"text-gray-600 dark:text-gray-300"}};function M({children:x,size:a="md",color:g="default",variant:c="default",weight:p="medium",textColor:m,required:r=!1,requiredIndicator:b="*",requiredLabel:u=n.labelRequired,optional:y=!1,optionalText:f=n.labelOptional,tooltip:k,icon:l,endIcon:s,disabled:o=!1,truncate:h=!1,as:L="label",className:w,...C}){let N=L,R=e("inline-flex items-center gap-1.5 transition-colors",z[a],T[p]),S=m||H[g][c];return i(N,{className:e(R,S,o?"opacity-50 cursor-not-allowed":"cursor-default",w),title:k,"aria-disabled":o,...C,children:[l&&t("span",{className:e("shrink-0",d[a]),children:l}),i("span",{className:e(h&&"truncate"),children:[x,r&&t("span",{className:"text-red-500 ml-0.5","aria-hidden":"true",children:b}),r&&t("span",{className:"sr-only",children:u})]}),y&&!r&&t("span",{className:"text-gray-400 dark:text-gray-500 font-normal",children:f}),s&&t("span",{className:e("shrink-0",d[a]),children:s})]})}M.displayName="Label";export{M as Label};
@@ -1 +1 @@
1
- "use strict";"use client";var Pe=Object.defineProperty;var Xe=Object.getOwnPropertyDescriptor;var $e=Object.getOwnPropertyNames;var Ge=Object.prototype.hasOwnProperty;var Oe=(h,a)=>{for(var o in a)Pe(h,o,{get:a[o],enumerable:!0})},_e=(h,a,o,s)=>{if(a&&typeof a=="object"||typeof a=="function")for(let u of $e(a))!Ge.call(h,u)&&u!==o&&Pe(h,u,{get:()=>a[u],enumerable:!(s=Xe(a,u))||s.enumerable});return h};var ze=h=>_e(Pe({},"__esModule",{value:!0}),h);var Qe={};Oe(Qe,{LineChart:()=>Je});module.exports=ze(Qe);var l=require("react"),Re=require("../../lib/cn.cjs"),we=require("../../lib/i18n.cjs"),U=require("../chart/ChartAnnotations.cjs"),Le=require("../chart/ChartAxis.cjs"),se=require("../chart/ChartBrush.cjs"),Ae=require("../chart/ChartContainer.cjs"),Ve=require("../chart/ChartGrid.cjs"),Te=require("../chart/ChartLegend.cjs"),Ee=require("../chart/ChartSync.cjs"),Be=require("../chart/ChartTableView.cjs"),ie=require("../chart/ChartTooltip.cjs"),E=require("../chart/palette.cjs"),v=require("../chart/utils/cartesian.cjs"),j=require("../chart/utils/data.cjs"),le=require("../chart/utils/decimate.cjs"),he=require("../chart/utils/format.cjs"),B=require("../chart/utils/path.cjs"),T=require("../chart/utils/scales.cjs"),He=require("../chart/utils/ticks.cjs"),We=require("../chart/utils/timestamp.cjs"),Ie=require("../chart/utils/touch.cjs"),n=require("react/jsx-runtime"),Ue=24,je=10,Fe=10,Ye=(0,l.memo)(function({lines:a,showMarkers:o}){return(0,n.jsx)("g",{children:a.map(s=>(0,n.jsxs)("g",{children:[s.solid?(0,n.jsx)("path",{d:s.solid,fill:"none",stroke:s.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}):null,s.dashed?(0,n.jsx)("path",{d:s.dashed,fill:"none",stroke:s.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:"5 4"}):null,(o?s.markers:s.isolated).map(u=>(0,n.jsx)("circle",{cx:u.x,cy:u.y,r:3,fill:s.color,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},`${u.x}-${u.y}`))]},s.key))})});function qe({width:h,height:a,data:o,resolvedSeries:s,x:u,y:H,grid:x,size:F,curve:k,forecastFrom:D,forecastLabel:P,markers:L,connectNulls:S,referenceLines:ue,annotations:R,annotationsLabel:ce,overlay:de,maxPoints:w,brush:Y,onBrush:q,brushLabel:me,syncEnabled:fe,margin:J,tooltip:A,onPointClick:M,plotLabel:ge,formatValue:V,formatX:W}){let[K,X]=(0,l.useState)(null),c=K!==null&&K<o.length?K:null,[ye,pe]=(0,l.useState)(null),Ce=(0,Ee.useChartSync)(),m=fe?Ce:null,e=(0,l.useMemo)(()=>{let t=s.filter(f=>!f.hidden),r=(0,v.buildCartesianGeometry)({width:h,height:a,data:o,x:u,y:H,bounds:(0,He.extent)((0,j.collectAllValues)(o,t.map(f=>f.key))),margin:J,placement:"point",formatValue:V,formatX:W,extraTop:P?je:0}),d=r.categoryCenters,y=r.valueScale,te=D===void 0?-1:r.xValues.findIndex(f=>(0,T.toKey)(f)===(0,T.toKey)(D)),Ne=t.map(f=>{let z=o.map((ae,Ke)=>{let ve=(0,j.readNumber)(ae,f.key);return{x:d[Ke],y:ve===null?Number.NaN:y(ve),defined:ve!==null}}),Se={connectNulls:S},ne=te>=0,ke=ae=>w&&w>0?(0,le.decimatePath)(ae,w):ae,re=ke(ne?z.slice(0,te+1):z),oe=f.dashed?ke(z):ne?ke(z.slice(te)):[];w||(0,le.warnPointBudget)("LineChart",z.length);let Me=f.dashed?oe:ne?[...re,...oe.slice(1)]:re;return{key:f.key,color:f.color,solid:f.dashed?"":(0,B.buildLinePath)(re,k,Se),dashed:f.dashed||ne?(0,B.buildLinePath)(oe,k,Se):"",markers:[...re,...f.dashed?[]:oe].filter(B.isDrawable),isolated:(0,B.isolatedPoints)(Me,S)}}),De=o.length>1?r.innerWidth/(o.length-1):0;return{visible:t,locate:(0,v.createCategoryLocator)(r),plot:(0,v.createPlotContext)({geometry:r,width:h,height:a,data:o,series:t,formatValue:V,formatX:W}),xValues:r.xValues,xPositions:d,xTicks:r.categoryTicks,yTicks:r.valueTicks,yScale:y,innerWidth:r.innerWidth,innerHeight:r.innerHeight,margin:r.margin,lines:Ne,forecastIndex:te,showMarkers:L==="always"||L==="auto"&&De>=Ue&&o.length>1}},[o,s,u,H,h,a,J,k,S,D,P,L,w,V,W]),p=(0,l.useCallback)(t=>e.visible.map(r=>{let d=(0,j.readNumber)(o[t],r.key);return{seriesKey:r.key,seriesLabel:(0,E.getSeriesLabel)(r),color:r.color,value:d,formattedValue:d===null?"\u2014":V(d),datum:o[t]}}),[o,e.visible,V]),Q=m?m.brush:ye,be=(0,l.useCallback)(t=>{pe(t),m?.setBrush(t),q?.(t)},[m,q]),g=(0,se.useChartBrush)({enabled:Y,active:Q!==null,centers:e.xPositions,xValues:e.xValues,offset:e.margin.left,orientation:"vertical",onCommit:be}),Z=(0,l.useCallback)(t=>{if(g.onPointerMove(t),A===!1||o.length===0)return;let r=t.currentTarget.getBoundingClientRect(),d=t.clientX-r.left-e.margin.left,y=(0,T.nearestIndex)(e.xPositions,d);X(y>=0?y:null),m?.setHovered(y>=0?e.xValues[y]:null)},[g,A,o.length,e.margin.left,e.xPositions,e.xValues,m]),$=(0,l.useCallback)(()=>{X(null),m?.setHovered(null)},[m]),xe=(0,l.useCallback)(t=>{if(o.length===0)return;g.onKeyDown(t,c);let r=o.length-1,d=c??0,y=t.key==="ArrowRight"?Math.min(r,d+1):t.key==="ArrowLeft"?Math.max(0,d-1):t.key==="Home"?0:t.key==="End"?r:t.key==="Escape"?null:void 0;y!==void 0&&(t.preventDefault(),X(y),m?.setHovered(y===null?null:e.xValues[y]))},[o.length,c,g,m,e.xValues]),I=(0,l.useCallback)(()=>{if(g.consumedClick()||!M||c===null)return;let[t]=p(c);t&&M({...t,index:c,x:e.xValues[c]})},[g,M,c,p,e.xValues]),ee=c!==null||!m?.hovered?null:(()=>{let t=(0,T.toKey)(m.hovered),r=e.xValues.findIndex(d=>(0,T.toKey)(d)===t);return r<0?null:r})(),C=c??ee,G=C===null?null:p(C),O=(G??[]).filter(t=>t.value!==null),N=g.dragging??Q,_=(()=>{if(!N)return null;let t=e.locate(N.from),r=e.locate(N.to);return t===null||r===null?null:{from:t,to:r}})(),i=(0,v.splitOverlay)(de),b=c===null||G===null?null:{x:e.xValues[c],xLabel:W(e.xValues[c],c),index:c,points:G};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("svg",{width:h,height:a,role:"img","aria-label":ge??[e.visible.map(t=>(0,E.getSeriesLabel)(t)).join(", "),(0,U.describeAnnotations)(R,ce)].filter(Boolean).join(". "),tabIndex:0,className:(0,Re.cn)(Ie.CHART_TOUCH,"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",Y&&"select-none"),onPointerDown:g.onPointerDown,onPointerMove:Z,onPointerUp:g.onPointerUp,onPointerCancel:g.onPointerUp,onPointerLeave:$,onKeyDown:xe,onBlur:$,onClick:I,children:[(0,n.jsxs)("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[(0,n.jsx)(Ve.ChartGrid,{width:e.innerWidth,height:e.innerHeight,horizontal:x==="y"||x==="both"?e.yTicks.map(t=>t.offset):void 0,vertical:x==="x"||x==="both"?e.xTicks.map(t=>t.offset):void 0}),R?(0,n.jsx)(U.ChartAnnotationLayer,{layer:"under",annotations:R,xAt:e.locate,yAt:e.yScale,width:e.innerWidth,height:e.innerHeight}):null,_?(0,n.jsx)(se.ChartBrushLayer,{from:_.from,to:_.to,width:e.innerWidth,height:e.innerHeight,live:g.dragging!==null,label:me}):null,i.under?.(e.plot),ue?.map(t=>{let r=e.yScale(t.value),d=r<Fe?r+12:r-4;return(0,n.jsxs)("g",{children:[(0,n.jsx)("line",{x1:0,y1:r,x2:e.innerWidth,y2:r,stroke:t.color??"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:t.dashed===!1?void 0:"4 4"}),t.label?(0,n.jsx)("text",{x:e.innerWidth,y:d,textAnchor:"end",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:t.label}):null]},`${t.value}-${t.label??""}`)}),e.forecastIndex>=0?(0,n.jsxs)("g",{children:[(0,n.jsx)("line",{x1:e.xPositions[e.forecastIndex],y1:0,x2:e.xPositions[e.forecastIndex],y2:e.innerHeight,className:"stroke-gray-300 dark:stroke-gray-600",strokeWidth:1,strokeDasharray:"3 3"}),P?(0,n.jsx)("text",{x:e.xPositions[e.forecastIndex]+4,y:-2,className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:P}):null]}):null,(0,n.jsx)(Ye,{lines:e.lines,showMarkers:e.showMarkers}),R?(0,n.jsx)(U.ChartAnnotationLayer,{annotations:R,xAt:e.locate,yAt:e.yScale,width:e.innerWidth,height:e.innerHeight}):null,i.over?.(e.plot),C!==null?(0,n.jsxs)("g",{"aria-hidden":"true",children:[(0,n.jsx)("line",{x1:e.xPositions[C],y1:0,x2:e.xPositions[C],y2:e.innerHeight,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:1,strokeDasharray:c===null?"3 3":void 0}),O.map(t=>(0,n.jsx)("circle",{cx:e.xPositions[C],cy:e.yScale(t.value),r:4,fill:t.color,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},t.seriesKey))]}):null]}),(0,n.jsx)("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:u.hidden?null:(0,n.jsx)(Le.ChartAxis,{orientation:"bottom",ticks:e.xTicks,length:e.innerWidth,label:u.label,size:F})}),(0,n.jsx)("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:H?.hidden?null:(0,n.jsx)(Le.ChartAxis,{orientation:"left",ticks:e.yTicks,length:e.innerHeight,showLine:!1,label:H?.label,size:F})})]}),b&&A!==!1?(0,n.jsx)(ie.ChartTooltip,{x:e.margin.left+e.xPositions[b.index],y:e.margin.top+(O.length>0?Math.min(...O.map(t=>e.yScale(t.value))):e.innerHeight/2),containerWidth:h,children:typeof A=="function"?A(b):(0,n.jsx)(ie.ChartTooltipContent,{title:b.xLabel,points:b.points})}):null]})}function Je({data:h,series:a,x:o,y:s,height:u=240,width:H,size:x="md",grid:F="y",legend:k,tooltip:D=!0,tableView:P=!1,emphasis:L,title:S,description:ue,loading:R=!1,emptyState:ce,error:de=!1,errorState:w,onRetry:Y,actions:q,onPointClick:me,curve:fe="monotone",forecastFrom:J,forecastLabel:A,markers:M="auto",connectNulls:ge=!1,referenceLines:V,annotations:W,overlay:K,legendToggle:X=!0,maxPoints:c,brush:ye=!1,onBrush:pe,brushLabel:Ce,sync:m=!0,margin:e,locale:p,plotLabel:Q,className:be,...g}){let Z=(0,we.useUILabels)(),[$,xe]=(0,l.useState)(()=>new Set),I=(0,l.useMemo)(()=>a.map((i,b)=>({...i,hidden:i.hidden||$.has(i.key),color:(0,E.resolveSeriesColor)(i,b,L)})),[a,$,L]),ee=(0,l.useMemo)(()=>s?.format??(i=>(0,he.formatAuto)(i,p)),[s?.format,p]),C=(0,l.useMemo)(()=>o.format??(i=>o.scale==="time"?(0,We.formatTimeValue)(i,p):(0,he.formatXValue)(i,p)),[o.format,o.scale,p]),G=(0,l.useCallback)(i=>{xe(b=>{let t=new Set(b);return t.has(i)?t.delete(i):t.add(i),t})},[]),O=k===void 0?a.length>=2:k!==!1,N=typeof k=="string"?k:"bottom",_=I.filter(i=>!i.hidden).length;return(0,n.jsx)(Ae.ChartContainer,{title:S,description:ue,height:u,width:H,size:x,loading:R,empty:h.length===0||_===0,emptyState:ce,error:de,errorState:w,onRetry:Y,actions:q,tableView:P,legendPosition:N,legend:O?(0,n.jsx)(Te.ChartLegend,{items:(0,E.toLegendItems)(I,L),position:N,marker:"line",size:x,onToggle:X?G:void 0}):void 0,table:P?(0,n.jsx)(Be.ChartTableView,{data:h,series:I,xKey:o.key,xLabel:o.label??o.key,formatX:C,formatValue:ee,caption:typeof S=="string"?S:void 0}):void 0,className:be,...g,children:({width:i})=>(0,n.jsx)(qe,{width:i,height:u,data:h,resolvedSeries:I,x:o,y:s,grid:F,size:x,curve:fe,forecastFrom:J,forecastLabel:A,markers:M,connectNulls:ge,referenceLines:V,annotations:W,annotationsLabel:Z.chartAnnotations,overlay:K,maxPoints:c,brush:ye,onBrush:pe,brushLabel:Ce??Z.chartBrush,syncEnabled:m,margin:e,tooltip:D,onPointClick:me,plotLabel:Q,formatValue:ee,formatX:C})})}0&&(module.exports={LineChart});
1
+ "use strict";"use client";var Se=Object.defineProperty;var Ge=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var _e=Object.prototype.hasOwnProperty;var ze=(u,s)=>{for(var r in s)Se(u,r,{get:s[r],enumerable:!0})},Ue=(u,s,r,i)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of Oe(s))!_e.call(u,c)&&c!==r&&Se(u,c,{get:()=>s[c],enumerable:!(i=Ge(s,c))||i.enumerable});return u};var je=u=>Ue(Se({},"__esModule",{value:!0}),u);var et={};ze(et,{LineChart:()=>Ze});module.exports=je(et);var l=require("react"),Ve=require("../../lib/cn.cjs"),Ae=require("../../lib/i18n.cjs"),j=require("../chart/ChartAnnotations.cjs"),Re=require("../chart/ChartAxis.cjs"),le=require("../chart/ChartBrush.cjs"),Te=require("../chart/ChartContainer.cjs"),Be=require("../chart/ChartGrid.cjs"),Ee=require("../chart/ChartLegend.cjs"),He=require("../chart/ChartSync.cjs"),We=require("../chart/ChartTableView.cjs"),he=require("../chart/ChartTooltip.cjs"),E=require("../chart/palette.cjs"),k=require("../chart/utils/cartesian.cjs"),F=require("../chart/utils/data.cjs"),ue=require("../chart/utils/decimate.cjs"),ce=require("../chart/utils/format.cjs"),de=require("../chart/utils/keyboard.cjs"),H=require("../chart/utils/path.cjs"),B=require("../chart/utils/scales.cjs"),Ie=require("../chart/utils/ticks.cjs"),Ne=require("../chart/utils/timestamp.cjs"),De=require("../chart/utils/touch.cjs"),n=require("react/jsx-runtime"),Fe=24,Ye=10,qe=10,Je=(0,l.memo)(function({lines:s,showMarkers:r}){return(0,n.jsx)("g",{children:s.map(i=>(0,n.jsxs)("g",{children:[i.solid?(0,n.jsx)("path",{d:i.solid,fill:"none",stroke:i.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}):null,i.dashed?(0,n.jsx)("path",{d:i.dashed,fill:"none",stroke:i.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:"5 4"}):null,(r?i.markers:i.isolated).map(c=>(0,n.jsx)("circle",{cx:c.x,cy:c.y,r:3,fill:i.color,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},`${c.x}-${c.y}`))]},i.key))})});function Qe({width:u,height:s,data:r,resolvedSeries:i,x:c,y:W,grid:C,size:Y,curve:b,forecastFrom:X,forecastLabel:v,markers:P,connectNulls:L,referenceLines:me,annotations:S,annotationsLabel:fe,overlay:ge,maxPoints:R,brush:q,onBrush:J,brushLabel:pe,syncEnabled:ye,margin:Q,tooltip:w,onPointClick:V,plotLabel:Ce,formatValue:A,formatX:I}){let[$,G]=(0,l.useState)(null),h=$!==null&&$<r.length?$:null,[be,xe]=(0,l.useState)(null),ke=(0,He.useChartSync)(),m=ye?ke:null,e=(0,l.useMemo)(()=>{let t=i.filter(f=>!f.hidden),o=(0,k.buildCartesianGeometry)({width:u,height:s,data:r,x:c,y:W,bounds:(0,Ie.extent)((0,F.collectAllValues)(r,t.map(f=>f.key))),margin:Q,placement:"point",formatValue:A,formatX:I,extraTop:v?Ye:0}),d=o.categoryCenters,T=o.valueScale,re=X===void 0?-1:o.xValues.findIndex(f=>(0,B.toKey)(f)===(0,B.toKey)(X)),Ke=t.map(f=>{let U=r.map((ie,$e)=>{let Le=(0,F.readNumber)(ie,f.key);return{x:d[$e],y:Le===null?Number.NaN:T(Le),defined:Le!==null}}),we={connectNulls:L},oe=re>=0,Pe=ie=>R&&R>0?(0,ue.decimatePath)(ie,R):ie,ae=Pe(oe?U.slice(0,re+1):U),se=f.dashed?Pe(U):oe?Pe(U.slice(re)):[];R||(0,ue.warnPointBudget)("LineChart",U.length);let Xe=f.dashed?se:oe?[...ae,...se.slice(1)]:ae;return{key:f.key,color:f.color,solid:f.dashed?"":(0,H.buildLinePath)(ae,b,we),dashed:f.dashed||oe?(0,H.buildLinePath)(se,b,we):"",markers:[...ae,...f.dashed?[]:se].filter(H.isDrawable),isolated:(0,H.isolatedPoints)(Xe,L)}}),Me=r.length>1?o.innerWidth/(r.length-1):0;return{visible:t,locate:(0,k.createCategoryLocator)(o),plot:(0,k.createPlotContext)({geometry:o,width:u,height:s,data:r,series:t,formatValue:A,formatX:I}),xValues:o.xValues,xPositions:d,xTicks:o.categoryTicks,yTicks:o.valueTicks,yScale:T,innerWidth:o.innerWidth,innerHeight:o.innerHeight,margin:o.margin,lines:Ke,forecastIndex:re,showMarkers:P==="always"||P==="auto"&&Me>=Fe&&r.length>1}},[r,i,c,W,u,s,Q,b,L,X,v,P,R,A,I]),y=(0,l.useCallback)(t=>e.visible.map(o=>{let d=(0,F.readNumber)(r[t],o.key);return{seriesKey:o.key,seriesLabel:(0,E.getSeriesLabel)(o),color:o.color,value:d,formattedValue:d===null?"\u2014":A(d),datum:r[t]}}),[r,e.visible,A]),Z=m?m.brush:be,ve=(0,l.useCallback)(t=>{xe(t),m?.setBrush(t),J?.(t)},[m,J]),g=(0,le.useChartBrush)({enabled:q,active:Z!==null,centers:e.xPositions,xValues:e.xValues,offset:e.margin.left,orientation:"vertical",onCommit:ve}),ee=(0,l.useCallback)(t=>{if(g.onPointerMove(t),w===!1||r.length===0)return;let o=t.currentTarget.getBoundingClientRect(),d=t.clientX-o.left-e.margin.left,T=(0,B.nearestIndex)(e.xPositions,d);G(T>=0?T:null),m?.setHovered(T>=0?e.xValues[T]:null)},[g,w,r.length,e.margin.left,e.xPositions,e.xValues,m]),O=(0,l.useCallback)(()=>{G(null),m?.setHovered(null)},[m]),N=(0,l.useCallback)(()=>{if(!V||h===null)return;let[t]=y(h);t&&V({...t,index:h,x:e.xValues[h]})},[V,h,y,e.xValues]),D=(0,l.useCallback)(t=>{if(r.length===0)return;let o=V&&h!==null&&e.visible.length>0;if((0,de.pressChartMark)(t,o?N:null))return;g.onKeyDown(t,h);let d=(0,de.chartCursorTarget)(t.key,h,r.length,"x");d!==void 0&&(t.preventDefault(),G(d),m?.setHovered(d===null?null:e.xValues[d]))},[r.length,h,g,m,e.xValues,e.visible.length,V,N]),te=(0,l.useCallback)(()=>{g.consumedClick()||N()},[g,N]),ne=h!==null||!m?.hovered?null:(()=>{let t=(0,B.toKey)(m.hovered),o=e.xValues.findIndex(d=>(0,B.toKey)(d)===t);return o<0?null:o})(),x=h??ne,_=x===null?null:y(x),K=(_??[]).filter(t=>t.value!==null),z=g.dragging??Z,a=(()=>{if(!z)return null;let t=e.locate(z.from),o=e.locate(z.to);return t===null||o===null?null:{from:t,to:o}})(),M=(0,k.splitOverlay)(ge),p=h===null||_===null?null:{x:e.xValues[h],xLabel:I(e.xValues[h],h),index:h,points:_};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("svg",{width:u,height:s,role:"img","aria-label":Ce??[e.visible.map(t=>(0,E.getSeriesLabel)(t)).join(", "),(0,j.describeAnnotations)(S,fe)].filter(Boolean).join(". "),tabIndex:0,className:(0,Ve.cn)(De.CHART_TOUCH,"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",q&&"select-none"),onPointerDown:g.onPointerDown,onPointerMove:ee,onPointerUp:g.onPointerUp,onPointerCancel:g.onPointerUp,onPointerLeave:O,onKeyDown:D,onBlur:O,onClick:te,children:[(0,n.jsxs)("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[(0,n.jsx)(Be.ChartGrid,{width:e.innerWidth,height:e.innerHeight,horizontal:C==="y"||C==="both"?e.yTicks.map(t=>t.offset):void 0,vertical:C==="x"||C==="both"?e.xTicks.map(t=>t.offset):void 0}),S?(0,n.jsx)(j.ChartAnnotationLayer,{layer:"under",annotations:S,xAt:e.locate,yAt:e.yScale,width:e.innerWidth,height:e.innerHeight}):null,a?(0,n.jsx)(le.ChartBrushLayer,{from:a.from,to:a.to,width:e.innerWidth,height:e.innerHeight,live:g.dragging!==null,label:pe}):null,M.under?.(e.plot),me?.map(t=>{let o=e.yScale(t.value),d=o<qe?o+12:o-4;return(0,n.jsxs)("g",{children:[(0,n.jsx)("line",{x1:0,y1:o,x2:e.innerWidth,y2:o,stroke:t.color??"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:t.dashed===!1?void 0:"4 4"}),t.label?(0,n.jsx)("text",{x:e.innerWidth,y:d,textAnchor:"end",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:t.label}):null]},`${t.value}-${t.label??""}`)}),e.forecastIndex>=0?(0,n.jsxs)("g",{children:[(0,n.jsx)("line",{x1:e.xPositions[e.forecastIndex],y1:0,x2:e.xPositions[e.forecastIndex],y2:e.innerHeight,className:"stroke-gray-300 dark:stroke-gray-600",strokeWidth:1,strokeDasharray:"3 3"}),v?(0,n.jsx)("text",{x:e.xPositions[e.forecastIndex]+4,y:-2,className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:v}):null]}):null,(0,n.jsx)(Je,{lines:e.lines,showMarkers:e.showMarkers}),S?(0,n.jsx)(j.ChartAnnotationLayer,{annotations:S,xAt:e.locate,yAt:e.yScale,width:e.innerWidth,height:e.innerHeight}):null,M.over?.(e.plot),x!==null?(0,n.jsxs)("g",{"aria-hidden":"true",children:[(0,n.jsx)("line",{x1:e.xPositions[x],y1:0,x2:e.xPositions[x],y2:e.innerHeight,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:1,strokeDasharray:h===null?"3 3":void 0}),K.map(t=>(0,n.jsx)("circle",{cx:e.xPositions[x],cy:e.yScale(t.value),r:4,fill:t.color,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},t.seriesKey))]}):null]}),(0,n.jsx)("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:c.hidden?null:(0,n.jsx)(Re.ChartAxis,{orientation:"bottom",ticks:e.xTicks,length:e.innerWidth,label:c.label,size:Y})}),(0,n.jsx)("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:W?.hidden?null:(0,n.jsx)(Re.ChartAxis,{orientation:"left",ticks:e.yTicks,length:e.innerHeight,showLine:!1,label:W?.label,size:Y})})]}),p&&w!==!1?(0,n.jsx)(he.ChartTooltip,{x:e.margin.left+e.xPositions[p.index],y:e.margin.top+(K.length>0?Math.min(...K.map(t=>e.yScale(t.value))):e.innerHeight/2),containerWidth:u,children:typeof w=="function"?w(p):(0,n.jsx)(he.ChartTooltipContent,{title:p.xLabel,points:p.points})}):null]})}function Ze({data:u,series:s,x:r,y:i,height:c=240,width:W,size:C="md",grid:Y="y",legend:b,tooltip:X=!0,tableView:v=!1,emphasis:P,title:L,description:me,loading:S=!1,emptyState:fe,error:ge=!1,errorState:R,onRetry:q,actions:J,onPointClick:pe,curve:ye="monotone",forecastFrom:Q,forecastLabel:w,markers:V="auto",connectNulls:Ce=!1,referenceLines:A,annotations:I,overlay:$,legendToggle:G=!0,maxPoints:h,brush:be=!1,onBrush:xe,brushLabel:ke,sync:m=!0,margin:e,locale:y,plotLabel:Z,className:ve,...g}){let ee=(0,Ae.useUILabels)(),[O,N]=(0,l.useState)(()=>new Set),D=(0,l.useMemo)(()=>s.map((a,M)=>({...a,hidden:a.hidden||O.has(a.key),color:(0,E.resolveSeriesColor)(a,M,P)})),[s,O,P]),te=(0,l.useMemo)(()=>i?.format??(a=>(0,ce.formatAuto)(a,y)),[i?.format,y]),ne=(0,l.useMemo)(()=>r.format??(a=>r.scale==="time"?(0,Ne.formatTimeValue)(a,y):(0,ce.formatXValue)(a,y)),[r.format,r.scale,y]),x=(0,l.useCallback)(a=>{N(M=>{let p=new Set(M);return p.has(a)?p.delete(a):p.add(a),p})},[]),_=b===void 0?s.length>=2:b!==!1,K=typeof b=="string"?b:"bottom",z=D.filter(a=>!a.hidden).length;return(0,n.jsx)(Te.ChartContainer,{title:L,description:me,height:c,width:W,size:C,loading:S,empty:u.length===0||z===0,emptyState:fe,error:ge,errorState:R,onRetry:q,actions:J,tableView:v,legendPosition:K,legend:_?(0,n.jsx)(Ee.ChartLegend,{items:(0,E.toLegendItems)(D,P),position:K,marker:"line",size:C,onToggle:G?x:void 0}):void 0,table:v?(0,n.jsx)(We.ChartTableView,{data:u,series:D,xKey:r.key,xLabel:r.label??r.key,formatX:ne,formatValue:te,caption:typeof L=="string"?L:void 0}):void 0,className:ve,...g,children:({width:a})=>(0,n.jsx)(Qe,{width:a,height:c,data:u,resolvedSeries:D,x:r,y:i,grid:Y,size:C,curve:ye,forecastFrom:Q,forecastLabel:w,markers:V,connectNulls:Ce,referenceLines:A,annotations:I,annotationsLabel:ee.chartAnnotations,overlay:$,maxPoints:h,brush:be,onBrush:xe,brushLabel:ke??ee.chartBrush,syncEnabled:m,margin:e,tooltip:X,onPointClick:pe,plotLabel:Z,formatValue:te,formatX:ne})})}0&&(module.exports={LineChart});
@@ -1 +1 @@
1
- "use client";import{memo as we,useCallback as A,useMemo as ne,useState as ye}from"react";import{cn as Ae}from"../../lib/cn.js";import{useUILabels as Ve}from"../../lib/i18n.js";import{ChartAnnotationLayer as Ce,describeAnnotations as Te}from"../chart/ChartAnnotations.js";import{ChartAxis as be}from"../chart/ChartAxis.js";import{ChartBrushLayer as Ee,useChartBrush as Be}from"../chart/ChartBrush.js";import{ChartContainer as He}from"../chart/ChartContainer.js";import{ChartGrid as We}from"../chart/ChartGrid.js";import{ChartLegend as Ie}from"../chart/ChartLegend.js";import{useChartSync as Ne}from"../chart/ChartSync.js";import{ChartTableView as De}from"../chart/ChartTableView.js";import{ChartTooltip as Me,ChartTooltipContent as Ke}from"../chart/ChartTooltip.js";import{getSeriesLabel as xe,resolveSeriesColor as Xe,toLegendItems as $e}from"../chart/palette.js";import{buildCartesianGeometry as Ge,createCategoryLocator as Oe,createPlotContext as _e,splitOverlay as ze}from"../chart/utils/cartesian.js";import{collectAllValues as Ue,readNumber as ke}from"../chart/utils/data.js";import{decimatePath as je,warnPointBudget as Fe}from"../chart/utils/decimate.js";import{formatAuto as Ye,formatXValue as qe}from"../chart/utils/format.js";import{buildLinePath as ve,isDrawable as Je,isolatedPoints as Qe}from"../chart/utils/path.js";import{nearestIndex as Ze,toKey as te}from"../chart/utils/scales.js";import{extent as et}from"../chart/utils/ticks.js";import{formatTimeValue as tt}from"../chart/utils/timestamp.js";import{CHART_TOUCH as nt}from"../chart/utils/touch.js";import{Fragment as lt,jsx as o,jsxs as V}from"react/jsx-runtime";var rt=24,ot=10,at=10,st=we(function({lines:g,showMarkers:r}){return o("g",{children:g.map(i=>V("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 it({width:f,height:g,data:r,resolvedSeries:i,x:d,y:T,grid:b,size:O,curve:x,forecastFrom:W,forecastLabel:k,markers:v,connectNulls:P,referenceLines:re,annotations:L,annotationsLabel:oe,overlay:ae,maxPoints:S,brush:_,onBrush:z,brushLabel:se,syncEnabled:ie,margin:U,tooltip:R,onPointClick:I,plotLabel:le,formatValue:w,formatX:E}){let[N,D]=ye(null),s=N!==null&&N<r.length?N:null,[he,ue]=ye(null),ce=Ne(),h=ie?ce:null,e=ne(()=>{let t=i.filter(u=>!u.hidden),n=Ge({width:f,height:g,data:r,x:d,y:T,bounds:et(Ue(r,t.map(u=>u.key))),margin:U,placement:"point",formatValue:w,formatX:E,extraTop:k?ot:0}),l=n.categoryCenters,m=n.valueScale,q=W===void 0?-1:n.xValues.findIndex(u=>te(u)===te(W)),Pe=t.map(u=>{let G=r.map((ee,Re)=>{let ge=ke(ee,u.key);return{x:l[Re],y:ge===null?Number.NaN:m(ge),defined:ge!==null}}),pe={connectNulls:P},J=q>=0,fe=ee=>S&&S>0?je(ee,S):ee,Q=fe(J?G.slice(0,q+1):G),Z=u.dashed?fe(G):J?fe(G.slice(q)):[];S||Fe("LineChart",G.length);let Se=u.dashed?Z:J?[...Q,...Z.slice(1)]:Q;return{key:u.key,color:u.color,solid:u.dashed?"":ve(Q,x,pe),dashed:u.dashed||J?ve(Z,x,pe):"",markers:[...Q,...u.dashed?[]:Z].filter(Je),isolated:Qe(Se,P)}}),Le=r.length>1?n.innerWidth/(r.length-1):0;return{visible:t,locate:Oe(n),plot:_e({geometry:n,width:f,height:g,data:r,series:t,formatValue:w,formatX:E}),xValues:n.xValues,xPositions:l,xTicks:n.categoryTicks,yTicks:n.valueTicks,yScale:m,innerWidth:n.innerWidth,innerHeight:n.innerHeight,margin:n.margin,lines:Pe,forecastIndex:q,showMarkers:v==="always"||v==="auto"&&Le>=rt&&r.length>1}},[r,i,d,T,f,g,U,x,P,W,k,v,S,w,E]),y=A(t=>e.visible.map(n=>{let l=ke(r[t],n.key);return{seriesKey:n.key,seriesLabel:xe(n),color:n.color,value:l,formattedValue:l===null?"\u2014":w(l),datum:r[t]}}),[r,e.visible,w]),j=h?h.brush:he,de=A(t=>{ue(t),h?.setBrush(t),z?.(t)},[h,z]),c=Be({enabled:_,active:j!==null,centers:e.xPositions,xValues:e.xValues,offset:e.margin.left,orientation:"vertical",onCommit:de}),F=A(t=>{if(c.onPointerMove(t),R===!1||r.length===0)return;let n=t.currentTarget.getBoundingClientRect(),l=t.clientX-n.left-e.margin.left,m=Ze(e.xPositions,l);D(m>=0?m:null),h?.setHovered(m>=0?e.xValues[m]:null)},[c,R,r.length,e.margin.left,e.xPositions,e.xValues,h]),M=A(()=>{D(null),h?.setHovered(null)},[h]),me=A(t=>{if(r.length===0)return;c.onKeyDown(t,s);let n=r.length-1,l=s??0,m=t.key==="ArrowRight"?Math.min(n,l+1):t.key==="ArrowLeft"?Math.max(0,l-1):t.key==="Home"?0:t.key==="End"?n:t.key==="Escape"?null:void 0;m!==void 0&&(t.preventDefault(),D(m),h?.setHovered(m===null?null:e.xValues[m]))},[r.length,s,c,h,e.xValues]),B=A(()=>{if(c.consumedClick()||!I||s===null)return;let[t]=y(s);t&&I({...t,index:s,x:e.xValues[s]})},[c,I,s,y,e.xValues]),Y=s!==null||!h?.hovered?null:(()=>{let t=te(h.hovered),n=e.xValues.findIndex(l=>te(l)===t);return n<0?null:n})(),p=s??Y,K=p===null?null:y(p),X=(K??[]).filter(t=>t.value!==null),H=c.dragging??j,$=(()=>{if(!H)return null;let t=e.locate(H.from),n=e.locate(H.to);return t===null||n===null?null:{from:t,to:n}})(),a=ze(ae),C=s===null||K===null?null:{x:e.xValues[s],xLabel:E(e.xValues[s],s),index:s,points:K};return V(lt,{children:[V("svg",{width:f,height:g,role:"img","aria-label":le??[e.visible.map(t=>xe(t)).join(", "),Te(L,oe)].filter(Boolean).join(". "),tabIndex:0,className:Ae(nt,"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",_&&"select-none"),onPointerDown:c.onPointerDown,onPointerMove:F,onPointerUp:c.onPointerUp,onPointerCancel:c.onPointerUp,onPointerLeave:M,onKeyDown:me,onBlur:M,onClick:B,children:[V("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[o(We,{width:e.innerWidth,height:e.innerHeight,horizontal:b==="y"||b==="both"?e.yTicks.map(t=>t.offset):void 0,vertical:b==="x"||b==="both"?e.xTicks.map(t=>t.offset):void 0}),L?o(Ce,{layer:"under",annotations:L,xAt:e.locate,yAt:e.yScale,width:e.innerWidth,height:e.innerHeight}):null,$?o(Ee,{from:$.from,to:$.to,width:e.innerWidth,height:e.innerHeight,live:c.dragging!==null,label:se}):null,a.under?.(e.plot),re?.map(t=>{let n=e.yScale(t.value),l=n<at?n+12:n-4;return V("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?V("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(st,{lines:e.lines,showMarkers:e.showMarkers}),L?o(Ce,{annotations:L,xAt:e.locate,yAt:e.yScale,width:e.innerWidth,height:e.innerHeight}):null,a.over?.(e.plot),p!==null?V("g",{"aria-hidden":"true",children:[o("line",{x1:e.xPositions[p],y1:0,x2:e.xPositions[p],y2:e.innerHeight,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:1,strokeDasharray:s===null?"3 3":void 0}),X.map(t=>o("circle",{cx:e.xPositions[p],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(be,{orientation:"bottom",ticks:e.xTicks,length:e.innerWidth,label:d.label,size:O})}),o("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:T?.hidden?null:o(be,{orientation:"left",ticks:e.yTicks,length:e.innerHeight,showLine:!1,label:T?.label,size:O})})]}),C&&R!==!1?o(Me,{x:e.margin.left+e.xPositions[C.index],y:e.margin.top+(X.length>0?Math.min(...X.map(t=>e.yScale(t.value))):e.innerHeight/2),containerWidth:f,children:typeof R=="function"?R(C):o(Ke,{title:C.xLabel,points:C.points})}):null]})}function Et({data:f,series:g,x:r,y:i,height:d=240,width:T,size:b="md",grid:O="y",legend:x,tooltip:W=!0,tableView:k=!1,emphasis:v,title:P,description:re,loading:L=!1,emptyState:oe,error:ae=!1,errorState:S,onRetry:_,actions:z,onPointClick:se,curve:ie="monotone",forecastFrom:U,forecastLabel:R,markers:I="auto",connectNulls:le=!1,referenceLines:w,annotations:E,overlay:N,legendToggle:D=!0,maxPoints:s,brush:he=!1,onBrush:ue,brushLabel:ce,sync:h=!0,margin:e,locale:y,plotLabel:j,className:de,...c}){let F=Ve(),[M,me]=ye(()=>new Set),B=ne(()=>g.map((a,C)=>({...a,hidden:a.hidden||M.has(a.key),color:Xe(a,C,v)})),[g,M,v]),Y=ne(()=>i?.format??(a=>Ye(a,y)),[i?.format,y]),p=ne(()=>r.format??(a=>r.scale==="time"?tt(a,y):qe(a,y)),[r.format,r.scale,y]),K=A(a=>{me(C=>{let t=new Set(C);return t.has(a)?t.delete(a):t.add(a),t})},[]),X=x===void 0?g.length>=2:x!==!1,H=typeof x=="string"?x:"bottom",$=B.filter(a=>!a.hidden).length;return o(He,{title:P,description:re,height:d,width:T,size:b,loading:L,empty:f.length===0||$===0,emptyState:oe,error:ae,errorState:S,onRetry:_,actions:z,tableView:k,legendPosition:H,legend:X?o(Ie,{items:$e(B,v),position:H,marker:"line",size:b,onToggle:D?K:void 0}):void 0,table:k?o(De,{data:f,series:B,xKey:r.key,xLabel:r.label??r.key,formatX:p,formatValue:Y,caption:typeof P=="string"?P:void 0}):void 0,className:de,...c,children:({width:a})=>o(it,{width:a,height:d,data:f,resolvedSeries:B,x:r,y:i,grid:O,size:b,curve:ie,forecastFrom:U,forecastLabel:R,markers:I,connectNulls:le,referenceLines:w,annotations:E,annotationsLabel:F.chartAnnotations,overlay:N,maxPoints:s,brush:he,onBrush:ue,brushLabel:ce??F.chartBrush,syncEnabled:h,margin:e,tooltip:W,onPointClick:se,plotLabel:j,formatValue:Y,formatX:p})})}export{Et 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-blue-500",z&&"select-none"),onPointerDown:c.onPointerDown,onPointerMove:Y,onPointerUp:c.onPointerUp,onPointerCancel:c.onPointerUp,onPointerLeave:X,onKeyDown:W,onBlur:X,onClick:q,children:[T("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[o(Ie,{width:e.innerWidth,height:e.innerHeight,horizontal:y==="y"||y==="both"?e.yTicks.map(t=>t.offset):void 0,vertical:y==="x"||y==="both"?e.xTicks.map(t=>t.offset):void 0}),L?o(be,{layer:"under",annotations:L,xAt:e.locate,yAt:e.yScale,width:e.innerWidth,height:e.innerHeight}):null,a?o(Ee,{from:a.from,to:a.to,width:e.innerWidth,height:e.innerHeight,live:c.dragging!==null,label:le}):null,N.under?.(e.plot),ae?.map(t=>{let n=e.yScale(t.value),l=n<lt?n+12:n-4;return T("g",{children:[o("line",{x1:0,y1:n,x2:e.innerWidth,y2:n,stroke:t.color??"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:t.dashed===!1?void 0:"4 4"}),t.label?o("text",{x:e.innerWidth,y:l,textAnchor:"end",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:t.label}):null]},`${t.value}-${t.label??""}`)}),e.forecastIndex>=0?T("g",{children:[o("line",{x1:e.xPositions[e.forecastIndex],y1:0,x2:e.xPositions[e.forecastIndex],y2:e.innerHeight,className:"stroke-gray-300 dark:stroke-gray-600",strokeWidth:1,strokeDasharray:"3 3"}),k?o("text",{x:e.xPositions[e.forecastIndex]+4,y:-2,className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:k}):null]}):null,o(ht,{lines:e.lines,showMarkers:e.showMarkers}),L?o(be,{annotations:L,xAt:e.locate,yAt:e.yScale,width:e.innerWidth,height:e.innerHeight}):null,N.over?.(e.plot),b!==null?T("g",{"aria-hidden":"true",children:[o("line",{x1:e.xPositions[b],y1:0,x2:e.xPositions[b],y2:e.innerHeight,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:1,strokeDasharray:s===null?"3 3":void 0}),I.map(t=>o("circle",{cx:e.xPositions[b],cy:e.yScale(t.value),r:4,fill:t.color,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},t.seriesKey))]}):null]}),o("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:d.hidden?null:o(xe,{orientation:"bottom",ticks:e.xTicks,length:e.innerWidth,label:d.label,size:_})}),o("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:B?.hidden?null:o(xe,{orientation:"left",ticks:e.yTicks,length:e.innerHeight,showLine:!1,label:B?.label,size:_})})]}),g&&R!==!1?o(Me,{x:e.margin.left+e.xPositions[g.index],y:e.margin.top+(I.length>0?Math.min(...I.map(t=>e.yScale(t.value))):e.innerHeight/2),containerWidth:m,children:typeof R=="function"?R(g):o(Xe,{title:g.xLabel,points:g.points})}):null]})}function It({data:m,series:f,x:r,y:i,height:d=240,width:B,size:y="md",grid:_="y",legend:C,tooltip:D=!0,tableView:k=!1,emphasis:v,title:P,description:ae,loading:L=!1,emptyState:se,error:ie=!1,errorState:S,onRetry:z,actions:U,onPointClick:le,curve:he="monotone",forecastFrom:j,forecastLabel:R,markers:w="auto",connectNulls:ue=!1,referenceLines:V,annotations:E,overlay:K,legendToggle:M=!0,maxPoints:s,brush:ce=!1,onBrush:de,brushLabel:me,sync:h=!0,margin:e,locale:p,plotLabel:F,className:fe,...c}){let Y=Te(),[X,H]=ye(()=>new Set),W=oe(()=>f.map((a,N)=>({...a,hidden:a.hidden||X.has(a.key),color:$e(a,N,v)})),[f,X,v]),q=oe(()=>i?.format??(a=>qe(a,p)),[i?.format,p]),J=oe(()=>r.format??(a=>r.scale==="time"?ot(a,p):Je(a,p)),[r.format,r.scale,p]),b=x(a=>{H(N=>{let g=new Set(N);return g.has(a)?g.delete(a):g.add(a),g})},[]),$=C===void 0?f.length>=2:C!==!1,I=typeof C=="string"?C:"bottom",G=W.filter(a=>!a.hidden).length;return o(We,{title:P,description:ae,height:d,width:B,size:y,loading:L,empty:m.length===0||G===0,emptyState:se,error:ie,errorState:S,onRetry:z,actions:U,tableView:k,legendPosition:I,legend:$?o(Ne,{items:Ge(W,v),position:I,marker:"line",size:y,onToggle:M?b:void 0}):void 0,table:k?o(Ke,{data:m,series:W,xKey:r.key,xLabel:r.label??r.key,formatX:J,formatValue:q,caption:typeof P=="string"?P:void 0}):void 0,className:fe,...c,children:({width:a})=>o(ut,{width:a,height:d,data:m,resolvedSeries:W,x:r,y:i,grid:_,size:y,curve:he,forecastFrom:j,forecastLabel:R,markers:w,connectNulls:ue,referenceLines:V,annotations:E,annotationsLabel:Y.chartAnnotations,overlay:K,maxPoints:s,brush:ce,onBrush:de,brushLabel:me??Y.chartBrush,syncEnabled:h,margin:e,tooltip:D,onPointClick:le,plotLabel:F,formatValue:q,formatX:J})})}export{It as LineChart};
@@ -1 +1 @@
1
- "use strict";"use client";var u=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var de=Object.prototype.hasOwnProperty;var ce=(r,t)=>{for(var o in t)u(r,o,{get:t[o],enumerable:!0})},ue=(r,t,o,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of ie(t))!de.call(r,l)&&l!==o&&u(r,l,{get:()=>t[l],enumerable:!(d=ne(t,l))||d.enumerable});return r};var ge=r=>ue(u({},"__esModule",{value:!0}),r);var be={};ce(be,{Modal:()=>N});module.exports=ge(be);var s=require("react"),w=require("../../hooks/useDialogA11y.cjs"),a=require("../../lib/cn.cjs"),k=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime"),me={sm:"max-w-sm",md:"max-w-2xl",lg:"max-w-4xl",xl:"max-w-6xl",full:"max-w-full"},N=(0,s.forwardRef)(({isOpen:r,onClose:t,title:o="Modal Title",children:d,buttonLabel:l,onButtonClick:C,className:L,allowFullScreen:F=!1,showSubmit:g=!0,submitLabel:M,onSubmitClick:S,showCancel:m=!1,cancelLabel:j,onCancelClick:b,buttonsPosition:v="right",showHeaderDivider:D=!0,showFooterDivider:I=!0,description:c,icon:f,size:R="md",reverseButtons:P=!1,headerClassName:B,contentClassName:H,footerClassName:z,titleClassName:E,descriptionClassName:T,submitClassName:W,cancelClassName:$,closeLabel:A,enterFullScreenLabel:O,exitFullScreenLabel:U,"aria-label":V,closeOnEscape:q=!0,trapFocus:G=!0,initialFocus:J,returnFocus:K,lockScroll:Q=!0},X)=>{let[n,Y]=(0,s.useState)(!1),i=(0,k.useUILabels)(),h=(0,s.useId)(),x=`${h}-title`,p=`${h}-description`,{dialogRef:Z,dialogProps:_}=(0,w.useDialogA11y)({open:r,onClose:t,closeOnEscape:q,trapFocus:G,initialFocus:J,returnFocus:K,lockScroll:Q});if(!r)return null;let ee=l??M??i.confirm,te=j??i.cancel,re=A??i.closeModal,ae=n?U??i.exitFullScreen:O??i.enterFullScreen,y=C??S,oe=async()=>{y&&await y(),t()},le=async()=>{b&&await b(),t()};return(0,e.jsx)("div",{className:(0,a.cn)("overflow-y-auto overflow-x-hidden fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm",L),"aria-hidden":!r,children:(0,e.jsx)("div",{className:(0,a.cn)("relative p-4 w-full max-h-full transition-all duration-300",n?"max-w-full h-full p-0":me[R]),ref:X,children:(0,e.jsxs)("div",{..._,ref:Z,"aria-labelledby":o?x:void 0,"aria-label":o?void 0:V,"aria-describedby":c?p:void 0,className:(0,a.cn)("relative bg-white shadow dark:bg-gray-700 border-b-4 transition-all duration-300 focus:outline-none",n?"rounded-none h-full flex flex-col":"rounded-lg"),children:[(0,e.jsxs)("div",{className:(0,a.cn)("flex items-center justify-between p-4 md:p-5 rounded-t",D&&"border-b border-gray-200 dark:border-gray-600",B),children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[f&&(0,e.jsx)("div",{className:"shrink-0 text-gray-500 dark:text-gray-400",children:f}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{id:x,className:(0,a.cn)("text-xl font-semibold text-gray-900 dark:text-white",E),children:o}),c&&(0,e.jsx)("p",{id:p,className:(0,a.cn)("mt-1 text-sm text-gray-500 dark:text-gray-400",T),children:c})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 ms-auto",children:[F&&(0,e.jsx)("button",{type:"button",onClick:()=>Y(se=>!se),className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white","aria-label":ae,children:n?(0,e.jsx)("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M7 1H1v6m16 0V1h-6m0 16h6v-6M1 11v6h6"})}):(0,e.jsx)("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M11 1h6v6M1 11v6h6m0-12L1 1m16 16-6-6"})})}),(0,e.jsxs)("button",{type:"button",onClick:t,className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white",children:[(0,e.jsx)("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"})}),(0,e.jsx)("span",{className:"sr-only",children:re})]})]})]}),(0,e.jsx)("div",{className:(0,a.cn)("p-4 md:p-5 space-y-4",n&&"flex-1 overflow-y-auto",H),children:d}),(g||m)&&(0,e.jsxs)("div",{className:(0,a.cn)("flex items-center gap-2 p-4 md:p-5 rounded-b",I&&"border-t border-gray-200 dark:border-gray-600",v==="right"?"justify-end":v==="center"?"justify-center":"justify-start",P&&"flex-row-reverse",z),children:[m&&(0,e.jsx)("button",{type:"button",onClick:le,className:(0,a.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",$),children:te}),g&&(0,e.jsx)("button",{type:"button",onClick:oe,className:(0,a.cn)("text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-500 dark:hover:bg-blue-600",W),children:ee})]})]})})})});N.displayName="Modal";0&&(module.exports={Modal});
1
+ "use strict";"use client";var m=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var me=Object.prototype.hasOwnProperty;var ge=(r,t)=>{for(var l in t)m(r,l,{get:t[l],enumerable:!0})},be=(r,t,l,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ue(t))!me.call(r,a)&&a!==l&&m(r,a,{get:()=>t[a],enumerable:!(d=ce(t,a))||d.enumerable});return r};var ve=r=>be(m({},"__esModule",{value:!0}),r);var he={};ge(he,{Modal:()=>F});module.exports=ve(he);var s=require("react"),N=require("react-dom"),C=require("../../hooks/useDialogA11y.cjs"),o=require("../../lib/cn.cjs"),L=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime"),fe={sm:"max-w-sm",md:"max-w-2xl",lg:"max-w-4xl",xl:"max-w-6xl",full:"max-w-full"},F=(0,s.forwardRef)(({isOpen:r,onClose:t,title:l,children:d,buttonLabel:a,onButtonClick:S,className:M,allowFullScreen:D=!1,showSubmit:g=!0,submitLabel:j,onSubmitClick:I,showCancel:b=!1,cancelLabel:P,onCancelClick:v,buttonsPosition:f="right",showHeaderDivider:R=!0,showFooterDivider:B=!0,description:c,icon:h,size:H="md",reverseButtons:z=!1,headerClassName:E,contentClassName:T,footerClassName:W,titleClassName:$,descriptionClassName:A,submitClassName:O,cancelClassName:U,closeLabel:V,enterFullScreenLabel:q,exitFullScreenLabel:G,"aria-label":J,closeOnEscape:K=!0,trapFocus:Q=!0,initialFocus:X,returnFocus:Y,lockScroll:Z=!0},_)=>{let[i,ee]=(0,s.useState)(!1),n=(0,L.useUILabels)(),u=l??n.modalDefaultTitle,x=(0,s.useId)(),p=`${x}-title`,y=`${x}-description`,{dialogRef:te,dialogProps:re}=(0,C.useDialogA11y)({open:r,onClose:t,closeOnEscape:K,trapFocus:Q,initialFocus:X,returnFocus:Y,lockScroll:Z});if(!r)return null;let oe=a??j??n.confirm,ae=P??n.cancel,le=V??n.closeModal,ne=i?G??n.exitFullScreen:q??n.enterFullScreen,w=S??I,se=async()=>{w&&await w(),t()},ie=async()=>{v&&await v(),t()},k=(0,e.jsx)("div",{className:(0,o.cn)("overflow-y-auto overflow-x-hidden fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm",M),"aria-hidden":!r,children:(0,e.jsx)("div",{className:(0,o.cn)("relative p-4 w-full max-h-full transition-all duration-300",i?"max-w-full h-full p-0":fe[H]),ref:_,children:(0,e.jsxs)("div",{...re,ref:te,"aria-labelledby":u?p:void 0,"aria-label":u?void 0:J,"aria-describedby":c?y:void 0,className:(0,o.cn)("relative bg-white shadow dark:bg-gray-700 border-b-4 transition-all duration-300 focus:outline-none",i?"rounded-none h-full flex flex-col":"rounded-lg"),children:[(0,e.jsxs)("div",{className:(0,o.cn)("flex items-center justify-between p-4 md:p-5 rounded-t",R&&"border-b border-gray-200 dark:border-gray-600",E),children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[h&&(0,e.jsx)("div",{className:"shrink-0 text-gray-500 dark:text-gray-400",children:h}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{id:p,className:(0,o.cn)("text-xl font-semibold text-gray-900 dark:text-white",$),children:u}),c&&(0,e.jsx)("p",{id:y,className:(0,o.cn)("mt-1 text-sm text-gray-500 dark:text-gray-400",A),children:c})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 ms-auto",children:[D&&(0,e.jsx)("button",{type:"button",onClick:()=>ee(de=>!de),className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white","aria-label":ne,children:i?(0,e.jsx)("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M7 1H1v6m16 0V1h-6m0 16h6v-6M1 11v6h6"})}):(0,e.jsx)("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M11 1h6v6M1 11v6h6m0-12L1 1m16 16-6-6"})})}),(0,e.jsxs)("button",{type:"button",onClick:t,className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white",children:[(0,e.jsx)("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"})}),(0,e.jsx)("span",{className:"sr-only",children:le})]})]})]}),(0,e.jsx)("div",{className:(0,o.cn)("p-4 md:p-5 space-y-4",i&&"flex-1 overflow-y-auto",T),children:d}),(g||b)&&(0,e.jsxs)("div",{className:(0,o.cn)("flex items-center gap-2 p-4 md:p-5 rounded-b",B&&"border-t border-gray-200 dark:border-gray-600",f==="right"?"justify-end":f==="center"?"justify-center":"justify-start",z&&"flex-row-reverse",W),children:[b&&(0,e.jsx)("button",{type:"button",onClick:ie,className:(0,o.cn)("text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 font-medium rounded-lg text-sm px-5 py-2.5 border border-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:bg-gray-600 dark:hover:text-white",U),children:ae}),g&&(0,e.jsx)("button",{type:"button",onClick:se,className:(0,o.cn)("text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-500 dark:hover:bg-blue-600",O),children:oe})]})]})})});return typeof document<"u"?(0,N.createPortal)(k,document.body):k});F.displayName="Modal";0&&(module.exports={Modal});
@@ -1 +1 @@
1
- "use client";import{forwardRef as ae,useId as oe,useState as le}from"react";import{useDialogA11y as se}from"../../hooks/useDialogA11y.js";import{cn as t}from"../../lib/cn.js";import{useUILabels as ne}from"../../lib/i18n.js";import{jsx as e,jsxs as r}from"react/jsx-runtime";var ie={sm:"max-w-sm",md:"max-w-2xl",lg:"max-w-4xl",xl:"max-w-6xl",full:"max-w-full"},de=ae(({isOpen:s,onClose:l,title:n="Modal Title",children:x,buttonLabel:p,onButtonClick:y,className:w,allowFullScreen:k=!1,showSubmit:d=!0,submitLabel:N,onSubmitClick:C,showCancel:c=!1,cancelLabel:L,onCancelClick:u,buttonsPosition:g="right",showHeaderDivider:F=!0,showFooterDivider:M=!0,description:i,icon:m,size:S="md",reverseButtons:j=!1,headerClassName:D,contentClassName:I,footerClassName:R,titleClassName:P,descriptionClassName:B,submitClassName:H,cancelClassName:z,closeLabel:E,enterFullScreenLabel:T,exitFullScreenLabel:W,"aria-label":$,closeOnEscape:A=!0,trapFocus:O=!0,initialFocus:U,returnFocus:V,lockScroll:q=!0},G)=>{let[a,J]=le(!1),o=ne(),b=oe(),v=`${b}-title`,f=`${b}-description`,{dialogRef:K,dialogProps:Q}=se({open:s,onClose:l,closeOnEscape:A,trapFocus:O,initialFocus:U,returnFocus:V,lockScroll:q});if(!s)return null;let X=p??N??o.confirm,Y=L??o.cancel,Z=E??o.closeModal,_=a?W??o.exitFullScreen:T??o.enterFullScreen,h=y??C,ee=async()=>{h&&await h(),l()},te=async()=>{u&&await u(),l()};return 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",w),"aria-hidden":!s,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":ie[S]),ref:G,children:r("div",{...Q,ref:K,"aria-labelledby":n?v:void 0,"aria-label":n?void 0:$,"aria-describedby":i?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",F&&"border-b border-gray-200 dark:border-gray-600",D),children:[r("div",{className:"flex items-center gap-3",children:[m&&e("div",{className:"shrink-0 text-gray-500 dark:text-gray-400",children:m}),r("div",{children:[e("h3",{id:v,className:t("text-xl font-semibold text-gray-900 dark:text-white",P),children:n}),i&&e("p",{id:f,className:t("mt-1 text-sm text-gray-500 dark:text-gray-400",B),children:i})]})]}),r("div",{className:"flex items-center gap-1 ms-auto",children:[k&&e("button",{type:"button",onClick:()=>J(re=>!re),className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white","aria-label":_,children:a?e("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M7 1H1v6m16 0V1h-6m0 16h6v-6M1 11v6h6"})}):e("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M11 1h6v6M1 11v6h6m0-12L1 1m16 16-6-6"})})}),r("button",{type:"button",onClick:l,className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white",children:[e("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"})}),e("span",{className:"sr-only",children:Z})]})]})]}),e("div",{className:t("p-4 md:p-5 space-y-4",a&&"flex-1 overflow-y-auto",I),children:x}),(d||c)&&r("div",{className:t("flex items-center gap-2 p-4 md:p-5 rounded-b",M&&"border-t border-gray-200 dark:border-gray-600",g==="right"?"justify-end":g==="center"?"justify-center":"justify-start",j&&"flex-row-reverse",R),children:[c&&e("button",{type:"button",onClick:te,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",z),children:Y}),d&&e("button",{type:"button",onClick:ee,className:t("text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-500 dark:hover:bg-blue-600",H),children:X})]})]})})})});de.displayName="Modal";export{de as Modal};
1
+ "use client";import{forwardRef as le,useId as ne,useState as se}from"react";import{createPortal as ie}from"react-dom";import{useDialogA11y as de}from"../../hooks/useDialogA11y.js";import{cn as t}from"../../lib/cn.js";import{useUILabels as ce}from"../../lib/i18n.js";import{jsx as e,jsxs as r}from"react/jsx-runtime";var ue={sm:"max-w-sm",md:"max-w-2xl",lg:"max-w-4xl",xl:"max-w-6xl",full:"max-w-full"},me=le(({isOpen:n,onClose:l,title:p,children:y,buttonLabel:w,onButtonClick:k,className:N,allowFullScreen:C=!1,showSubmit:d=!0,submitLabel:L,onSubmitClick:F,showCancel:c=!1,cancelLabel:S,onCancelClick:u,buttonsPosition:m="right",showHeaderDivider:M=!0,showFooterDivider:D=!0,description:s,icon:g,size:j="md",reverseButtons:I=!1,headerClassName:P,contentClassName:R,footerClassName:B,titleClassName:H,descriptionClassName:z,submitClassName:E,cancelClassName:T,closeLabel:W,enterFullScreenLabel:$,exitFullScreenLabel:A,"aria-label":O,closeOnEscape:U=!0,trapFocus:V=!0,initialFocus:q,returnFocus:G,lockScroll:J=!0},K)=>{let[a,Q]=se(!1),o=ce(),i=p??o.modalDefaultTitle,b=ne(),v=`${b}-title`,f=`${b}-description`,{dialogRef:X,dialogProps:Y}=de({open:n,onClose:l,closeOnEscape:U,trapFocus:V,initialFocus:q,returnFocus:G,lockScroll:J});if(!n)return null;let Z=w??L??o.confirm,_=S??o.cancel,ee=W??o.closeModal,te=a?A??o.exitFullScreen:$??o.enterFullScreen,h=k??F,re=async()=>{h&&await h(),l()},oe=async()=>{u&&await u(),l()},x=e("div",{className:t("overflow-y-auto overflow-x-hidden fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm",N),"aria-hidden":!n,children:e("div",{className:t("relative p-4 w-full max-h-full transition-all duration-300",a?"max-w-full h-full p-0":ue[j]),ref:K,children:r("div",{...Y,ref:X,"aria-labelledby":i?v:void 0,"aria-label":i?void 0:O,"aria-describedby":s?f:void 0,className:t("relative bg-white shadow dark:bg-gray-700 border-b-4 transition-all duration-300 focus:outline-none",a?"rounded-none h-full flex flex-col":"rounded-lg"),children:[r("div",{className:t("flex items-center justify-between p-4 md:p-5 rounded-t",M&&"border-b border-gray-200 dark:border-gray-600",P),children:[r("div",{className:"flex items-center gap-3",children:[g&&e("div",{className:"shrink-0 text-gray-500 dark:text-gray-400",children:g}),r("div",{children:[e("h3",{id:v,className:t("text-xl font-semibold text-gray-900 dark:text-white",H),children:i}),s&&e("p",{id:f,className:t("mt-1 text-sm text-gray-500 dark:text-gray-400",z),children:s})]})]}),r("div",{className:"flex items-center gap-1 ms-auto",children:[C&&e("button",{type:"button",onClick:()=>Q(ae=>!ae),className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white","aria-label":te,children:a?e("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M7 1H1v6m16 0V1h-6m0 16h6v-6M1 11v6h6"})}):e("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M11 1h6v6M1 11v6h6m0-12L1 1m16 16-6-6"})})}),r("button",{type:"button",onClick:l,className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white",children:[e("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"})}),e("span",{className:"sr-only",children:ee})]})]})]}),e("div",{className:t("p-4 md:p-5 space-y-4",a&&"flex-1 overflow-y-auto",R),children:y}),(d||c)&&r("div",{className:t("flex items-center gap-2 p-4 md:p-5 rounded-b",D&&"border-t border-gray-200 dark:border-gray-600",m==="right"?"justify-end":m==="center"?"justify-center":"justify-start",I&&"flex-row-reverse",B),children:[c&&e("button",{type:"button",onClick:oe,className:t("text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 font-medium rounded-lg text-sm px-5 py-2.5 border border-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:bg-gray-600 dark:hover:text-white",T),children:_}),d&&e("button",{type:"button",onClick:re,className:t("text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-500 dark:hover:bg-blue-600",E),children:Z})]})]})})});return typeof document<"u"?ie(x,document.body):x});me.displayName="Modal";export{me as Modal};
@@ -1 +1 @@
1
- "use strict";"use client";var w=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var F=(e,r)=>{for(var d in r)w(e,d,{get:r[d],enumerable:!0})},$=(e,r,d,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let c of A(r))!_.call(e,c)&&c!==d&&w(e,c,{get:()=>r[c],enumerable:!(s=P(r,c))||s.enumerable});return e};var z=e=>$(w({},"__esModule",{value:!0}),e);var U={};F(U,{Pagination:()=>T});module.exports=z(U);var N=require("react"),u=require("../../lib/cn.cjs"),n=require("react/jsx-runtime");function q(e,r,d,s){let c=d*2+1+s*2+2;if(r<=c)return Array.from({length:r},(t,g)=>g+1);let v=Array.from({length:s},(t,g)=>g+1).filter(t=>t<=r),y=Array.from({length:s},(t,g)=>r-s+1+g).filter(t=>t>=1),b=Math.max(e-d,s+1),i=Math.min(e+d,r-s),h=b>s+2,m=i<r-s-1,a=[];for(let t of v)a.push(t);if(h)a.push("ellipsis");else for(let t=s+1;t<b;t++)a.push(t);for(let t=b;t<=i;t++)a.push(t);if(m)a.push("ellipsis");else for(let t=i+1;t<=r-s;t++)a.push(t);for(let t of y)a.includes(t)||a.push(t);return a}function D({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 O={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"}},Q={default:{base:"rounded-md font-medium transition-colors",idle:"text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700",active:"bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"},outlined:{base:"rounded-md border font-medium transition-colors",idle:"border-gray-300 text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",active:"border-blue-600 bg-blue-50 text-blue-600 hover:bg-blue-100 dark:border-blue-400 dark:bg-blue-900/30 dark:text-blue-400 dark:hover:bg-blue-900/50",disabled:"border-gray-200 text-gray-300 cursor-not-allowed dark:border-gray-700 dark:text-gray-600"},minimal:{base:"rounded-md font-medium transition-colors",idle:"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200",active:"text-blue-600 font-semibold hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"}};function T({page:e,totalPages:r,onPageChange:d,size:s="md",variant:c="default",showFirstLast:v=!1,siblings:y=1,boundaries:b=1,disabled:i=!1,labels:h,totalItems:m,pageSize:a,pageSizeOptions:t,onPageSizeChange:g,className:M,...B}){let l=O[s],f=Q[c],W=(0,N.useMemo)(()=>q(e,r,y,b),[e,r,y,b]),x=(0,N.useCallback)(o=>{i||o<1||o>r||o===e||d(o)},[i,r,e,d]),C=e<=1,L=e>=r,R=(0,u.cn)("inline-flex items-center justify-center select-none",l.button,f.base),k=(o,p,G,I)=>(0,n.jsx)("button",{type:"button",onClick:o,disabled:i||p,"aria-label":G,"aria-disabled":i||p,className:(0,u.cn)(R,i||p?f.disabled:f.idle),children:I}),j=m!==void 0&&a?(e-1)*a+1:void 0,E=m!==void 0&&a?Math.min(e*a,m):void 0;return(0,n.jsxs)("nav",{"aria-label":"Pagination",className:(0,u.cn)("flex items-center",l.gap,M),...B,children:[m!==void 0&&a&&(0,n.jsxs)("span",{className:(0,u.cn)("mr-2 text-gray-600 dark:text-gray-400 whitespace-nowrap",l.text),children:[j,"\u2013",E," of ",m]}),t&&t.length>0&&g&&(0,n.jsxs)("div",{className:(0,u.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:"Rows:"}),(0,n.jsx)("select",{id:"pagination-page-size",value:a,onChange:o=>g(Number(o.target.value)),disabled:i,className:(0,u.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,i&&"cursor-not-allowed opacity-50"),children:t.map(o=>(0,n.jsx)("option",{value:o,children:o},o))})]}),(0,n.jsxs)("div",{className:(0,u.cn)("flex items-center",l.gap),children:[v&&k(()=>x(1),C,h?.first??"Go to first page",(0,n.jsx)(J,{className:l.icon})),k(()=>x(e-1),C,h?.previous??"Go to previous page",(0,n.jsx)(D,{className:l.icon})),W.map((o,p)=>o==="ellipsis"?(0,n.jsx)("span",{className:(0,u.cn)("inline-flex items-center justify-center select-none",l.button,"text-gray-400 dark:text-gray-500"),"aria-hidden":"true",children:"\u2026"},`ellipsis-${p}`):(0,n.jsx)("button",{type:"button",onClick:()=>x(o),disabled:i,"aria-current":o===e?"page":void 0,"aria-label":`Page ${o}`,className:(0,u.cn)(R,o===e?f.active:i?f.disabled:f.idle),children:o},o)),k(()=>x(e+1),L,h?.next??"Go to next page",(0,n.jsx)(H,{className:l.icon})),v&&k(()=>x(r),L,h?.last??"Go to last page",(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 u in r)L(e,u,{get:r[u],enumerable:!0})},$=(e,r,u,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let c of _(r))!O.call(e,c)&&c!==u&&L(e,c,{get:()=>r[c],enumerable:!(i=F(r,c))||i.enumerable});return e};var q=e=>$(L({},"__esModule",{value:!0}),e);var X={};z(X,{Pagination:()=>V});module.exports=q(X);var C=require("react"),d=require("../../lib/cn.cjs"),y=require("../../lib/i18n.cjs"),n=require("react/jsx-runtime");function D(e,r,u,i){let c=u*2+1+i*2+2;if(r<=c)return Array.from({length:r},(t,g)=>g+1);let k=Array.from({length:i},(t,g)=>g+1).filter(t=>t<=r),N=Array.from({length:i},(t,g)=>r-i+1+g).filter(t=>t>=1),h=Math.max(e-u,i+1),s=Math.min(e+u,r-i),b=h>i+2,p=s<r-i-1,o=[];for(let t of k)o.push(t);if(b)o.push("ellipsis");else for(let t=i+1;t<h;t++)o.push(t);for(let t=h;t<=s;t++)o.push(t);if(p)o.push("ellipsis");else for(let t=s+1;t<=r-i;t++)o.push(t);for(let t of N)o.includes(t)||o.push(t);return o}function G({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function H({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}function J({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 19l-7-7 7-7M18 19l-7-7 7-7"})})}function K({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M6 5l7 7-7 7"})})}var Q={sm:{button:"h-7 min-w-7 px-1.5 text-xs",icon:"h-3 w-3",gap:"gap-0.5",text:"text-xs"},md:{button:"h-9 min-w-9 px-2.5 text-sm",icon:"h-4 w-4",gap:"gap-1",text:"text-sm"},lg:{button:"h-11 min-w-11 px-3.5 text-base",icon:"h-5 w-5",gap:"gap-1.5",text:"text-base"}},T={default:{base:"rounded-md font-medium transition-colors",idle:"text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700",active:"bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"},outlined:{base:"rounded-md border font-medium transition-colors",idle:"border-gray-300 text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",active:"border-blue-600 bg-blue-50 text-blue-600 hover:bg-blue-100 dark:border-blue-400 dark:bg-blue-900/30 dark:text-blue-400 dark:hover:bg-blue-900/50",disabled:"border-gray-200 text-gray-300 cursor-not-allowed dark:border-gray-700 dark:text-gray-600"},minimal:{base:"rounded-md font-medium transition-colors",idle:"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200",active:"text-blue-600 font-semibold hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"}};function V({page:e,totalPages:r,onPageChange:u,size:i="md",variant:c="default",showFirstLast:k=!1,siblings:N=1,boundaries:h=1,disabled:s=!1,labels:b,totalItems:p,pageSize:o,pageSizeOptions:t,onPageSizeChange:g,className:I,...P}){let m=(0,y.useUILabels)(b),l=Q[i],f=T[c],W=(0,C.useMemo)(()=>D(e,r,N,h),[e,r,N,h]),x=(0,C.useCallback)(a=>{s||a<1||a>r||a===e||u(a)},[s,r,e,u]),R=e<=1,M=e>=r,B=(0,d.cn)("inline-flex items-center justify-center select-none",l.button,f.base),w=(a,v,U,A)=>(0,n.jsx)("button",{type:"button",onClick:a,disabled:s||v,"aria-label":U,"aria-disabled":s||v,className:(0,d.cn)(B,s||v?f.disabled:f.idle),children:A}),j=p!==void 0&&o?(e-1)*o+1:void 0,E=p!==void 0&&o?Math.min(e*o,p):void 0;return(0,n.jsxs)("nav",{"aria-label":m.paginationLabel,className:(0,d.cn)("flex items-center",l.gap,I),...P,children:[p!==void 0&&o&&(0,n.jsx)("span",{className:(0,d.cn)("mr-2 text-gray-600 dark:text-gray-400 whitespace-nowrap",l.text),children:(0,y.formatUILabel)(m.paginationRange,{start:j??0,end:E??0,total:p})}),t&&t.length>0&&g&&(0,n.jsxs)("div",{className:(0,d.cn)("mr-2 flex items-center whitespace-nowrap",l.gap,l.text),children:[(0,n.jsx)("label",{htmlFor:"pagination-page-size",className:"text-gray-600 dark:text-gray-400",children:m.paginationRowsPerPage}),(0,n.jsx)("select",{id:"pagination-page-size",value:o,onChange:a=>g(Number(a.target.value)),disabled:s,className:(0,d.cn)("rounded border border-gray-300 bg-white px-1.5 py-0.5 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200",l.text,s&&"cursor-not-allowed opacity-50"),children:t.map(a=>(0,n.jsx)("option",{value:a,children:a},a))})]}),(0,n.jsxs)("div",{className:(0,d.cn)("flex items-center",l.gap),children:[k&&w(()=>x(1),R,b?.first??m.paginationFirst,(0,n.jsx)(J,{className:l.icon})),w(()=>x(e-1),R,b?.previous??m.paginationPrevious,(0,n.jsx)(G,{className:l.icon})),W.map((a,v)=>a==="ellipsis"?(0,n.jsx)("span",{className:(0,d.cn)("inline-flex items-center justify-center select-none",l.button,"text-gray-400 dark:text-gray-500"),"aria-hidden":"true",children:"\u2026"},`ellipsis-${v}`):(0,n.jsx)("button",{type:"button",onClick:()=>x(a),disabled:s,"aria-current":a===e?"page":void 0,"aria-label":(0,y.formatUILabel)(m.paginationPage,{page:a}),className:(0,d.cn)(B,a===e?f.active:s?f.disabled:f.idle),children:a},a)),w(()=>x(e+1),M,b?.next??m.paginationNext,(0,n.jsx)(H,{className:l.icon})),k&&w(()=>x(r),M,b?.last??m.paginationLast,(0,n.jsx)(K,{className:l.icon}))]})]})}0&&(module.exports={Pagination});
@@ -1 +1 @@
1
- "use client";import{useCallback as I,useMemo as P}from"react";import{cn as d}from"../../lib/cn.js";import{jsx as n,jsxs as k}from"react/jsx-runtime";function A(t,a,g,i){let N=g*2+1+i*2+2;if(a<=N)return Array.from({length:a},(e,u)=>u+1);let p=Array.from({length:i},(e,u)=>u+1).filter(e=>e<=a),v=Array.from({length:i},(e,u)=>a-i+1+u).filter(e=>e>=1),m=Math.max(t-g,i+1),s=Math.min(t+g,a-i),b=m>i+2,c=s<a-i-1,o=[];for(let e of p)o.push(e);if(b)o.push("ellipsis");else for(let e=i+1;e<m;e++)o.push(e);for(let e=m;e<=s;e++)o.push(e);if(c)o.push("ellipsis");else for(let e=s+1;e<=a-i;e++)o.push(e);for(let e of v)o.includes(e)||o.push(e);return o}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:"M15 19l-7-7 7-7"})})}function F({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 $({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 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:"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"}},D={default:{base:"rounded-md font-medium transition-colors",idle:"text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700",active:"bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"},outlined:{base:"rounded-md border font-medium transition-colors",idle:"border-gray-300 text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",active:"border-blue-600 bg-blue-50 text-blue-600 hover:bg-blue-100 dark:border-blue-400 dark:bg-blue-900/30 dark:text-blue-400 dark:hover:bg-blue-900/50",disabled:"border-gray-200 text-gray-300 cursor-not-allowed dark:border-gray-700 dark:text-gray-600"},minimal:{base:"rounded-md font-medium transition-colors",idle:"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200",active:"text-blue-600 font-semibold hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"}};function K({page:t,totalPages:a,onPageChange:g,size:i="md",variant:N="default",showFirstLast:p=!1,siblings:v=1,boundaries:m=1,disabled:s=!1,labels:b,totalItems:c,pageSize:o,pageSizeOptions:e,onPageSizeChange:u,className:R,...M}){let l=q[i],h=D[N],B=P(()=>A(t,a,v,m),[t,a,v,m]),f=I(r=>{s||r<1||r>a||r===t||g(r)},[s,a,t,g]),w=t<=1,C=t>=a,L=d("inline-flex items-center justify-center select-none",l.button,h.base),y=(r,x,E,G)=>n("button",{type:"button",onClick:r,disabled:s||x,"aria-label":E,"aria-disabled":s||x,className:d(L,s||x?h.disabled:h.idle),children:G}),W=c!==void 0&&o?(t-1)*o+1:void 0,j=c!==void 0&&o?Math.min(t*o,c):void 0;return k("nav",{"aria-label":"Pagination",className:d("flex items-center",l.gap,R),...M,children:[c!==void 0&&o&&k("span",{className:d("mr-2 text-gray-600 dark:text-gray-400 whitespace-nowrap",l.text),children:[W,"\u2013",j," of ",c]}),e&&e.length>0&&u&&k("div",{className:d("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:"Rows:"}),n("select",{id:"pagination-page-size",value:o,onChange:r=>u(Number(r.target.value)),disabled:s,className:d("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:e.map(r=>n("option",{value:r,children:r},r))})]}),k("div",{className:d("flex items-center",l.gap),children:[p&&y(()=>f(1),w,b?.first??"Go to first page",n($,{className:l.icon})),y(()=>f(t-1),w,b?.previous??"Go to previous page",n(_,{className:l.icon})),B.map((r,x)=>r==="ellipsis"?n("span",{className:d("inline-flex items-center justify-center select-none",l.button,"text-gray-400 dark:text-gray-500"),"aria-hidden":"true",children:"\u2026"},`ellipsis-${x}`):n("button",{type:"button",onClick:()=>f(r),disabled:s,"aria-current":r===t?"page":void 0,"aria-label":`Page ${r}`,className:d(L,r===t?h.active:s?h.disabled:h.idle),children:r},r)),y(()=>f(t+1),C,b?.next??"Go to next page",n(F,{className:l.icon})),p&&y(()=>f(a),C,b?.last??"Go to last page",n(z,{className:l.icon}))]})]})}export{K as Pagination};
1
+ "use client";import{useCallback as A,useMemo as F}from"react";import{cn as u}from"../../lib/cn.js";import{formatUILabel as M,useUILabels as _}from"../../lib/i18n.js";import{jsx as n,jsxs as w}from"react/jsx-runtime";function O(t,o,b,s){let N=b*2+1+s*2+2;if(o<=N)return Array.from({length:o},(e,d)=>d+1);let v=Array.from({length:s},(e,d)=>d+1).filter(e=>e<=o),y=Array.from({length:s},(e,d)=>o-s+1+d).filter(e=>e>=1),p=Math.max(t-b,s+1),i=Math.min(t+b,o-s),g=p>s+2,m=i<o-s-1,a=[];for(let e of v)a.push(e);if(g)a.push("ellipsis");else for(let e=s+1;e<p;e++)a.push(e);for(let e=p;e<=i;e++)a.push(e);if(m)a.push("ellipsis");else for(let e=i+1;e<=o-s;e++)a.push(e);for(let e of y)a.includes(e)||a.push(e);return a}function z({className:t}){return n("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function $({className:t}){return n("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}function q({className:t}){return n("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 19l-7-7 7-7M18 19l-7-7 7-7"})})}function D({className:t}){return n("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M6 5l7 7-7 7"})})}var G={sm:{button:"h-7 min-w-7 px-1.5 text-xs",icon:"h-3 w-3",gap:"gap-0.5",text:"text-xs"},md:{button:"h-9 min-w-9 px-2.5 text-sm",icon:"h-4 w-4",gap:"gap-1",text:"text-sm"},lg:{button:"h-11 min-w-11 px-3.5 text-base",icon:"h-5 w-5",gap:"gap-1.5",text:"text-base"}},H={default:{base:"rounded-md font-medium transition-colors",idle:"text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700",active:"bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"},outlined:{base:"rounded-md border font-medium transition-colors",idle:"border-gray-300 text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",active:"border-blue-600 bg-blue-50 text-blue-600 hover:bg-blue-100 dark:border-blue-400 dark:bg-blue-900/30 dark:text-blue-400 dark:hover:bg-blue-900/50",disabled:"border-gray-200 text-gray-300 cursor-not-allowed dark:border-gray-700 dark:text-gray-600"},minimal:{base:"rounded-md font-medium transition-colors",idle:"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200",active:"text-blue-600 font-semibold hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"}};function T({page:t,totalPages:o,onPageChange:b,size:s="md",variant:N="default",showFirstLast:v=!1,siblings:y=1,boundaries:p=1,disabled:i=!1,labels:g,totalItems:m,pageSize:a,pageSizeOptions:e,onPageSizeChange:d,className:B,...I}){let c=_(g),l=G[s],h=H[N],P=F(()=>O(t,o,y,p),[t,o,y,p]),f=A(r=>{i||r<1||r>o||r===t||b(r)},[i,o,t,b]),C=t<=1,L=t>=o,R=u("inline-flex items-center justify-center select-none",l.button,h.base),k=(r,x,E,U)=>n("button",{type:"button",onClick:r,disabled:i||x,"aria-label":E,"aria-disabled":i||x,className:u(R,i||x?h.disabled:h.idle),children:U}),W=m!==void 0&&a?(t-1)*a+1:void 0,j=m!==void 0&&a?Math.min(t*a,m):void 0;return w("nav",{"aria-label":c.paginationLabel,className:u("flex items-center",l.gap,B),...I,children:[m!==void 0&&a&&n("span",{className:u("mr-2 text-gray-600 dark:text-gray-400 whitespace-nowrap",l.text),children:M(c.paginationRange,{start:W??0,end:j??0,total:m})}),e&&e.length>0&&d&&w("div",{className:u("mr-2 flex items-center whitespace-nowrap",l.gap,l.text),children:[n("label",{htmlFor:"pagination-page-size",className:"text-gray-600 dark:text-gray-400",children:c.paginationRowsPerPage}),n("select",{id:"pagination-page-size",value:a,onChange:r=>d(Number(r.target.value)),disabled:i,className:u("rounded border border-gray-300 bg-white px-1.5 py-0.5 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200",l.text,i&&"cursor-not-allowed opacity-50"),children:e.map(r=>n("option",{value:r,children:r},r))})]}),w("div",{className:u("flex items-center",l.gap),children:[v&&k(()=>f(1),C,g?.first??c.paginationFirst,n(q,{className:l.icon})),k(()=>f(t-1),C,g?.previous??c.paginationPrevious,n(z,{className:l.icon})),P.map((r,x)=>r==="ellipsis"?n("span",{className:u("inline-flex items-center justify-center select-none",l.button,"text-gray-400 dark:text-gray-500"),"aria-hidden":"true",children:"\u2026"},`ellipsis-${x}`):n("button",{type:"button",onClick:()=>f(r),disabled:i,"aria-current":r===t?"page":void 0,"aria-label":M(c.paginationPage,{page:r}),className:u(R,r===t?h.active:i?h.disabled:h.idle),children:r},r)),k(()=>f(t+1),L,g?.next??c.paginationNext,n($,{className:l.icon})),v&&k(()=>f(o),L,g?.last??c.paginationLast,n(D,{className:l.icon}))]})]})}export{T as Pagination};