@synertech/ui 0.46.1 → 0.46.3

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 (98) hide show
  1. package/dist/components/advance-detachable/AdvanceDetachable.cjs +1 -1
  2. package/dist/components/advance-detachable/AdvanceDetachable.js +1 -1
  3. package/dist/components/badge/Badge.cjs +1 -1
  4. package/dist/components/badge/Badge.js +1 -1
  5. package/dist/components/banner/Banner.cjs +1 -1
  6. package/dist/components/banner/Banner.js +1 -1
  7. package/dist/components/breadcrumb/Breadcrumb.cjs +1 -1
  8. package/dist/components/breadcrumb/Breadcrumb.js +1 -1
  9. package/dist/components/calendar/Calendar.cjs +1 -1
  10. package/dist/components/calendar/Calendar.js +1 -1
  11. package/dist/components/chart/ChartLegend.cjs +1 -1
  12. package/dist/components/chart/ChartLegend.js +1 -1
  13. package/dist/components/checkbox/Checkbox.cjs +1 -1
  14. package/dist/components/checkbox/Checkbox.js +1 -1
  15. package/dist/components/checkbox/CheckboxGroup.cjs +1 -1
  16. package/dist/components/checkbox/CheckboxGroup.js +1 -1
  17. package/dist/components/chip/Chip.cjs +1 -1
  18. package/dist/components/chip/Chip.js +1 -1
  19. package/dist/components/circular-progress/CircularProgress.cjs +1 -1
  20. package/dist/components/circular-progress/CircularProgress.js +1 -1
  21. package/dist/components/datagrid/DataGrid.cjs +1 -1
  22. package/dist/components/datagrid/DataGrid.js +1 -1
  23. package/dist/components/device-mockup/DeviceMockup.cjs +1 -1
  24. package/dist/components/device-mockup/DeviceMockup.js +1 -1
  25. package/dist/components/drawer/Drawer.cjs +1 -1
  26. package/dist/components/drawer/Drawer.js +1 -1
  27. package/dist/components/dropdown/DropdownItem.cjs +1 -1
  28. package/dist/components/dropdown/DropdownItem.js +1 -1
  29. package/dist/components/dropdown/DropdownRadio.cjs +1 -1
  30. package/dist/components/dropdown/DropdownRadio.js +1 -1
  31. package/dist/components/dropdown/DropdownSubMenu.cjs +1 -1
  32. package/dist/components/dropdown/DropdownSubMenu.js +1 -1
  33. package/dist/components/dropdown/DropdownTrigger.cjs +1 -1
  34. package/dist/components/dropdown/DropdownTrigger.js +1 -1
  35. package/dist/components/file-selector/FileSelector.cjs +1 -1
  36. package/dist/components/file-selector/FileSelector.js +1 -1
  37. package/dist/components/form/mention-input/MentionInput.cjs +1 -1
  38. package/dist/components/form/mention-input/MentionInput.js +1 -1
  39. package/dist/components/form/shared/inputStyles.cjs +1 -1
  40. package/dist/components/form/shared/inputStyles.js +1 -1
  41. package/dist/components/header/Header.cjs +1 -1
  42. package/dist/components/header/Header.js +1 -1
  43. package/dist/components/help-button/HelpButton.cjs +2 -2
  44. package/dist/components/help-button/HelpButton.js +3 -3
  45. package/dist/components/image-uploader/ImageUploader.cjs +1 -1
  46. package/dist/components/image-uploader/ImageUploader.js +1 -1
  47. package/dist/components/indicator/Indicator.cjs +1 -1
  48. package/dist/components/indicator/Indicator.js +1 -1
  49. package/dist/components/label/Label.cjs +1 -1
  50. package/dist/components/label/Label.js +1 -1
  51. package/dist/components/modal/Modal.cjs +1 -1
  52. package/dist/components/modal/Modal.js +1 -1
  53. package/dist/components/pagination/Pagination.cjs +1 -1
  54. package/dist/components/pagination/Pagination.js +1 -1
  55. package/dist/components/progress-bar/ProgressBar.cjs +1 -1
  56. package/dist/components/progress-bar/ProgressBar.js +1 -1
  57. package/dist/components/radio-button/RadioButton.cjs +1 -1
  58. package/dist/components/radio-button/RadioButton.js +1 -1
  59. package/dist/components/schema-editor/SchemaEditor.cjs +1 -1
  60. package/dist/components/schema-editor/SchemaEditor.js +1 -1
  61. package/dist/components/schema-editor/legend/SchemaLegend.cjs +1 -1
  62. package/dist/components/schema-editor/legend/SchemaLegend.js +1 -1
  63. package/dist/components/schema-editor/relations/SchemaRelationRenderer.cjs +1 -1
  64. package/dist/components/schema-editor/relations/SchemaRelationRenderer.js +1 -1
  65. package/dist/components/schema-editor/tables/SchemaTableRenderer.cjs +1 -1
  66. package/dist/components/schema-editor/tables/SchemaTableRenderer.js +1 -1
  67. package/dist/components/schema-editor/utils/foreign-keys.cjs +1 -0
  68. package/dist/components/schema-editor/utils/foreign-keys.js +1 -0
  69. package/dist/components/schema-editor/utils/geometry.cjs +1 -1
  70. package/dist/components/schema-editor/utils/geometry.js +1 -1
  71. package/dist/components/schema-editor/utils/sql-export.cjs +5 -5
  72. package/dist/components/schema-editor/utils/sql-export.js +5 -5
  73. package/dist/components/select/Select.cjs +1 -1
  74. package/dist/components/select/Select.js +1 -1
  75. package/dist/components/sidebar/Sidebar.cjs +1 -1
  76. package/dist/components/sidebar/Sidebar.js +1 -1
  77. package/dist/components/slider/Slider.cjs +1 -1
  78. package/dist/components/slider/Slider.js +1 -1
  79. package/dist/components/stat-card/StatCard.cjs +1 -1
  80. package/dist/components/stat-card/StatCard.js +1 -1
  81. package/dist/components/table/TableHeader.cjs +1 -1
  82. package/dist/components/table/TableHeader.js +1 -1
  83. package/dist/components/tabs/TabsTrigger.cjs +1 -1
  84. package/dist/components/tabs/TabsTrigger.js +1 -1
  85. package/dist/components/toast/Toast.cjs +1 -1
  86. package/dist/components/toast/Toast.js +1 -1
  87. package/dist/components/tooltip/Tooltip.cjs +1 -1
  88. package/dist/components/tooltip/Tooltip.js +1 -1
  89. package/dist/components/wizard/Wizard.cjs +1 -1
  90. package/dist/components/wizard/Wizard.js +1 -1
  91. package/dist/components/workflow-editor/WorkflowEditor.cjs +1 -1
  92. package/dist/components/workflow-editor/WorkflowEditor.js +1 -1
  93. package/dist/index.d.cts +12 -0
  94. package/dist/index.d.ts +12 -0
  95. package/dist/lib/editable-target.cjs +1 -0
  96. package/dist/lib/editable-target.js +1 -0
  97. package/dist/styles.css +82 -143
  98. package/package.json +2 -2
@@ -1 +1 @@
1
- "use strict";"use client";var g=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var A=(t,r)=>{for(var a in r)g(t,a,{get:r[a],enumerable:!0})},D=(t,r,a,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of U(r))!q.call(t,s)&&s!==a&&g(t,s,{get:()=>r[s],enumerable:!(n=T(r,s))||n.enumerable});return t};var F=t=>D(g({},"__esModule",{value:!0}),t);var _={};A(_,{Chip:()=>f});module.exports=F(_);var o=require("../../lib/cn.cjs"),k=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime");function G({className:t}){return(0,e.jsx)("svg",{className:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var J={default:{solid:"bg-gray-500 text-white",outlined:"border-gray-300 text-gray-700 dark:border-gray-600 dark:text-gray-300 bg-transparent",soft:"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300",dot:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300"},primary:{solid:"bg-blue-600 text-white",outlined:"border-blue-600 text-blue-600 dark:border-blue-400 dark:text-blue-400 bg-transparent",soft:"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300",dot:"bg-blue-50 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300"},success:{solid:"bg-green-600 text-white",outlined:"border-green-600 text-green-600 dark:border-green-400 dark:text-green-400 bg-transparent",soft:"bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300",dot:"bg-green-50 text-green-700 dark:bg-green-900/30 dark:text-green-300"},warning:{solid:"bg-yellow-500 text-gray-900",outlined:"border-yellow-500 text-yellow-600 dark:border-yellow-400 dark:text-yellow-400 bg-transparent",soft:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/50 dark:text-yellow-300",dot:"bg-yellow-50 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-300"},error:{solid:"bg-red-600 text-white",outlined:"border-red-600 text-red-600 dark:border-red-400 dark:text-red-400 bg-transparent",soft:"bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300",dot:"bg-red-50 text-red-700 dark:bg-red-900/30 dark:text-red-300"},info:{solid:"bg-cyan-600 text-white",outlined:"border-cyan-600 text-cyan-600 dark:border-cyan-400 dark:text-cyan-400 bg-transparent",soft:"bg-cyan-100 text-cyan-700 dark:bg-cyan-900/50 dark:text-cyan-300",dot:"bg-cyan-50 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-300"}},K={default:"bg-gray-500",primary:"bg-blue-600",success:"bg-green-600",warning:"bg-yellow-500",error:"bg-red-600",info:"bg-cyan-600"},Q={sm:"h-5 text-xs px-2 gap-1",md:"h-6 text-sm px-2.5 gap-1.5",lg:"h-8 text-sm px-3 gap-2"},c={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},X={sm:"w-4 h-4 -ml-1",md:"w-5 h-5 -ml-1.5",lg:"w-6 h-6 -ml-1.5"},Y={sm:"w-1.5 h-1.5",md:"w-2 h-2",lg:"w-2.5 h-2.5"},Z={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",full:"rounded-full"};function f({label:t,children:r,variant:a="solid",size:n="md",color:s="default",bgColor:b,textColor:p,borderColor:u,rounded:C="full",icon:x,endIcon:h,avatar:d,onClose:w,closable:m=!1,removeLabel:v,clickable:R=!1,selected:N=!1,disabled:l=!1,as:S="span",className:L,onClick:z,...M}){let P=(0,k.useUILabels)(),E=S,V=(0,o.cn)("inline-flex items-center justify-center font-medium transition-all",Q[n],Z[C],a==="outlined"&&"border"),W=(0,o.cn)(b||p||u?(0,o.cn)(b,p,u):J[s][a]),I=N?"ring-2 ring-offset-1 ring-blue-500":"",j=R&&!l?"cursor-pointer hover:opacity-80 active:scale-95":"",B=l?"opacity-50 cursor-not-allowed":"",H=i=>{i.stopPropagation(),w?.()},O=i=>{l||z?.(i)},y=r??t;return(0,e.jsxs)(E,{className:(0,o.cn)(V,W,I,j,B,L),onClick:O,"aria-disabled":l,...M,children:[a==="dot"&&(0,e.jsx)("span",{className:(0,o.cn)("rounded-full shrink-0",Y[n],K[s]),"aria-hidden":"true"}),d&&(0,e.jsx)("span",{className:(0,o.cn)("rounded-full overflow-hidden shrink-0",X[n]),children:d}),x&&!d&&(0,e.jsx)("span",{className:(0,o.cn)("shrink-0",c[n]),children:x}),y&&(0,e.jsx)("span",{className:"truncate",children:y}),h&&!m&&(0,e.jsx)("span",{className:(0,o.cn)("shrink-0",c[n]),children:h}),m&&(0,e.jsx)("button",{type:"button",onClick:H,disabled:l,className:(0,o.cn)("shrink-0 rounded-full hover:bg-black/10 dark:hover:bg-white/10 p-0.5 -mr-1 transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-current",l&&"pointer-events-none"),"aria-label":v??P.chipRemove,children:(0,e.jsx)(G,{className:c[n]})})]})}f.displayName="Chip";0&&(module.exports={Chip});
1
+ "use strict";"use client";var g=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var A=(t,r)=>{for(var a in r)g(t,a,{get:r[a],enumerable:!0})},D=(t,r,a,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of U(r))!q.call(t,s)&&s!==a&&g(t,s,{get:()=>r[s],enumerable:!(n=T(r,s))||n.enumerable});return t};var F=t=>D(g({},"__esModule",{value:!0}),t);var _={};A(_,{Chip:()=>f});module.exports=F(_);var o=require("../../lib/cn.cjs"),k=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime");function G({className:t}){return(0,e.jsx)("svg",{className:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var J={default:{solid:"bg-gray-500 text-white",outlined:"border-gray-300 text-gray-700 dark:border-gray-600 dark:text-gray-300 bg-transparent",soft:"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300",dot:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300"},primary:{solid:"bg-blue-600 text-white",outlined:"border-blue-600 text-blue-600 dark:border-blue-400 dark:text-blue-400 bg-transparent",soft:"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300",dot:"bg-blue-50 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300"},success:{solid:"bg-green-700 text-white",outlined:"border-green-600 text-green-700 dark:border-green-400 dark:text-green-400 bg-transparent",soft:"bg-green-100 text-green-800 dark:bg-green-900/50 dark:text-green-300",dot:"bg-green-50 text-green-700 dark:bg-green-900/30 dark:text-green-300"},warning:{solid:"bg-yellow-500 text-gray-900",outlined:"border-yellow-500 text-yellow-700 dark:border-yellow-400 dark:text-yellow-400 bg-transparent",soft:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/50 dark:text-yellow-300",dot:"bg-yellow-50 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-300"},error:{solid:"bg-red-600 text-white",outlined:"border-red-600 text-red-600 dark:border-red-400 dark:text-red-400 bg-transparent",soft:"bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300",dot:"bg-red-50 text-red-700 dark:bg-red-900/30 dark:text-red-300"},info:{solid:"bg-cyan-700 text-white",outlined:"border-cyan-600 text-cyan-700 dark:border-cyan-400 dark:text-cyan-400 bg-transparent",soft:"bg-cyan-100 text-cyan-700 dark:bg-cyan-900/50 dark:text-cyan-300",dot:"bg-cyan-50 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-300"}},K={default:"bg-gray-500",primary:"bg-blue-600",success:"bg-green-600",warning:"bg-yellow-500",error:"bg-red-600",info:"bg-cyan-600"},Q={sm:"h-5 text-xs px-2 gap-1",md:"h-6 text-sm px-2.5 gap-1.5",lg:"h-8 text-sm px-3 gap-2"},c={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},X={sm:"w-4 h-4 -ml-1",md:"w-5 h-5 -ml-1.5",lg:"w-6 h-6 -ml-1.5"},Y={sm:"w-1.5 h-1.5",md:"w-2 h-2",lg:"w-2.5 h-2.5"},Z={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",full:"rounded-full"};function f({label:t,children:r,variant:a="solid",size:n="md",color:s="default",bgColor:b,textColor:p,borderColor:u,rounded:C="full",icon:x,endIcon:h,avatar:d,onClose:w,closable:m=!1,removeLabel:v,clickable:R=!1,selected:N=!1,disabled:l=!1,as:S="span",className:L,onClick:z,...M}){let P=(0,k.useUILabels)(),E=S,V=(0,o.cn)("inline-flex items-center justify-center font-medium transition-all",Q[n],Z[C],a==="outlined"&&"border"),W=(0,o.cn)(b||p||u?(0,o.cn)(b,p,u):J[s][a]),I=N?"ring-2 ring-offset-1 ring-blue-500":"",j=R&&!l?"cursor-pointer hover:opacity-80 active:scale-95":"",B=l?"opacity-50 cursor-not-allowed":"",H=i=>{i.stopPropagation(),w?.()},O=i=>{l||z?.(i)},y=r??t;return(0,e.jsxs)(E,{className:(0,o.cn)(V,W,I,j,B,L),onClick:O,"aria-disabled":l,...M,children:[a==="dot"&&(0,e.jsx)("span",{className:(0,o.cn)("rounded-full shrink-0",Y[n],K[s]),"aria-hidden":"true"}),d&&(0,e.jsx)("span",{className:(0,o.cn)("rounded-full overflow-hidden shrink-0",X[n]),children:d}),x&&!d&&(0,e.jsx)("span",{className:(0,o.cn)("shrink-0",c[n]),children:x}),y&&(0,e.jsx)("span",{className:"truncate",children:y}),h&&!m&&(0,e.jsx)("span",{className:(0,o.cn)("shrink-0",c[n]),children:h}),m&&(0,e.jsx)("button",{type:"button",onClick:H,disabled:l,className:(0,o.cn)("shrink-0 rounded-full hover:bg-black/10 dark:hover:bg-white/10 p-0.5 -mr-1 transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-current",l&&"pointer-events-none"),"aria-label":v??P.chipRemove,children:(0,e.jsx)(G,{className:c[n]})})]})}f.displayName="Chip";0&&(module.exports={Chip});
@@ -1 +1 @@
1
- "use client";import{cn as e}from"../../lib/cn.js";import{useUILabels as B}from"../../lib/i18n.js";import{jsx as t,jsxs as G}from"react/jsx-runtime";function H({className:n}){return t("svg",{className:n,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:t("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var O={default:{solid:"bg-gray-500 text-white",outlined:"border-gray-300 text-gray-700 dark:border-gray-600 dark:text-gray-300 bg-transparent",soft:"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300",dot:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300"},primary:{solid:"bg-blue-600 text-white",outlined:"border-blue-600 text-blue-600 dark:border-blue-400 dark:text-blue-400 bg-transparent",soft:"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300",dot:"bg-blue-50 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300"},success:{solid:"bg-green-600 text-white",outlined:"border-green-600 text-green-600 dark:border-green-400 dark:text-green-400 bg-transparent",soft:"bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300",dot:"bg-green-50 text-green-700 dark:bg-green-900/30 dark:text-green-300"},warning:{solid:"bg-yellow-500 text-gray-900",outlined:"border-yellow-500 text-yellow-600 dark:border-yellow-400 dark:text-yellow-400 bg-transparent",soft:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/50 dark:text-yellow-300",dot:"bg-yellow-50 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-300"},error:{solid:"bg-red-600 text-white",outlined:"border-red-600 text-red-600 dark:border-red-400 dark:text-red-400 bg-transparent",soft:"bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300",dot:"bg-red-50 text-red-700 dark:bg-red-900/30 dark:text-red-300"},info:{solid:"bg-cyan-600 text-white",outlined:"border-cyan-600 text-cyan-600 dark:border-cyan-400 dark:text-cyan-400 bg-transparent",soft:"bg-cyan-100 text-cyan-700 dark:bg-cyan-900/50 dark:text-cyan-300",dot:"bg-cyan-50 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-300"}},T={default:"bg-gray-500",primary:"bg-blue-600",success:"bg-green-600",warning:"bg-yellow-500",error:"bg-red-600",info:"bg-cyan-600"},U={sm:"h-5 text-xs px-2 gap-1",md:"h-6 text-sm px-2.5 gap-1.5",lg:"h-8 text-sm px-3 gap-2"},d={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},q={sm:"w-4 h-4 -ml-1",md:"w-5 h-5 -ml-1.5",lg:"w-6 h-6 -ml-1.5"},A={sm:"w-1.5 h-1.5",md:"w-2 h-2",lg:"w-2.5 h-2.5"},D={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",full:"rounded-full"};function F({label:n,children:m,variant:a="solid",size:r="md",color:i="default",bgColor:g,textColor:c,borderColor:b,rounded:y="full",icon:p,endIcon:u,avatar:s,onClose:k,closable:x=!1,removeLabel:f,clickable:C=!1,selected:w=!1,disabled:o=!1,as:v="span",className:R,onClick:N,...S}){let L=B(),z=v,M=e("inline-flex items-center justify-center font-medium transition-all",U[r],D[y],a==="outlined"&&"border"),P=e(g||c||b?e(g,c,b):O[i][a]),E=w?"ring-2 ring-offset-1 ring-blue-500":"",V=C&&!o?"cursor-pointer hover:opacity-80 active:scale-95":"",W=o?"opacity-50 cursor-not-allowed":"",I=l=>{l.stopPropagation(),k?.()},j=l=>{o||N?.(l)},h=m??n;return G(z,{className:e(M,P,E,V,W,R),onClick:j,"aria-disabled":o,...S,children:[a==="dot"&&t("span",{className:e("rounded-full shrink-0",A[r],T[i]),"aria-hidden":"true"}),s&&t("span",{className:e("rounded-full overflow-hidden shrink-0",q[r]),children:s}),p&&!s&&t("span",{className:e("shrink-0",d[r]),children:p}),h&&t("span",{className:"truncate",children:h}),u&&!x&&t("span",{className:e("shrink-0",d[r]),children:u}),x&&t("button",{type:"button",onClick:I,disabled:o,className:e("shrink-0 rounded-full hover:bg-black/10 dark:hover:bg-white/10 p-0.5 -mr-1 transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-current",o&&"pointer-events-none"),"aria-label":f??L.chipRemove,children:t(H,{className:d[r]})})]})}F.displayName="Chip";export{F as Chip};
1
+ "use client";import{cn as e}from"../../lib/cn.js";import{useUILabels as B}from"../../lib/i18n.js";import{jsx as t,jsxs as G}from"react/jsx-runtime";function H({className:n}){return t("svg",{className:n,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:t("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var O={default:{solid:"bg-gray-500 text-white",outlined:"border-gray-300 text-gray-700 dark:border-gray-600 dark:text-gray-300 bg-transparent",soft:"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300",dot:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300"},primary:{solid:"bg-blue-600 text-white",outlined:"border-blue-600 text-blue-600 dark:border-blue-400 dark:text-blue-400 bg-transparent",soft:"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300",dot:"bg-blue-50 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300"},success:{solid:"bg-green-700 text-white",outlined:"border-green-600 text-green-700 dark:border-green-400 dark:text-green-400 bg-transparent",soft:"bg-green-100 text-green-800 dark:bg-green-900/50 dark:text-green-300",dot:"bg-green-50 text-green-700 dark:bg-green-900/30 dark:text-green-300"},warning:{solid:"bg-yellow-500 text-gray-900",outlined:"border-yellow-500 text-yellow-700 dark:border-yellow-400 dark:text-yellow-400 bg-transparent",soft:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/50 dark:text-yellow-300",dot:"bg-yellow-50 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-300"},error:{solid:"bg-red-600 text-white",outlined:"border-red-600 text-red-600 dark:border-red-400 dark:text-red-400 bg-transparent",soft:"bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300",dot:"bg-red-50 text-red-700 dark:bg-red-900/30 dark:text-red-300"},info:{solid:"bg-cyan-700 text-white",outlined:"border-cyan-600 text-cyan-700 dark:border-cyan-400 dark:text-cyan-400 bg-transparent",soft:"bg-cyan-100 text-cyan-700 dark:bg-cyan-900/50 dark:text-cyan-300",dot:"bg-cyan-50 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-300"}},T={default:"bg-gray-500",primary:"bg-blue-600",success:"bg-green-600",warning:"bg-yellow-500",error:"bg-red-600",info:"bg-cyan-600"},U={sm:"h-5 text-xs px-2 gap-1",md:"h-6 text-sm px-2.5 gap-1.5",lg:"h-8 text-sm px-3 gap-2"},d={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},q={sm:"w-4 h-4 -ml-1",md:"w-5 h-5 -ml-1.5",lg:"w-6 h-6 -ml-1.5"},A={sm:"w-1.5 h-1.5",md:"w-2 h-2",lg:"w-2.5 h-2.5"},D={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",full:"rounded-full"};function F({label:n,children:m,variant:a="solid",size:r="md",color:i="default",bgColor:g,textColor:c,borderColor:b,rounded:y="full",icon:p,endIcon:u,avatar:s,onClose:k,closable:x=!1,removeLabel:f,clickable:C=!1,selected:w=!1,disabled:o=!1,as:v="span",className:R,onClick:N,...S}){let L=B(),z=v,M=e("inline-flex items-center justify-center font-medium transition-all",U[r],D[y],a==="outlined"&&"border"),P=e(g||c||b?e(g,c,b):O[i][a]),E=w?"ring-2 ring-offset-1 ring-blue-500":"",V=C&&!o?"cursor-pointer hover:opacity-80 active:scale-95":"",W=o?"opacity-50 cursor-not-allowed":"",I=l=>{l.stopPropagation(),k?.()},j=l=>{o||N?.(l)},h=m??n;return G(z,{className:e(M,P,E,V,W,R),onClick:j,"aria-disabled":o,...S,children:[a==="dot"&&t("span",{className:e("rounded-full shrink-0",A[r],T[i]),"aria-hidden":"true"}),s&&t("span",{className:e("rounded-full overflow-hidden shrink-0",q[r]),children:s}),p&&!s&&t("span",{className:e("shrink-0",d[r]),children:p}),h&&t("span",{className:"truncate",children:h}),u&&!x&&t("span",{className:e("shrink-0",d[r]),children:u}),x&&t("button",{type:"button",onClick:I,disabled:o,className:e("shrink-0 rounded-full hover:bg-black/10 dark:hover:bg-white/10 p-0.5 -mr-1 transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-current",o&&"pointer-events-none"),"aria-label":f??L.chipRemove,children:t(H,{className:d[r]})})]})}F.displayName="Chip";export{F as Chip};
@@ -1 +1 @@
1
- "use strict";var m=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var M=(e,r)=>{for(var o in r)m(e,o,{get:r[o],enumerable:!0})},V=(e,r,o,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of T(r))!W.call(e,s)&&s!==o&&m(e,s,{get:()=>r[s],enumerable:!(l=S(r,s))||l.enumerable});return e};var $=e=>V(m({},"__esModule",{value:!0}),e);var L={};M(L,{CircularProgress:()=>f});module.exports=$(L);var n=require("../../lib/cn.cjs"),t=require("react/jsx-runtime"),D={default:"stroke-gray-500 dark:stroke-gray-400",primary:"stroke-blue-600 dark:stroke-blue-500",success:"stroke-green-600 dark:stroke-green-500",warning:"stroke-yellow-500 dark:stroke-yellow-400",error:"stroke-red-600 dark:stroke-red-500",info:"stroke-cyan-600 dark:stroke-cyan-500"},O={default:"text-gray-700 dark:text-gray-300",primary:"text-blue-600 dark:text-blue-400",success:"text-green-600 dark:text-green-400",warning:"text-yellow-600 dark:text-yellow-400",error:"text-red-600 dark:text-red-400",info:"text-cyan-600 dark:text-cyan-400"},j={xs:24,sm:32,md:48,lg:64,xl:96},B={xs:"text-[8px]",sm:"text-[10px]",md:"text-sm",lg:"text-base",xl:"text-xl"},I={thin:2,normal:4,thick:8};function f({value:e=0,indeterminate:r=!1,size:o="md",thickness:l="normal",color:s="primary",progressColor:p,trackColor:y,showValue:h=!1,children:C,valueFormat:k,animated:P=!0,className:v,...b}){let i=Math.min(100,Math.max(0,e)),a=j[o],u=I[l],g=(a-u)/2,c=2*Math.PI*g,d=a/2,w=c-i/100*c,N=p||D[s],R=y||"stroke-gray-200 dark:stroke-gray-700",z=O[s],x=C??(h&&!r?(0,t.jsx)("span",{className:(0,n.cn)("font-semibold",B[o],z),children:k?k(i):`${Math.round(i)}%`}):null);return(0,t.jsxs)("div",{className:(0,n.cn)("relative inline-flex items-center justify-center",v),role:"progressbar","aria-valuenow":r?void 0:i,"aria-valuemin":0,"aria-valuemax":100,...b,children:[(0,t.jsxs)("svg",{width:a,height:a,viewBox:`0 0 ${a} ${a}`,className:(0,n.cn)(r&&"animate-spin"),style:{transform:"rotate(-90deg)"},children:[(0,t.jsx)("circle",{cx:d,cy:d,r:g,fill:"none",strokeWidth:u,className:R}),(0,t.jsx)("circle",{cx:d,cy:d,r:g,fill:"none",strokeWidth:u,strokeLinecap:"round",strokeDasharray:c,strokeDashoffset:r?c*.75:w,className:(0,n.cn)(N,P&&!r&&"transition-[stroke-dashoffset] duration-300 ease-out")})]}),x&&(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",style:{transform:"rotate(0deg)"},children:x})]})}f.displayName="CircularProgress";0&&(module.exports={CircularProgress});
1
+ "use strict";var m=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var M=(e,r)=>{for(var o in r)m(e,o,{get:r[o],enumerable:!0})},V=(e,r,o,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of T(r))!W.call(e,s)&&s!==o&&m(e,s,{get:()=>r[s],enumerable:!(l=S(r,s))||l.enumerable});return e};var $=e=>V(m({},"__esModule",{value:!0}),e);var L={};M(L,{CircularProgress:()=>f});module.exports=$(L);var n=require("../../lib/cn.cjs"),t=require("react/jsx-runtime"),D={default:"stroke-gray-500 dark:stroke-gray-400",primary:"stroke-blue-600 dark:stroke-blue-500",success:"stroke-green-600 dark:stroke-green-500",warning:"stroke-yellow-500 dark:stroke-yellow-400",error:"stroke-red-600 dark:stroke-red-500",info:"stroke-cyan-600 dark:stroke-cyan-500"},O={default:"text-gray-700 dark:text-gray-300",primary:"text-blue-600 dark:text-blue-400",success:"text-green-700 dark:text-green-400",warning:"text-yellow-700 dark:text-yellow-400",error:"text-red-600 dark:text-red-400",info:"text-cyan-700 dark:text-cyan-400"},j={xs:24,sm:32,md:48,lg:64,xl:96},B={xs:"text-[8px]",sm:"text-[10px]",md:"text-sm",lg:"text-base",xl:"text-xl"},I={thin:2,normal:4,thick:8};function f({value:e=0,indeterminate:r=!1,size:o="md",thickness:l="normal",color:s="primary",progressColor:p,trackColor:y,showValue:h=!1,children:C,valueFormat:k,animated:P=!0,className:v,...b}){let i=Math.min(100,Math.max(0,e)),a=j[o],u=I[l],g=(a-u)/2,c=2*Math.PI*g,d=a/2,w=c-i/100*c,N=p||D[s],R=y||"stroke-gray-200 dark:stroke-gray-700",z=O[s],x=C??(h&&!r?(0,t.jsx)("span",{className:(0,n.cn)("font-semibold",B[o],z),children:k?k(i):`${Math.round(i)}%`}):null);return(0,t.jsxs)("div",{className:(0,n.cn)("relative inline-flex items-center justify-center",v),role:"progressbar","aria-valuenow":r?void 0:i,"aria-valuemin":0,"aria-valuemax":100,...b,children:[(0,t.jsxs)("svg",{width:a,height:a,viewBox:`0 0 ${a} ${a}`,className:(0,n.cn)(r&&"animate-spin"),style:{transform:"rotate(-90deg)"},children:[(0,t.jsx)("circle",{cx:d,cy:d,r:g,fill:"none",strokeWidth:u,className:R}),(0,t.jsx)("circle",{cx:d,cy:d,r:g,fill:"none",strokeWidth:u,strokeLinecap:"round",strokeDasharray:c,strokeDashoffset:r?c*.75:w,className:(0,n.cn)(N,P&&!r&&"transition-[stroke-dashoffset] duration-300 ease-out")})]}),x&&(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",style:{transform:"rotate(0deg)"},children:x})]})}f.displayName="CircularProgress";0&&(module.exports={CircularProgress});
@@ -1 +1 @@
1
- import{cn as a}from"../../lib/cn.js";import{jsx as n,jsxs as m}from"react/jsx-runtime";var z={default:"stroke-gray-500 dark:stroke-gray-400",primary:"stroke-blue-600 dark:stroke-blue-500",success:"stroke-green-600 dark:stroke-green-500",warning:"stroke-yellow-500 dark:stroke-yellow-400",error:"stroke-red-600 dark:stroke-red-500",info:"stroke-cyan-600 dark:stroke-cyan-500"},S={default:"text-gray-700 dark:text-gray-300",primary:"text-blue-600 dark:text-blue-400",success:"text-green-600 dark:text-green-400",warning:"text-yellow-600 dark:text-yellow-400",error:"text-red-600 dark:text-red-400",info:"text-cyan-600 dark:text-cyan-400"},T={xs:24,sm:32,md:48,lg:64,xl:96},W={xs:"text-[8px]",sm:"text-[10px]",md:"text-sm",lg:"text-base",xl:"text-xl"},M={thin:2,normal:4,thick:8};function V({value:k=0,indeterminate:e=!1,size:c="md",thickness:x="normal",color:d="primary",progressColor:f,trackColor:p,showValue:y=!1,children:h,valueFormat:u,animated:C=!0,className:P,...v}){let s=Math.min(100,Math.max(0,k)),r=T[c],l=M[x],i=(r-l)/2,t=2*Math.PI*i,o=r/2,b=t-s/100*t,w=f||z[d],N=p||"stroke-gray-200 dark:stroke-gray-700",R=S[d],g=h??(y&&!e?n("span",{className:a("font-semibold",W[c],R),children:u?u(s):`${Math.round(s)}%`}):null);return m("div",{className:a("relative inline-flex items-center justify-center",P),role:"progressbar","aria-valuenow":e?void 0:s,"aria-valuemin":0,"aria-valuemax":100,...v,children:[m("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:a(e&&"animate-spin"),style:{transform:"rotate(-90deg)"},children:[n("circle",{cx:o,cy:o,r:i,fill:"none",strokeWidth:l,className:N}),n("circle",{cx:o,cy:o,r:i,fill:"none",strokeWidth:l,strokeLinecap:"round",strokeDasharray:t,strokeDashoffset:e?t*.75:b,className:a(w,C&&!e&&"transition-[stroke-dashoffset] duration-300 ease-out")})]}),g&&n("div",{className:"absolute inset-0 flex items-center justify-center",style:{transform:"rotate(0deg)"},children:g})]})}V.displayName="CircularProgress";export{V as CircularProgress};
1
+ import{cn as a}from"../../lib/cn.js";import{jsx as n,jsxs as m}from"react/jsx-runtime";var z={default:"stroke-gray-500 dark:stroke-gray-400",primary:"stroke-blue-600 dark:stroke-blue-500",success:"stroke-green-600 dark:stroke-green-500",warning:"stroke-yellow-500 dark:stroke-yellow-400",error:"stroke-red-600 dark:stroke-red-500",info:"stroke-cyan-600 dark:stroke-cyan-500"},S={default:"text-gray-700 dark:text-gray-300",primary:"text-blue-600 dark:text-blue-400",success:"text-green-700 dark:text-green-400",warning:"text-yellow-700 dark:text-yellow-400",error:"text-red-600 dark:text-red-400",info:"text-cyan-700 dark:text-cyan-400"},T={xs:24,sm:32,md:48,lg:64,xl:96},W={xs:"text-[8px]",sm:"text-[10px]",md:"text-sm",lg:"text-base",xl:"text-xl"},M={thin:2,normal:4,thick:8};function V({value:k=0,indeterminate:e=!1,size:c="md",thickness:x="normal",color:d="primary",progressColor:f,trackColor:p,showValue:y=!1,children:h,valueFormat:u,animated:C=!0,className:P,...v}){let s=Math.min(100,Math.max(0,k)),r=T[c],l=M[x],i=(r-l)/2,t=2*Math.PI*i,o=r/2,b=t-s/100*t,w=f||z[d],N=p||"stroke-gray-200 dark:stroke-gray-700",R=S[d],g=h??(y&&!e?n("span",{className:a("font-semibold",W[c],R),children:u?u(s):`${Math.round(s)}%`}):null);return m("div",{className:a("relative inline-flex items-center justify-center",P),role:"progressbar","aria-valuenow":e?void 0:s,"aria-valuemin":0,"aria-valuemax":100,...v,children:[m("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:a(e&&"animate-spin"),style:{transform:"rotate(-90deg)"},children:[n("circle",{cx:o,cy:o,r:i,fill:"none",strokeWidth:l,className:N}),n("circle",{cx:o,cy:o,r:i,fill:"none",strokeWidth:l,strokeLinecap:"round",strokeDasharray:t,strokeDashoffset:e?t*.75:b,className:a(w,C&&!e&&"transition-[stroke-dashoffset] duration-300 ease-out")})]}),g&&n("div",{className:"absolute inset-0 flex items-center justify-center",style:{transform:"rotate(0deg)"},children:g})]})}V.displayName="CircularProgress";export{V as CircularProgress};
@@ -1 +1 @@
1
- "use strict";"use client";var xr=Object.create;var Ce=Object.defineProperty;var wr=Object.getOwnPropertyDescriptor;var kr=Object.getOwnPropertyNames;var Cr=Object.getPrototypeOf,Nr=Object.prototype.hasOwnProperty;var Sr=(o,i)=>{for(var d in i)Ce(o,d,{get:i[d],enumerable:!0})},wt=(o,i,d,u)=>{if(i&&typeof i=="object"||typeof i=="function")for(let c of kr(i))!Nr.call(o,c)&&c!==d&&Ce(o,c,{get:()=>i[c],enumerable:!(u=wr(i,c))||u.enumerable});return o};var Rr=(o,i,d)=>(d=o!=null?xr(Cr(o)):{},wt(i||!o||!o.__esModule?Ce(d,"default",{value:o,enumerable:!0}):d,o)),Tr=o=>wt(Ce({},"__esModule",{value:!0}),o);var qr={};Sr(qr,{DataGrid:()=>jr,resetRowKeyWarning:()=>Or});module.exports=Tr(qr);var n=Rr(require("react"),1),f=require("../../lib/cn.cjs"),Nt=require("../../lib/csv.cjs"),D=require("../../lib/i18n.cjs"),t=require("react/jsx-runtime"),k={compact:"px-3 py-1.5",default:"px-4 py-3",comfortable:"px-6 py-4"},Ne={compact:"text-xs",default:"text-sm",comfortable:"text-base"},Dr=()=>(0,t.jsx)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:(0,t.jsx)("path",{d:"M8 3l4 5H4l4-5z"})}),Er=()=>(0,t.jsx)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:(0,t.jsx)("path",{d:"M8 13l4-5H4l4 5z"})}),Gr=()=>(0,t.jsx)("svg",{className:"w-3.5 h-3.5 opacity-30",viewBox:"0 0 16 16",fill:"currentColor",children:(0,t.jsx)("path",{d:"M8 3l3 4H5l3-4zM8 13l3-4H5l3 4z"})}),kt=({className:o})=>(0,t.jsx)("svg",{className:(0,f.cn)("w-4 h-4",o),viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})}),Mr=()=>(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z",clipRule:"evenodd"})}),Fr=()=>(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{d:"M7 4a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3zM7 10.5a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3zM7 17a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3z"})}),Pr=()=>(0,t.jsx)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M2.628 1.601C5.028 1.206 7.49 1 10 1s4.973.206 7.372.601a.75.75 0 01.628.74v2.288a2.25 2.25 0 01-.659 1.59l-4.682 4.683a2.25 2.25 0 00-.659 1.59v3.037c0 .684-.31 1.33-.844 1.757l-1.937 1.55A.75.75 0 018 18.25v-5.757a2.25 2.25 0 00-.659-1.591L2.659 6.22A2.25 2.25 0 012 4.629V2.34a.75.75 0 01.628-.74z",clipRule:"evenodd"})}),zr=()=>(0,t.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:[(0,t.jsx)("path",{d:"M10.75 2.75a.75.75 0 00-1.5 0v8.614L6.295 8.235a.75.75 0 10-1.09 1.03l4.25 4.5a.75.75 0 001.09 0l4.25-4.5a.75.75 0 00-1.09-1.03l-2.955 3.129V2.75z"}),(0,t.jsx)("path",{d:"M3.5 12.75a.75.75 0 00-1.5 0v2.5A2.75 2.75 0 004.75 18h10.5A2.75 2.75 0 0018 15.25v-2.5a.75.75 0 00-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5z"})]}),Ir=()=>(0,t.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M2.5 3A1.5 1.5 0 001 4.5v11A1.5 1.5 0 002.5 17h15a1.5 1.5 0 001.5-1.5v-11A1.5 1.5 0 0017.5 3h-15zM2.5 4.5h6v11h-6v-11zm7.5 0h7.5v11H10v-11z",clipRule:"evenodd"})});function qe(o,i,d){return typeof d=="function"?d(o,i):String(typeof d=="string"?o[d]:i)}var $e=!1;function Or(){$e=!1}function Ar(){$e||($e=!0,console.warn("[@synertech/ui] DataGrid has no `rowKey`: each row is known by its position in `data`. Selection, expansion and edits follow that position when `data` is refetched or reordered, and from one page to the next in server mode. Pass `rowKey` to tie them to the row."))}function F(o,i){return o[i]}function Lr(o,i){return o==null&&i==null?0:o==null?-1:i==null?1:typeof o=="number"&&typeof i=="number"?o-i:String(o).localeCompare(String(i))}function Hr(o,i){let d=String(o??"").toLowerCase(),u=i.value.toLowerCase();switch(i.operator){case"contains":return d.includes(u);case"equals":return d===u;case"startsWith":return d.startsWith(u);case"endsWith":return d.endsWith(u);case"gt":return Number(o)>Number(i.value);case"gte":return Number(o)>=Number(i.value);case"lt":return Number(o)<Number(i.value);case"lte":return Number(o)<=Number(i.value);case"isEmpty":return d==="";case"isNotEmpty":return d!=="";default:return!0}}function Ct(o,i,d){let u=[];for(let c of o){let b=Number(F(c,i));isNaN(b)||u.push(b)}if(u.length===0)return 0;switch(d){case"sum":return u.reduce((c,b)=>c+b,0);case"avg":return u.reduce((c,b)=>c+b,0)/u.length;case"count":return u.length;case"min":return Math.min(...u);case"max":return Math.max(...u)}}function Vr(o,i,d){if(o==="count")return i;let u=o==="avg"?d.dataGridAggregateAvg:o==="sum"?d.dataGridAggregateSum:o==="min"?d.dataGridAggregateMin:d.dataGridAggregateMax;return(0,D.formatUILabel)(u,{value:i})}function Kr({cols:o,density:i}){return(0,t.jsx)("tr",{className:"border-b border-gray-200 dark:border-gray-700",children:Array.from({length:o}).map((d,u)=>(0,t.jsx)("td",{className:k[i],children:(0,t.jsx)("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse"})},u))})}function Wr({column:o,value:i,onApply:d,onClear:u,labels:c}){let b=o.filterType??"text",L=String(o.header),P=b==="number"?[{value:"equals",label:c.dataGridOperatorEquals},{value:"gt",label:c.dataGridOperatorGreaterThan},{value:"gte",label:c.dataGridOperatorGreaterOrEqual},{value:"lt",label:c.dataGridOperatorLessThan},{value:"lte",label:c.dataGridOperatorLessOrEqual}]:[{value:"contains",label:c.dataGridOperatorContains},{value:"equals",label:c.dataGridOperatorEquals},{value:"startsWith",label:c.dataGridOperatorStartsWith},{value:"endsWith",label:c.dataGridOperatorEndsWith},{value:"isEmpty",label:c.dataGridOperatorIsEmpty},{value:"isNotEmpty",label:c.dataGridOperatorIsNotEmpty}],S=g=>g&&P.some(R=>R.value===g.operator)?g.operator:P[0].value,[E,w]=(0,n.useState)(!1),[G,re]=(0,n.useState)(()=>S(i)),[$,H]=(0,n.useState)(i?.value??""),ae=(0,n.useRef)(null),z=()=>{E||(re(S(i)),H(i?.value??"")),w(!E)};return(0,n.useEffect)(()=>{let g=R=>{ae.current&&!ae.current.contains(R.target)&&w(!1)};return E&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[E]),(0,t.jsxs)("div",{className:"relative inline-block",ref:ae,onClick:g=>g.stopPropagation(),children:[(0,t.jsx)("button",{type:"button",onClick:z,className:(0,f.cn)("p-0.5 rounded hover:bg-gray-200 dark:hover:bg-gray-600 cursor-pointer",i&&"text-blue-600 dark:text-blue-400"),"aria-label":(0,D.formatUILabel)(c.dataGridFilterColumn,{column:L}),children:(0,t.jsx)(Pr,{})}),E&&(0,t.jsx)("div",{className:"absolute z-50 top-full left-0 mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg p-3 min-w-[220px]",children:b==="select"&&o.filterOptions?(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[o.filterOptions.map(g=>(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,t.jsx)("input",{type:"radio",name:`filter-${o.key}`,value:g,checked:$===g,onChange:()=>H(g),className:"cursor-pointer"}),(0,t.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:g})]},g)),(0,t.jsxs)("div",{className:"flex gap-2 mt-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{d({column:o.key,operator:"equals",value:$}),w(!1)},className:"px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 cursor-pointer",children:c.dataGridFilterApply}),(0,t.jsx)("button",{type:"button",onClick:()=>{H(""),u(),w(!1)},className:"px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 cursor-pointer",children:c.dataGridFilterClear})]})]}):(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("select",{value:G,onChange:g=>re(g.target.value),className:"text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200",children:P.map(g=>(0,t.jsx)("option",{value:g.value,children:g.label},g.value))}),G!=="isEmpty"&&G!=="isNotEmpty"&&(0,t.jsx)("input",{type:b==="number"?"number":b==="date"?"date":"text",value:$,onChange:g=>H(g.target.value),placeholder:c.dataGridFilterValuePlaceholder,className:"text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200",autoFocus:!0,"aria-label":(0,D.formatUILabel)(c.dataGridFilterValue,{column:L})}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{d({column:o.key,operator:G,value:$}),w(!1)},className:"px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 cursor-pointer",children:c.dataGridFilterApply}),(0,t.jsx)("button",{type:"button",onClick:()=>{H(""),u(),w(!1)},className:"px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 cursor-pointer",children:c.dataGridFilterClear})]})]})})]})}function Br({value:o,onSave:i,density:d,labels:u}){let[c,b]=(0,n.useState)(!1),[L,P]=(0,n.useState)(String(o??"")),S=(0,n.useRef)(null);if((0,n.useEffect)(()=>{c&&S.current&&(S.current.focus(),S.current.select())},[c]),!c)return(0,t.jsx)("div",{onDoubleClick:()=>{P(String(o??"")),b(!0)},className:"cursor-text min-h-[1.5em]",title:u.dataGridEditHint,children:String(o??"")});let E=()=>{b(!1),L!==String(o??"")&&i(L)};return(0,t.jsx)("input",{ref:S,type:"text",value:L,onChange:w=>P(w.target.value),onBlur:E,"aria-label":u.dataGridEditCell,onKeyDown:w=>{w.key==="Enter"&&E(),w.key==="Escape"&&b(!1)},className:(0,f.cn)("w-full border border-blue-500 rounded px-1 py-0.5 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 outline-none",Ne[d])})}function Ur(o,i){let{columns:d,data:u,rowKey:c,mode:b="client",sortable:L=!1,multiSort:P=!1,sort:S,defaultSort:E,onSort:w,pagination:G=!1,page:re,onPageChange:$,onPageSizeChange:H,totalItems:ae,selectable:z=!1,selectionMode:g="multiple",selectedRows:R,onSelectionChange:V,searchable:Xe=!1,searchPlaceholder:St,searchValue:me,onSearch:fe,filters:X,onFilterChange:ne,expandable:oe=!1,expandedContent:_e,expandedRows:Se,onExpandChange:Je,editable:Qe=!1,onCellEdit:Rt,reorderable:se=!1,onReorder:Ye,columnReorderable:K=!1,onColumnReorder:Ze,columnToggle:et=!1,hiddenColumns:Re,onColumnVisibilityChange:tt,groupBy:W,renderGroupHeader:rt,exportable:at=!1,exportFormats:Tt=["csv","json"],exportFilename:nt="export",exportNeutralizeFormulas:ot,virtualized:_=!1,rowHeight:J=40,virtualHeight:Te=400,density:h="default",striped:st=!1,bordered:De=!1,borderless:Dt=!1,stickyHeader:it=!1,maxHeight:he,loading:Et=!1,loadingRows:Gt=5,emptyState:Mt,labels:Ft,showFooter:Pt=!1,onRowClick:Ee,onRowDoubleClick:lt,onRowContextMenu:dt,className:zt,rowClassName:Ge,cellClassName:It,headerClassName:Ot}=o,y=(0,D.useUILabels)(Ft),[At,ct]=(0,n.useState)(E??[]),[Lt,Ht]=(0,n.useState)(1),ie=typeof G=="object"?G.pageSize:void 0,[Vt,ut]=(0,n.useState)(ie??10),[Kt,Wt]=(0,n.useState)(ie);ie!==Kt&&(Wt(ie),ie!==void 0&&ut(ie));let[Bt,ve]=(0,n.useState)([]),[Ut,gt]=(0,n.useState)(""),[jt,Me]=(0,n.useState)([]),[qt,$t]=(0,n.useState)([]),[Xt,_t]=(0,n.useState)(()=>d.flatMap(e=>e.hidden?[e.key]:[])),[Fe,Jt]=(0,n.useState)({}),[xe,Qt]=(0,n.useState)(()=>d.map(e=>e.key)),[Q,Pe]=(0,n.useState)(null),[le,pt]=(0,n.useState)(null),[we,mt]=(0,n.useState)(!1),[Yt,Zt]=(0,n.useState)(new Set),ze=(0,n.useRef)(null),[bt,er]=(0,n.useState)(0),Ie=(0,n.useRef)(null),Oe=(0,n.useRef)(!1),B=S??At,yt=re??Lt,C=R??Bt,ke=me??Ut,U=X??jt,be=Se??qt,Y=Re??Xt,de=G?typeof G=="object"?G:{pageSize:10,pageSizeOptions:[10,25,50,100]}:null,ye=Vt;!c&&(z||oe||Qe||se)&&Ar();let ft=e=>qe(e.row,e.sourceIndex,c),I=(0,n.useMemo)(()=>{let e=new Map(d.map(s=>[s.key,s])),r=xe.flatMap(s=>{let l=e.get(s);return l?[l]:[]}),a=new Set(r.map(s=>s.key));for(let s of d)a.has(s.key)||(r.push(s),a.add(s.key));return r.filter(s=>!Y.includes(s.key))},[d,xe,Y]),Z=(0,n.useMemo)(()=>{let e=u.map((r,a)=>({row:r,sourceIndex:a}));if(b==="server")return e;if(ke){let r=ke.toLowerCase();e=e.filter(({row:a})=>I.some(s=>{let l=F(a,s.key);return String(l??"").toLowerCase().includes(r)}))}if(U.length>0&&(e=e.filter(({row:r})=>U.every(a=>Hr(F(r,a.column),a)))),B.length>0){let r=new Map(d.map(a=>[a.key,a]));e.sort((a,s)=>{for(let l of B){if(!l.direction)continue;let m=r.get(l.key),v=m?.sortComparator?m.sortComparator(a.row,s.row):Lr(F(a.row,l.key),F(s.row,l.key));if(v!==0)return l.direction==="asc"?v:-v}return 0})}return e},[u,b,ke,U,B,I,d]),ce=(0,n.useMemo)(()=>Z.map(e=>e.row),[Z]),ht=(0,n.useMemo)(()=>{if(!W)return null;let e=Array.isArray(W)?W:[W],r=new Map;for(let a of Z){let s=e.map(m=>String(F(a.row,m)??"")).join(" / "),l=r.get(s)??[];l.push(a),r.set(s,l)}return r},[Z,W]),Ae=ae??ce.length,ee=Math.max(1,Math.ceil(Ae/ye)),O=b==="server"&&ae===void 0?yt:Math.min(Math.max(1,yt),ee),vt=de!==null,A=(0,n.useMemo)(()=>{if(!vt||b==="server")return Z;let e=(O-1)*ye;return Z.slice(e,e+ye)},[Z,vt,O,ye,b]),j=(0,n.useMemo)(()=>A.map(e=>e.row),[A]),ue=(0,n.useMemo)(()=>{if(!_)return{start:0,end:j.length};let e=Math.floor(bt/J),r=Math.ceil(Te/J),a=5;return{start:Math.max(0,e-a),end:Math.min(j.length,e+r+a)}},[_,bt,J,Te,j.length]),Le=(0,n.useCallback)(e=>{S||ct(e),w?.(e)},[S,w]),tr=(0,n.useCallback)(e=>{let r=B.find(s=>s.key===e),a;if(!r||!r.direction?a="asc":r.direction==="asc"?a="desc":a=null,P){let s=B.filter(l=>l.key!==e);a&&s.push({key:e,direction:a}),Le(s)}else Le(a?[{key:e,direction:a}]:[])},[B,P,Le]),N=(0,n.useCallback)(e=>{let r=Math.max(1,Math.min(e,ee));re||Ht(r),$?.(r)},[re,$,ee]),rr=(0,n.useCallback)(e=>{ut(e),N(1),H?.(e)},[N,H]),ar=(0,n.useCallback)(e=>{let r;g==="single"?r=C.includes(e)?[]:[e]:r=C.includes(e)?C.filter(a=>a!==e):[...C,e],R||ve(r),V?.(r)},[g,C,R,V]),He=(0,n.useMemo)(()=>new Set(C),[C]),Ve=(0,n.useCallback)(()=>{let e=new Set(C),r=[...C];for(let a of A){let s=qe(a.row,a.sourceIndex,c);e.has(s)||(e.add(s),r.push(s))}R||ve(r),V?.(r)},[A,c,C,R,V]),xt=(0,n.useCallback)(()=>{R||ve([]),V?.([])},[R,V]),nr=(0,n.useCallback)(()=>{let e=new Set(A.map(a=>qe(a.row,a.sourceIndex,c))),r=C.filter(a=>!e.has(a));R||ve(r),V?.(r)},[A,c,C,R,V]),Ke=z?A.map(ft):[],We=Ke.length>0&&Ke.every(e=>He.has(e)),or=!We&&Ke.some(e=>He.has(e)),sr=(0,n.useCallback)(e=>{let r=be.includes(e)?be.filter(a=>a!==e):[...be,e];Se||$t(r),Je?.(r)},[be,Se,Je]),ir=(0,n.useCallback)(e=>{let r=e.target.value;me||gt(r),fe?.(r),N(1)},[me,fe,N]),lr=(0,n.useCallback)(e=>{let r=[...U.filter(a=>a.column!==e.column),e];X||Me(r),ne?.(r),N(1)},[U,X,ne,N]),dr=(0,n.useCallback)(e=>{let r=U.filter(a=>a.column!==e);X||Me(r),ne?.(r),N(1)},[U,X,ne,N]),cr=(0,n.useCallback)(e=>{let r=Y.includes(e)?Y.filter(a=>a!==e):[...Y,e];Re||_t(r),tt?.(r)},[Y,Re,tt]),ur=(0,n.useCallback)((e,r)=>{e.preventDefault(),e.stopPropagation(),Oe.current=!0;let a=e.clientX,s=Fe[r]??e.currentTarget.parentElement?.getBoundingClientRect().width??100,l=d.find(x=>x.key===r),m=l?.minWidth??50,v=l?.maxWidth??1/0,te=x=>{let q=x.clientX-a,M=Math.min(v,Math.max(m,s+q));Jt(pe=>({...pe,[r]:M}))},p=()=>{document.removeEventListener("mousemove",te),document.removeEventListener("mouseup",p),setTimeout(()=>{Oe.current=!1},0)};document.addEventListener("mousemove",te),document.addEventListener("mouseup",p)},[Fe,d]),T=se&&!(b==="client"&&B.some(e=>e.direction)),gr=(0,n.useCallback)((e,r)=>{T&&Pe({key:e,sourceIndex:r})},[T]),pr=(0,n.useCallback)(e=>{!T||Q===null||e.preventDefault()},[T,Q]),mr=(0,n.useCallback)((e,r)=>{!T||Q===null||(Pe(null),Q.key!==e&&Ye?.(Q.sourceIndex,r))},[T,Q,Ye]),br=(0,n.useCallback)(e=>{K&&pt(e)},[K]),yr=(0,n.useCallback)(e=>{if(!K||!le||le===e)return;let r=[...xe],a=r.indexOf(le),s=r.indexOf(e);a===-1||s===-1||(r.splice(a,1),r.splice(s,0,le),Qt(r),Ze?.(le,e),pt(null))},[K,le,xe,Ze]),Be=(0,n.useCallback)(e=>{let r=I.filter(x=>x.type!=="actions"&&x.type!=="selection"&&x.type!=="expand"),a=ce,s,l,m;if(e==="csv")s=(0,Nt.csvDocument)([r.map(x=>String(x.header)),...a.map(x=>r.map(q=>{let M=F(x,q.key);return typeof M=="number"?M:String(M??"")}))],{neutralizeFormulas:ot}),l="text/csv",m="csv";else{let x=a.map(q=>{let M={};for(let pe of r)M[pe.key]=F(q,pe.key);return M});s=JSON.stringify(x,null,2),l="application/json",m="json"}let v=new Blob([s],{type:l}),te=URL.createObjectURL(v),p=document.createElement("a");p.href=te,p.download=`${nt}.${m}`,p.click(),URL.revokeObjectURL(te)},[I,ce,nt,ot]);(0,n.useEffect)(()=>{if(!we)return;let e=r=>{Ie.current&&!Ie.current.contains(r.target)&&mt(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[we]),(0,n.useImperativeHandle)(i,()=>({getVisibleData:()=>j,resetFilters:()=>{X||Me([]),me||gt(""),ne?.([]),fe?.(""),N(1)},resetSort:()=>{S||ct([]),w?.([])},selectAll:Ve,deselectAll:xt,exportData:Be,scrollToRow:e=>{ze.current&&_&&(ze.current.scrollTop=e*J)}}),[j,X,me,S,ne,fe,w,N,Ve,xt,Be,_,J]);let Ue=e=>{let r={},a=Fe[e.key]??e.width;return a&&(r.width=typeof a=="number"?`${a}px`:a,r.minWidth=typeof a=="number"?`${a}px`:a),e.sticky&&(r.position="sticky",r[e.sticky]=0,r.zIndex=10),r},ge=I.length+(z?1:0)+(oe?1:0)+(se?1:0),fr=e=>{let r=L&&e.sortable!==!1&&e.type!=="actions",a=B.find(l=>l.key===e.key),s=e.filterable&&(e.filterType||e.filterOptions);return(0,t.jsxs)("th",{className:(0,f.cn)(k[h],Ne[h],"relative font-semibold text-gray-700 dark:text-gray-300 whitespace-nowrap",e.align==="center"&&"text-center",e.align==="right"&&"text-right",r&&"cursor-pointer select-none hover:bg-gray-100 dark:hover:bg-gray-700",De&&"border border-gray-200 dark:border-gray-700",e.sticky&&"bg-gray-50 dark:bg-gray-800",e.headerClassName,Ot),style:Ue(e),onClick:r?()=>{Oe.current||tr(e.key)}:void 0,draggable:K,onDragStart:K?()=>br(e.key):void 0,onDragOver:K?l=>l.preventDefault():void 0,onDrop:K?()=>yr(e.key):void 0,"aria-sort":a?.direction==="asc"?"ascending":a?.direction==="desc"?"descending":void 0,children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[e.renderHeader?e.renderHeader(e):e.header,r&&(0,t.jsx)("span",{className:"inline-flex ml-1",children:a?.direction==="asc"?(0,t.jsx)(Dr,{}):a?.direction==="desc"?(0,t.jsx)(Er,{}):(0,t.jsx)(Gr,{})}),s&&(0,t.jsx)(Wr,{column:e,value:U.find(l=>l.column===e.key),onApply:lr,onClear:()=>dr(e.key),labels:y})]}),e.resizable!==!1&&(0,t.jsx)("div",{className:"absolute top-0 right-0 w-1 h-full cursor-col-resize hover:bg-blue-500 opacity-0 hover:opacity-100",onMouseDown:l=>ur(l,e.key)})]},e.key)},je=(e,r)=>{let{row:a,sourceIndex:s}=e,l=ft(e),m=He.has(l),v=be.includes(l),te=typeof Ge=="function"?Ge(a,r):Ge;return(0,t.jsxs)(n.default.Fragment,{children:[(0,t.jsxs)("tr",{className:(0,f.cn)("border-b border-gray-200 dark:border-gray-700 transition-colors",st&&r%2===1&&"bg-gray-50/50 dark:bg-gray-800/50",m&&"bg-blue-50 dark:bg-blue-900/20",Ee&&"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700/50",Q?.key===l&&"opacity-50",te),onClick:Ee?()=>Ee(a,r):void 0,onDoubleClick:lt?()=>lt(a,r):void 0,onContextMenu:dt?p=>dt(a,r,p):void 0,draggable:T,onDragStart:T?()=>gr(l,s):void 0,onDragOver:T?pr:void 0,onDrop:T?()=>mr(l,s):void 0,onDragEnd:T?()=>Pe(null):void 0,"data-row-key":l,"aria-selected":z?m:void 0,children:[se&&(0,t.jsx)("td",{className:(0,f.cn)(k[h],T?"cursor-grab active:cursor-grabbing":"cursor-not-allowed opacity-40"),children:(0,t.jsx)(Fr,{})}),z&&(0,t.jsx)("td",{className:(0,f.cn)(k[h],"w-10"),children:(0,t.jsx)("input",{type:"checkbox",checked:m,onChange:()=>ar(l),onClick:p=>p.stopPropagation(),className:"rounded border-gray-300 dark:border-gray-600 cursor-pointer","aria-label":(0,D.formatUILabel)(y.dataGridSelectRow,{row:l})})}),oe&&(0,t.jsx)("td",{className:(0,f.cn)(k[h],"w-10"),children:(0,t.jsx)("button",{type:"button",onClick:p=>{p.stopPropagation(),sr(l)},className:"p-0.5 rounded hover:bg-gray-200 dark:hover:bg-gray-600 cursor-pointer","aria-label":v?y.dataGridCollapseRow:y.dataGridExpandRow,"aria-expanded":v,children:(0,t.jsx)(kt,{className:(0,f.cn)("transition-transform",v&&"rotate-180")})})}),I.map(p=>{let x=F(a,p.key),q=p.colSpan?.(a,r);if(q===0)return null;let M=Qe&&p.editable!==!1&&p.type!=="actions";return(0,t.jsx)("td",{className:(0,f.cn)(k[h],Ne[h],"text-gray-700 dark:text-gray-300",p.align==="center"&&"text-center",p.align==="right"&&"text-right",De&&"border border-gray-200 dark:border-gray-700",p.sticky&&(m?"bg-blue-50 dark:bg-blue-900/20":st&&r%2===1?"bg-gray-50/50 dark:bg-gray-800/50":"bg-white dark:bg-gray-900"),p.cellClassName,It),style:Ue(p),colSpan:q,children:M?(0,t.jsx)(Br,{value:x,onSave:pe=>Rt?.(l,p.key,pe),density:h,labels:y}):p.render?p.render(x,a,r):String(x??"")},p.key)})]}),oe&&v&&_e&&(0,t.jsx)("tr",{className:"bg-gray-50 dark:bg-gray-800/70",children:(0,t.jsx)("td",{colSpan:ge,className:(0,f.cn)(k[h]),children:_e(a,r)})})]},l)},hr=()=>{if(Et)return Array.from({length:Gt}).map((e,r)=>(0,t.jsx)(Kr,{cols:ge,density:h},r));if(j.length===0)return(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:ge,className:(0,f.cn)("text-center text-gray-400 dark:text-gray-500",k[h]),children:Mt??y.dataGridNoData})});if(ht){let e=[],r=0;for(let[a,s]of ht){let l=Yt.has(a);if(e.push((0,t.jsx)("tr",{className:"bg-gray-100 dark:bg-gray-800 font-medium",children:(0,t.jsx)("td",{colSpan:ge,className:(0,f.cn)(k[h],"cursor-pointer"),onClick:()=>{Zt(m=>{let v=new Set(m);return v.has(a)?v.delete(a):v.add(a),v})},children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(kt,{className:(0,f.cn)("transition-transform",l&&"-rotate-90")}),rt?rt(a,F(s[0].row,Array.isArray(W)?W[0]:W),s.map(m=>m.row)):`${a} (${s.length})`]})})},`group-${a}`)),l)r+=s.length;else for(let m=0;m<s.length;m++)e.push(je(s[m],r)),r++}return e}if(_){let e=[];for(let r=ue.start;r<ue.end;r++)e.push(je(A[r],r));return(0,t.jsxs)(t.Fragment,{children:[ue.start>0&&(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:ge,style:{height:ue.start*J,padding:0}})}),e,ue.end<j.length&&(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:ge,style:{height:(j.length-ue.end)*J,padding:0}})})]})}return A.map((e,r)=>je(e,r))},vr=()=>!Pt||!I.some(r=>r.aggregate)?null:(0,t.jsx)("tfoot",{children:(0,t.jsxs)("tr",{className:"bg-gray-50 dark:bg-gray-800 font-semibold border-t-2 border-gray-300 dark:border-gray-600",children:[se&&(0,t.jsx)("td",{className:k[h]}),z&&(0,t.jsx)("td",{className:k[h]}),oe&&(0,t.jsx)("td",{className:k[h]}),I.map(r=>(0,t.jsx)("td",{className:(0,f.cn)(k[h],Ne[h],"text-gray-700 dark:text-gray-300",r.align==="center"&&"text-center",r.align==="right"&&"text-right",De&&"border border-gray-200 dark:border-gray-700"),style:Ue(r),children:r.aggregate?r.renderAggregate?r.renderAggregate(Ct(ce,r.key,r.aggregate),ce):Vr(r.aggregate,Ct(ce,r.key,r.aggregate).toLocaleString(),y):""},r.key))]})});return(0,t.jsxs)("div",{className:(0,f.cn)("flex flex-col gap-3",zt),children:[(Xe||at||et)&&(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 flex-1",children:[Xe&&(0,t.jsxs)("div",{className:"relative flex-1 max-w-xs",children:[(0,t.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:(0,t.jsx)(Mr,{})}),(0,t.jsx)("input",{type:"text",value:ke,onChange:ir,placeholder:St??y.dataGridSearchPlaceholder,className:"w-full pl-9 pr-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500","aria-label":y.dataGridSearch})]}),C.length>0&&(0,t.jsx)("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:(0,D.formatUILabel)(y.dataGridSelectedCount,{count:C.length})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[et&&(0,t.jsxs)("div",{className:"relative",ref:Ie,children:[(0,t.jsx)("button",{type:"button",onClick:()=>mt(!we),className:"p-1.5 rounded-md border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":y.dataGridToggleColumns,title:y.dataGridToggleColumns,children:(0,t.jsx)(Ir,{})}),we&&(0,t.jsx)("div",{className:"absolute z-50 right-0 top-full mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg p-2 min-w-[180px]",children:d.filter(e=>e.type!=="selection"&&e.type!=="expand").map(e=>(0,t.jsxs)("label",{className:"flex items-center gap-2 px-2 py-1.5 text-sm rounded hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",children:[(0,t.jsx)("input",{type:"checkbox",checked:!Y.includes(e.key),onChange:()=>cr(e.key),className:"rounded border-gray-300 dark:border-gray-600 cursor-pointer"}),(0,t.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:String(e.header)})]},e.key))})]}),at&&Tt.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>Be(e),className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",title:(0,D.formatUILabel)(y.dataGridExportAs,{format:e.toUpperCase()}),children:[(0,t.jsx)(zr,{}),e.toUpperCase()]},e))]})]}),(0,t.jsx)("div",{ref:ze,className:(0,f.cn)("overflow-auto rounded-lg",!Dt&&"border border-gray-200 dark:border-gray-700",it&&"relative"),style:he?{maxHeight:typeof he=="number"?`${he}px`:he}:_?{maxHeight:Te,overflow:"auto"}:void 0,onScroll:_?e=>er(e.target.scrollTop):void 0,children:(0,t.jsxs)("table",{className:"w-full text-left",children:[(0,t.jsx)("thead",{className:(0,f.cn)("bg-gray-50 dark:bg-gray-800 text-xs uppercase",it&&"sticky top-0 z-20"),children:(0,t.jsxs)("tr",{children:[se&&(0,t.jsx)("th",{className:(0,f.cn)(k[h],"w-10 font-semibold text-gray-700 dark:text-gray-300")}),z&&(0,t.jsx)("th",{className:(0,f.cn)(k[h],"w-10"),children:g==="multiple"&&(0,t.jsx)("input",{type:"checkbox",checked:We,ref:e=>{e&&(e.indeterminate=or)},onChange:We?nr:Ve,className:"rounded border-gray-300 dark:border-gray-600 cursor-pointer","aria-label":y.dataGridSelectAllRows})}),oe&&(0,t.jsx)("th",{className:(0,f.cn)(k[h],"w-10 font-semibold text-gray-700 dark:text-gray-300")}),I.map(fr)]})}),(0,t.jsx)("tbody",{children:hr()}),vr()]})}),de&&(0,t.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3 text-sm text-gray-600 dark:text-gray-400",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[de.showTotalItems!==!1&&(0,t.jsx)("span",{children:(0,D.formatUILabel)(Ae===1?y.dataGridItemCount:y.dataGridItemsCount,{count:Ae})}),de.showPageSizeSelector!==!1&&de.pageSizeOptions&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{children:y.dataGridRowsPerPage}),(0,t.jsx)("select",{value:ye,onChange:e=>rr(Number(e.target.value)),className:"border border-gray-300 dark:border-gray-600 rounded px-1.5 py-0.5 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 text-sm",children:de.pageSizeOptions.map(e=>(0,t.jsx)("option",{value:e,children:e},e))})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"mr-2",children:(0,D.formatUILabel)(y.dataGridPageOf,{page:O,total:ee})}),(0,t.jsx)("button",{type:"button",onClick:()=>N(1),disabled:O<=1,className:"px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":y.dataGridFirstPage,children:"\xAB\xAB"}),(0,t.jsx)("button",{type:"button",onClick:()=>N(O-1),disabled:O<=1,className:"px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":y.dataGridPreviousPage,children:"\xAB"}),(0,t.jsx)("button",{type:"button",onClick:()=>N(O+1),disabled:O>=ee,className:"px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":y.dataGridNextPage,children:"\xBB"}),(0,t.jsx)("button",{type:"button",onClick:()=>N(ee),disabled:O>=ee,className:"px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":y.dataGridLastPage,children:"\xBB\xBB"})]})]})]})}var jr=(0,n.forwardRef)(Ur);0&&(module.exports={DataGrid,resetRowKeyWarning});
1
+ "use strict";"use client";var xr=Object.create;var Ce=Object.defineProperty;var wr=Object.getOwnPropertyDescriptor;var kr=Object.getOwnPropertyNames;var Cr=Object.getPrototypeOf,Nr=Object.prototype.hasOwnProperty;var Sr=(o,i)=>{for(var d in i)Ce(o,d,{get:i[d],enumerable:!0})},wt=(o,i,d,u)=>{if(i&&typeof i=="object"||typeof i=="function")for(let c of kr(i))!Nr.call(o,c)&&c!==d&&Ce(o,c,{get:()=>i[c],enumerable:!(u=wr(i,c))||u.enumerable});return o};var Rr=(o,i,d)=>(d=o!=null?xr(Cr(o)):{},wt(i||!o||!o.__esModule?Ce(d,"default",{value:o,enumerable:!0}):d,o)),Tr=o=>wt(Ce({},"__esModule",{value:!0}),o);var qr={};Sr(qr,{DataGrid:()=>jr,resetRowKeyWarning:()=>Or});module.exports=Tr(qr);var n=Rr(require("react"),1),f=require("../../lib/cn.cjs"),Nt=require("../../lib/csv.cjs"),D=require("../../lib/i18n.cjs"),t=require("react/jsx-runtime"),k={compact:"px-3 py-1.5",default:"px-4 py-3",comfortable:"px-6 py-4"},Ne={compact:"text-xs",default:"text-sm",comfortable:"text-base"},Dr=()=>(0,t.jsx)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:(0,t.jsx)("path",{d:"M8 3l4 5H4l4-5z"})}),Er=()=>(0,t.jsx)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:(0,t.jsx)("path",{d:"M8 13l4-5H4l4 5z"})}),Gr=()=>(0,t.jsx)("svg",{className:"w-3.5 h-3.5 opacity-30",viewBox:"0 0 16 16",fill:"currentColor",children:(0,t.jsx)("path",{d:"M8 3l3 4H5l3-4zM8 13l3-4H5l3 4z"})}),kt=({className:o})=>(0,t.jsx)("svg",{className:(0,f.cn)("w-4 h-4",o),viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})}),Mr=()=>(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-500 dark:text-gray-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z",clipRule:"evenodd"})}),Fr=()=>(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-500 dark:text-gray-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{d:"M7 4a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3zM7 10.5a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3zM7 17a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3z"})}),Pr=()=>(0,t.jsx)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M2.628 1.601C5.028 1.206 7.49 1 10 1s4.973.206 7.372.601a.75.75 0 01.628.74v2.288a2.25 2.25 0 01-.659 1.59l-4.682 4.683a2.25 2.25 0 00-.659 1.59v3.037c0 .684-.31 1.33-.844 1.757l-1.937 1.55A.75.75 0 018 18.25v-5.757a2.25 2.25 0 00-.659-1.591L2.659 6.22A2.25 2.25 0 012 4.629V2.34a.75.75 0 01.628-.74z",clipRule:"evenodd"})}),zr=()=>(0,t.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:[(0,t.jsx)("path",{d:"M10.75 2.75a.75.75 0 00-1.5 0v8.614L6.295 8.235a.75.75 0 10-1.09 1.03l4.25 4.5a.75.75 0 001.09 0l4.25-4.5a.75.75 0 00-1.09-1.03l-2.955 3.129V2.75z"}),(0,t.jsx)("path",{d:"M3.5 12.75a.75.75 0 00-1.5 0v2.5A2.75 2.75 0 004.75 18h10.5A2.75 2.75 0 0018 15.25v-2.5a.75.75 0 00-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5z"})]}),Ir=()=>(0,t.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M2.5 3A1.5 1.5 0 001 4.5v11A1.5 1.5 0 002.5 17h15a1.5 1.5 0 001.5-1.5v-11A1.5 1.5 0 0017.5 3h-15zM2.5 4.5h6v11h-6v-11zm7.5 0h7.5v11H10v-11z",clipRule:"evenodd"})});function qe(o,i,d){return typeof d=="function"?d(o,i):String(typeof d=="string"?o[d]:i)}var $e=!1;function Or(){$e=!1}function Ar(){$e||($e=!0,console.warn("[@synertech/ui] DataGrid has no `rowKey`: each row is known by its position in `data`. Selection, expansion and edits follow that position when `data` is refetched or reordered, and from one page to the next in server mode. Pass `rowKey` to tie them to the row."))}function F(o,i){return o[i]}function Lr(o,i){return o==null&&i==null?0:o==null?-1:i==null?1:typeof o=="number"&&typeof i=="number"?o-i:String(o).localeCompare(String(i))}function Hr(o,i){let d=String(o??"").toLowerCase(),u=i.value.toLowerCase();switch(i.operator){case"contains":return d.includes(u);case"equals":return d===u;case"startsWith":return d.startsWith(u);case"endsWith":return d.endsWith(u);case"gt":return Number(o)>Number(i.value);case"gte":return Number(o)>=Number(i.value);case"lt":return Number(o)<Number(i.value);case"lte":return Number(o)<=Number(i.value);case"isEmpty":return d==="";case"isNotEmpty":return d!=="";default:return!0}}function Ct(o,i,d){let u=[];for(let c of o){let b=Number(F(c,i));isNaN(b)||u.push(b)}if(u.length===0)return 0;switch(d){case"sum":return u.reduce((c,b)=>c+b,0);case"avg":return u.reduce((c,b)=>c+b,0)/u.length;case"count":return u.length;case"min":return Math.min(...u);case"max":return Math.max(...u)}}function Vr(o,i,d){if(o==="count")return i;let u=o==="avg"?d.dataGridAggregateAvg:o==="sum"?d.dataGridAggregateSum:o==="min"?d.dataGridAggregateMin:d.dataGridAggregateMax;return(0,D.formatUILabel)(u,{value:i})}function Kr({cols:o,density:i}){return(0,t.jsx)("tr",{className:"border-b border-gray-200 dark:border-gray-700",children:Array.from({length:o}).map((d,u)=>(0,t.jsx)("td",{className:k[i],children:(0,t.jsx)("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse"})},u))})}function Wr({column:o,value:i,onApply:d,onClear:u,labels:c}){let b=o.filterType??"text",L=String(o.header),P=b==="number"?[{value:"equals",label:c.dataGridOperatorEquals},{value:"gt",label:c.dataGridOperatorGreaterThan},{value:"gte",label:c.dataGridOperatorGreaterOrEqual},{value:"lt",label:c.dataGridOperatorLessThan},{value:"lte",label:c.dataGridOperatorLessOrEqual}]:[{value:"contains",label:c.dataGridOperatorContains},{value:"equals",label:c.dataGridOperatorEquals},{value:"startsWith",label:c.dataGridOperatorStartsWith},{value:"endsWith",label:c.dataGridOperatorEndsWith},{value:"isEmpty",label:c.dataGridOperatorIsEmpty},{value:"isNotEmpty",label:c.dataGridOperatorIsNotEmpty}],S=g=>g&&P.some(R=>R.value===g.operator)?g.operator:P[0].value,[E,w]=(0,n.useState)(!1),[G,re]=(0,n.useState)(()=>S(i)),[$,H]=(0,n.useState)(i?.value??""),ae=(0,n.useRef)(null),z=()=>{E||(re(S(i)),H(i?.value??"")),w(!E)};return(0,n.useEffect)(()=>{let g=R=>{ae.current&&!ae.current.contains(R.target)&&w(!1)};return E&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[E]),(0,t.jsxs)("div",{className:"relative inline-block",ref:ae,onClick:g=>g.stopPropagation(),children:[(0,t.jsx)("button",{type:"button",onClick:z,className:(0,f.cn)("p-0.5 rounded hover:bg-gray-200 dark:hover:bg-gray-600 cursor-pointer",i&&"text-blue-600 dark:text-blue-400"),"aria-label":(0,D.formatUILabel)(c.dataGridFilterColumn,{column:L}),children:(0,t.jsx)(Pr,{})}),E&&(0,t.jsx)("div",{className:"absolute z-50 top-full left-0 mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg p-3 min-w-[220px]",children:b==="select"&&o.filterOptions?(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[o.filterOptions.map(g=>(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,t.jsx)("input",{type:"radio",name:`filter-${o.key}`,value:g,checked:$===g,onChange:()=>H(g),className:"cursor-pointer"}),(0,t.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:g})]},g)),(0,t.jsxs)("div",{className:"flex gap-2 mt-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{d({column:o.key,operator:"equals",value:$}),w(!1)},className:"px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 cursor-pointer",children:c.dataGridFilterApply}),(0,t.jsx)("button",{type:"button",onClick:()=>{H(""),u(),w(!1)},className:"px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 cursor-pointer",children:c.dataGridFilterClear})]})]}):(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("select",{value:G,onChange:g=>re(g.target.value),className:"text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200",children:P.map(g=>(0,t.jsx)("option",{value:g.value,children:g.label},g.value))}),G!=="isEmpty"&&G!=="isNotEmpty"&&(0,t.jsx)("input",{type:b==="number"?"number":b==="date"?"date":"text",value:$,onChange:g=>H(g.target.value),placeholder:c.dataGridFilterValuePlaceholder,className:"text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200",autoFocus:!0,"aria-label":(0,D.formatUILabel)(c.dataGridFilterValue,{column:L})}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{d({column:o.key,operator:G,value:$}),w(!1)},className:"px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 cursor-pointer",children:c.dataGridFilterApply}),(0,t.jsx)("button",{type:"button",onClick:()=>{H(""),u(),w(!1)},className:"px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 cursor-pointer",children:c.dataGridFilterClear})]})]})})]})}function Br({value:o,onSave:i,density:d,labels:u}){let[c,b]=(0,n.useState)(!1),[L,P]=(0,n.useState)(String(o??"")),S=(0,n.useRef)(null);if((0,n.useEffect)(()=>{c&&S.current&&(S.current.focus(),S.current.select())},[c]),!c)return(0,t.jsx)("div",{onDoubleClick:()=>{P(String(o??"")),b(!0)},className:"cursor-text min-h-[1.5em]",title:u.dataGridEditHint,children:String(o??"")});let E=()=>{b(!1),L!==String(o??"")&&i(L)};return(0,t.jsx)("input",{ref:S,type:"text",value:L,onChange:w=>P(w.target.value),onBlur:E,"aria-label":u.dataGridEditCell,onKeyDown:w=>{w.key==="Enter"&&E(),w.key==="Escape"&&b(!1)},className:(0,f.cn)("w-full border border-blue-500 rounded px-1 py-0.5 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 outline-none",Ne[d])})}function Ur(o,i){let{columns:d,data:u,rowKey:c,mode:b="client",sortable:L=!1,multiSort:P=!1,sort:S,defaultSort:E,onSort:w,pagination:G=!1,page:re,onPageChange:$,onPageSizeChange:H,totalItems:ae,selectable:z=!1,selectionMode:g="multiple",selectedRows:R,onSelectionChange:V,searchable:Xe=!1,searchPlaceholder:St,searchValue:me,onSearch:fe,filters:X,onFilterChange:ne,expandable:oe=!1,expandedContent:_e,expandedRows:Se,onExpandChange:Je,editable:Qe=!1,onCellEdit:Rt,reorderable:se=!1,onReorder:Ye,columnReorderable:K=!1,onColumnReorder:Ze,columnToggle:et=!1,hiddenColumns:Re,onColumnVisibilityChange:tt,groupBy:W,renderGroupHeader:rt,exportable:at=!1,exportFormats:Tt=["csv","json"],exportFilename:nt="export",exportNeutralizeFormulas:ot,virtualized:_=!1,rowHeight:J=40,virtualHeight:Te=400,density:h="default",striped:st=!1,bordered:De=!1,borderless:Dt=!1,stickyHeader:it=!1,maxHeight:he,loading:Et=!1,loadingRows:Gt=5,emptyState:Mt,labels:Ft,showFooter:Pt=!1,onRowClick:Ee,onRowDoubleClick:lt,onRowContextMenu:dt,className:zt,rowClassName:Ge,cellClassName:It,headerClassName:Ot}=o,y=(0,D.useUILabels)(Ft),[At,ct]=(0,n.useState)(E??[]),[Lt,Ht]=(0,n.useState)(1),ie=typeof G=="object"?G.pageSize:void 0,[Vt,ut]=(0,n.useState)(ie??10),[Kt,Wt]=(0,n.useState)(ie);ie!==Kt&&(Wt(ie),ie!==void 0&&ut(ie));let[Bt,ve]=(0,n.useState)([]),[Ut,gt]=(0,n.useState)(""),[jt,Me]=(0,n.useState)([]),[qt,$t]=(0,n.useState)([]),[Xt,_t]=(0,n.useState)(()=>d.flatMap(e=>e.hidden?[e.key]:[])),[Fe,Jt]=(0,n.useState)({}),[xe,Qt]=(0,n.useState)(()=>d.map(e=>e.key)),[Q,Pe]=(0,n.useState)(null),[le,pt]=(0,n.useState)(null),[we,mt]=(0,n.useState)(!1),[Yt,Zt]=(0,n.useState)(new Set),ze=(0,n.useRef)(null),[bt,er]=(0,n.useState)(0),Ie=(0,n.useRef)(null),Oe=(0,n.useRef)(!1),B=S??At,yt=re??Lt,C=R??Bt,ke=me??Ut,U=X??jt,be=Se??qt,Y=Re??Xt,de=G?typeof G=="object"?G:{pageSize:10,pageSizeOptions:[10,25,50,100]}:null,ye=Vt;!c&&(z||oe||Qe||se)&&Ar();let ft=e=>qe(e.row,e.sourceIndex,c),I=(0,n.useMemo)(()=>{let e=new Map(d.map(s=>[s.key,s])),r=xe.flatMap(s=>{let l=e.get(s);return l?[l]:[]}),a=new Set(r.map(s=>s.key));for(let s of d)a.has(s.key)||(r.push(s),a.add(s.key));return r.filter(s=>!Y.includes(s.key))},[d,xe,Y]),Z=(0,n.useMemo)(()=>{let e=u.map((r,a)=>({row:r,sourceIndex:a}));if(b==="server")return e;if(ke){let r=ke.toLowerCase();e=e.filter(({row:a})=>I.some(s=>{let l=F(a,s.key);return String(l??"").toLowerCase().includes(r)}))}if(U.length>0&&(e=e.filter(({row:r})=>U.every(a=>Hr(F(r,a.column),a)))),B.length>0){let r=new Map(d.map(a=>[a.key,a]));e.sort((a,s)=>{for(let l of B){if(!l.direction)continue;let m=r.get(l.key),v=m?.sortComparator?m.sortComparator(a.row,s.row):Lr(F(a.row,l.key),F(s.row,l.key));if(v!==0)return l.direction==="asc"?v:-v}return 0})}return e},[u,b,ke,U,B,I,d]),ce=(0,n.useMemo)(()=>Z.map(e=>e.row),[Z]),ht=(0,n.useMemo)(()=>{if(!W)return null;let e=Array.isArray(W)?W:[W],r=new Map;for(let a of Z){let s=e.map(m=>String(F(a.row,m)??"")).join(" / "),l=r.get(s)??[];l.push(a),r.set(s,l)}return r},[Z,W]),Ae=ae??ce.length,ee=Math.max(1,Math.ceil(Ae/ye)),O=b==="server"&&ae===void 0?yt:Math.min(Math.max(1,yt),ee),vt=de!==null,A=(0,n.useMemo)(()=>{if(!vt||b==="server")return Z;let e=(O-1)*ye;return Z.slice(e,e+ye)},[Z,vt,O,ye,b]),j=(0,n.useMemo)(()=>A.map(e=>e.row),[A]),ue=(0,n.useMemo)(()=>{if(!_)return{start:0,end:j.length};let e=Math.floor(bt/J),r=Math.ceil(Te/J),a=5;return{start:Math.max(0,e-a),end:Math.min(j.length,e+r+a)}},[_,bt,J,Te,j.length]),Le=(0,n.useCallback)(e=>{S||ct(e),w?.(e)},[S,w]),tr=(0,n.useCallback)(e=>{let r=B.find(s=>s.key===e),a;if(!r||!r.direction?a="asc":r.direction==="asc"?a="desc":a=null,P){let s=B.filter(l=>l.key!==e);a&&s.push({key:e,direction:a}),Le(s)}else Le(a?[{key:e,direction:a}]:[])},[B,P,Le]),N=(0,n.useCallback)(e=>{let r=Math.max(1,Math.min(e,ee));re||Ht(r),$?.(r)},[re,$,ee]),rr=(0,n.useCallback)(e=>{ut(e),N(1),H?.(e)},[N,H]),ar=(0,n.useCallback)(e=>{let r;g==="single"?r=C.includes(e)?[]:[e]:r=C.includes(e)?C.filter(a=>a!==e):[...C,e],R||ve(r),V?.(r)},[g,C,R,V]),He=(0,n.useMemo)(()=>new Set(C),[C]),Ve=(0,n.useCallback)(()=>{let e=new Set(C),r=[...C];for(let a of A){let s=qe(a.row,a.sourceIndex,c);e.has(s)||(e.add(s),r.push(s))}R||ve(r),V?.(r)},[A,c,C,R,V]),xt=(0,n.useCallback)(()=>{R||ve([]),V?.([])},[R,V]),nr=(0,n.useCallback)(()=>{let e=new Set(A.map(a=>qe(a.row,a.sourceIndex,c))),r=C.filter(a=>!e.has(a));R||ve(r),V?.(r)},[A,c,C,R,V]),Ke=z?A.map(ft):[],We=Ke.length>0&&Ke.every(e=>He.has(e)),or=!We&&Ke.some(e=>He.has(e)),sr=(0,n.useCallback)(e=>{let r=be.includes(e)?be.filter(a=>a!==e):[...be,e];Se||$t(r),Je?.(r)},[be,Se,Je]),ir=(0,n.useCallback)(e=>{let r=e.target.value;me||gt(r),fe?.(r),N(1)},[me,fe,N]),lr=(0,n.useCallback)(e=>{let r=[...U.filter(a=>a.column!==e.column),e];X||Me(r),ne?.(r),N(1)},[U,X,ne,N]),dr=(0,n.useCallback)(e=>{let r=U.filter(a=>a.column!==e);X||Me(r),ne?.(r),N(1)},[U,X,ne,N]),cr=(0,n.useCallback)(e=>{let r=Y.includes(e)?Y.filter(a=>a!==e):[...Y,e];Re||_t(r),tt?.(r)},[Y,Re,tt]),ur=(0,n.useCallback)((e,r)=>{e.preventDefault(),e.stopPropagation(),Oe.current=!0;let a=e.clientX,s=Fe[r]??e.currentTarget.parentElement?.getBoundingClientRect().width??100,l=d.find(x=>x.key===r),m=l?.minWidth??50,v=l?.maxWidth??1/0,te=x=>{let q=x.clientX-a,M=Math.min(v,Math.max(m,s+q));Jt(pe=>({...pe,[r]:M}))},p=()=>{document.removeEventListener("mousemove",te),document.removeEventListener("mouseup",p),setTimeout(()=>{Oe.current=!1},0)};document.addEventListener("mousemove",te),document.addEventListener("mouseup",p)},[Fe,d]),T=se&&!(b==="client"&&B.some(e=>e.direction)),gr=(0,n.useCallback)((e,r)=>{T&&Pe({key:e,sourceIndex:r})},[T]),pr=(0,n.useCallback)(e=>{!T||Q===null||e.preventDefault()},[T,Q]),mr=(0,n.useCallback)((e,r)=>{!T||Q===null||(Pe(null),Q.key!==e&&Ye?.(Q.sourceIndex,r))},[T,Q,Ye]),br=(0,n.useCallback)(e=>{K&&pt(e)},[K]),yr=(0,n.useCallback)(e=>{if(!K||!le||le===e)return;let r=[...xe],a=r.indexOf(le),s=r.indexOf(e);a===-1||s===-1||(r.splice(a,1),r.splice(s,0,le),Qt(r),Ze?.(le,e),pt(null))},[K,le,xe,Ze]),Be=(0,n.useCallback)(e=>{let r=I.filter(x=>x.type!=="actions"&&x.type!=="selection"&&x.type!=="expand"),a=ce,s,l,m;if(e==="csv")s=(0,Nt.csvDocument)([r.map(x=>String(x.header)),...a.map(x=>r.map(q=>{let M=F(x,q.key);return typeof M=="number"?M:String(M??"")}))],{neutralizeFormulas:ot}),l="text/csv",m="csv";else{let x=a.map(q=>{let M={};for(let pe of r)M[pe.key]=F(q,pe.key);return M});s=JSON.stringify(x,null,2),l="application/json",m="json"}let v=new Blob([s],{type:l}),te=URL.createObjectURL(v),p=document.createElement("a");p.href=te,p.download=`${nt}.${m}`,p.click(),URL.revokeObjectURL(te)},[I,ce,nt,ot]);(0,n.useEffect)(()=>{if(!we)return;let e=r=>{Ie.current&&!Ie.current.contains(r.target)&&mt(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[we]),(0,n.useImperativeHandle)(i,()=>({getVisibleData:()=>j,resetFilters:()=>{X||Me([]),me||gt(""),ne?.([]),fe?.(""),N(1)},resetSort:()=>{S||ct([]),w?.([])},selectAll:Ve,deselectAll:xt,exportData:Be,scrollToRow:e=>{ze.current&&_&&(ze.current.scrollTop=e*J)}}),[j,X,me,S,ne,fe,w,N,Ve,xt,Be,_,J]);let Ue=e=>{let r={},a=Fe[e.key]??e.width;return a&&(r.width=typeof a=="number"?`${a}px`:a,r.minWidth=typeof a=="number"?`${a}px`:a),e.sticky&&(r.position="sticky",r[e.sticky]=0,r.zIndex=10),r},ge=I.length+(z?1:0)+(oe?1:0)+(se?1:0),fr=e=>{let r=L&&e.sortable!==!1&&e.type!=="actions",a=B.find(l=>l.key===e.key),s=e.filterable&&(e.filterType||e.filterOptions);return(0,t.jsxs)("th",{className:(0,f.cn)(k[h],Ne[h],"relative font-semibold text-gray-700 dark:text-gray-300 whitespace-nowrap",e.align==="center"&&"text-center",e.align==="right"&&"text-right",r&&"cursor-pointer select-none hover:bg-gray-100 dark:hover:bg-gray-700",De&&"border border-gray-200 dark:border-gray-700",e.sticky&&"bg-gray-50 dark:bg-gray-800",e.headerClassName,Ot),style:Ue(e),onClick:r?()=>{Oe.current||tr(e.key)}:void 0,draggable:K,onDragStart:K?()=>br(e.key):void 0,onDragOver:K?l=>l.preventDefault():void 0,onDrop:K?()=>yr(e.key):void 0,"aria-sort":a?.direction==="asc"?"ascending":a?.direction==="desc"?"descending":void 0,children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[e.renderHeader?e.renderHeader(e):e.header,r&&(0,t.jsx)("span",{className:"inline-flex ml-1",children:a?.direction==="asc"?(0,t.jsx)(Dr,{}):a?.direction==="desc"?(0,t.jsx)(Er,{}):(0,t.jsx)(Gr,{})}),s&&(0,t.jsx)(Wr,{column:e,value:U.find(l=>l.column===e.key),onApply:lr,onClear:()=>dr(e.key),labels:y})]}),e.resizable!==!1&&(0,t.jsx)("div",{className:"absolute top-0 right-0 w-1 h-full cursor-col-resize hover:bg-blue-500 opacity-0 hover:opacity-100",onMouseDown:l=>ur(l,e.key)})]},e.key)},je=(e,r)=>{let{row:a,sourceIndex:s}=e,l=ft(e),m=He.has(l),v=be.includes(l),te=typeof Ge=="function"?Ge(a,r):Ge;return(0,t.jsxs)(n.default.Fragment,{children:[(0,t.jsxs)("tr",{className:(0,f.cn)("border-b border-gray-200 dark:border-gray-700 transition-colors",st&&r%2===1&&"bg-gray-50/50 dark:bg-gray-800/50",m&&"bg-blue-50 dark:bg-blue-900/20",Ee&&"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700/50",Q?.key===l&&"opacity-50",te),onClick:Ee?()=>Ee(a,r):void 0,onDoubleClick:lt?()=>lt(a,r):void 0,onContextMenu:dt?p=>dt(a,r,p):void 0,draggable:T,onDragStart:T?()=>gr(l,s):void 0,onDragOver:T?pr:void 0,onDrop:T?()=>mr(l,s):void 0,onDragEnd:T?()=>Pe(null):void 0,"data-row-key":l,"aria-selected":z?m:void 0,children:[se&&(0,t.jsx)("td",{className:(0,f.cn)(k[h],T?"cursor-grab active:cursor-grabbing":"cursor-not-allowed opacity-40"),children:(0,t.jsx)(Fr,{})}),z&&(0,t.jsx)("td",{className:(0,f.cn)(k[h],"w-10"),children:(0,t.jsx)("input",{type:"checkbox",checked:m,onChange:()=>ar(l),onClick:p=>p.stopPropagation(),className:"rounded border-gray-300 dark:border-gray-600 cursor-pointer","aria-label":(0,D.formatUILabel)(y.dataGridSelectRow,{row:l})})}),oe&&(0,t.jsx)("td",{className:(0,f.cn)(k[h],"w-10"),children:(0,t.jsx)("button",{type:"button",onClick:p=>{p.stopPropagation(),sr(l)},className:"p-0.5 rounded hover:bg-gray-200 dark:hover:bg-gray-600 cursor-pointer","aria-label":v?y.dataGridCollapseRow:y.dataGridExpandRow,"aria-expanded":v,children:(0,t.jsx)(kt,{className:(0,f.cn)("transition-transform",v&&"rotate-180")})})}),I.map(p=>{let x=F(a,p.key),q=p.colSpan?.(a,r);if(q===0)return null;let M=Qe&&p.editable!==!1&&p.type!=="actions";return(0,t.jsx)("td",{className:(0,f.cn)(k[h],Ne[h],"text-gray-700 dark:text-gray-300",p.align==="center"&&"text-center",p.align==="right"&&"text-right",De&&"border border-gray-200 dark:border-gray-700",p.sticky&&(m?"bg-blue-50 dark:bg-blue-900/20":st&&r%2===1?"bg-gray-50/50 dark:bg-gray-800/50":"bg-white dark:bg-gray-900"),p.cellClassName,It),style:Ue(p),colSpan:q,children:M?(0,t.jsx)(Br,{value:x,onSave:pe=>Rt?.(l,p.key,pe),density:h,labels:y}):p.render?p.render(x,a,r):String(x??"")},p.key)})]}),oe&&v&&_e&&(0,t.jsx)("tr",{className:"bg-gray-50 dark:bg-gray-800/70",children:(0,t.jsx)("td",{colSpan:ge,className:(0,f.cn)(k[h]),children:_e(a,r)})})]},l)},hr=()=>{if(Et)return Array.from({length:Gt}).map((e,r)=>(0,t.jsx)(Kr,{cols:ge,density:h},r));if(j.length===0)return(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:ge,className:(0,f.cn)("text-center text-gray-500 dark:text-gray-400",k[h]),children:Mt??y.dataGridNoData})});if(ht){let e=[],r=0;for(let[a,s]of ht){let l=Yt.has(a);if(e.push((0,t.jsx)("tr",{className:"bg-gray-100 dark:bg-gray-800 font-medium",children:(0,t.jsx)("td",{colSpan:ge,className:(0,f.cn)(k[h],"cursor-pointer"),onClick:()=>{Zt(m=>{let v=new Set(m);return v.has(a)?v.delete(a):v.add(a),v})},children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(kt,{className:(0,f.cn)("transition-transform",l&&"-rotate-90")}),rt?rt(a,F(s[0].row,Array.isArray(W)?W[0]:W),s.map(m=>m.row)):`${a} (${s.length})`]})})},`group-${a}`)),l)r+=s.length;else for(let m=0;m<s.length;m++)e.push(je(s[m],r)),r++}return e}if(_){let e=[];for(let r=ue.start;r<ue.end;r++)e.push(je(A[r],r));return(0,t.jsxs)(t.Fragment,{children:[ue.start>0&&(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:ge,style:{height:ue.start*J,padding:0}})}),e,ue.end<j.length&&(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:ge,style:{height:(j.length-ue.end)*J,padding:0}})})]})}return A.map((e,r)=>je(e,r))},vr=()=>!Pt||!I.some(r=>r.aggregate)?null:(0,t.jsx)("tfoot",{children:(0,t.jsxs)("tr",{className:"bg-gray-50 dark:bg-gray-800 font-semibold border-t-2 border-gray-300 dark:border-gray-600",children:[se&&(0,t.jsx)("td",{className:k[h]}),z&&(0,t.jsx)("td",{className:k[h]}),oe&&(0,t.jsx)("td",{className:k[h]}),I.map(r=>(0,t.jsx)("td",{className:(0,f.cn)(k[h],Ne[h],"text-gray-700 dark:text-gray-300",r.align==="center"&&"text-center",r.align==="right"&&"text-right",De&&"border border-gray-200 dark:border-gray-700"),style:Ue(r),children:r.aggregate?r.renderAggregate?r.renderAggregate(Ct(ce,r.key,r.aggregate),ce):Vr(r.aggregate,Ct(ce,r.key,r.aggregate).toLocaleString(),y):""},r.key))]})});return(0,t.jsxs)("div",{className:(0,f.cn)("flex flex-col gap-3",zt),children:[(Xe||at||et)&&(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 flex-1",children:[Xe&&(0,t.jsxs)("div",{className:"relative flex-1 max-w-xs",children:[(0,t.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:(0,t.jsx)(Mr,{})}),(0,t.jsx)("input",{type:"text",value:ke,onChange:ir,placeholder:St??y.dataGridSearchPlaceholder,className:"w-full pl-9 pr-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500","aria-label":y.dataGridSearch})]}),C.length>0&&(0,t.jsx)("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:(0,D.formatUILabel)(y.dataGridSelectedCount,{count:C.length})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[et&&(0,t.jsxs)("div",{className:"relative",ref:Ie,children:[(0,t.jsx)("button",{type:"button",onClick:()=>mt(!we),className:"p-1.5 rounded-md border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":y.dataGridToggleColumns,title:y.dataGridToggleColumns,children:(0,t.jsx)(Ir,{})}),we&&(0,t.jsx)("div",{className:"absolute z-50 right-0 top-full mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg p-2 min-w-[180px]",children:d.filter(e=>e.type!=="selection"&&e.type!=="expand").map(e=>(0,t.jsxs)("label",{className:"flex items-center gap-2 px-2 py-1.5 text-sm rounded hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",children:[(0,t.jsx)("input",{type:"checkbox",checked:!Y.includes(e.key),onChange:()=>cr(e.key),className:"rounded border-gray-300 dark:border-gray-600 cursor-pointer"}),(0,t.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:String(e.header)})]},e.key))})]}),at&&Tt.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>Be(e),className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",title:(0,D.formatUILabel)(y.dataGridExportAs,{format:e.toUpperCase()}),children:[(0,t.jsx)(zr,{}),e.toUpperCase()]},e))]})]}),(0,t.jsx)("div",{ref:ze,className:(0,f.cn)("overflow-auto rounded-lg",!Dt&&"border border-gray-200 dark:border-gray-700",it&&"relative"),style:he?{maxHeight:typeof he=="number"?`${he}px`:he}:_?{maxHeight:Te,overflow:"auto"}:void 0,onScroll:_?e=>er(e.target.scrollTop):void 0,children:(0,t.jsxs)("table",{className:"w-full text-left",children:[(0,t.jsx)("thead",{className:(0,f.cn)("bg-gray-50 dark:bg-gray-800 text-xs uppercase",it&&"sticky top-0 z-20"),children:(0,t.jsxs)("tr",{children:[se&&(0,t.jsx)("th",{className:(0,f.cn)(k[h],"w-10 font-semibold text-gray-700 dark:text-gray-300")}),z&&(0,t.jsx)("th",{className:(0,f.cn)(k[h],"w-10"),children:g==="multiple"&&(0,t.jsx)("input",{type:"checkbox",checked:We,ref:e=>{e&&(e.indeterminate=or)},onChange:We?nr:Ve,className:"rounded border-gray-300 dark:border-gray-600 cursor-pointer","aria-label":y.dataGridSelectAllRows})}),oe&&(0,t.jsx)("th",{className:(0,f.cn)(k[h],"w-10 font-semibold text-gray-700 dark:text-gray-300")}),I.map(fr)]})}),(0,t.jsx)("tbody",{children:hr()}),vr()]})}),de&&(0,t.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3 text-sm text-gray-600 dark:text-gray-400",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[de.showTotalItems!==!1&&(0,t.jsx)("span",{children:(0,D.formatUILabel)(Ae===1?y.dataGridItemCount:y.dataGridItemsCount,{count:Ae})}),de.showPageSizeSelector!==!1&&de.pageSizeOptions&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{children:y.dataGridRowsPerPage}),(0,t.jsx)("select",{value:ye,onChange:e=>rr(Number(e.target.value)),className:"border border-gray-300 dark:border-gray-600 rounded px-1.5 py-0.5 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 text-sm",children:de.pageSizeOptions.map(e=>(0,t.jsx)("option",{value:e,children:e},e))})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"mr-2",children:(0,D.formatUILabel)(y.dataGridPageOf,{page:O,total:ee})}),(0,t.jsx)("button",{type:"button",onClick:()=>N(1),disabled:O<=1,className:"px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":y.dataGridFirstPage,children:"\xAB\xAB"}),(0,t.jsx)("button",{type:"button",onClick:()=>N(O-1),disabled:O<=1,className:"px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":y.dataGridPreviousPage,children:"\xAB"}),(0,t.jsx)("button",{type:"button",onClick:()=>N(O+1),disabled:O>=ee,className:"px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":y.dataGridNextPage,children:"\xBB"}),(0,t.jsx)("button",{type:"button",onClick:()=>N(ee),disabled:O>=ee,className:"px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":y.dataGridLastPage,children:"\xBB\xBB"})]})]})]})}var jr=(0,n.forwardRef)(Ur);0&&(module.exports={DataGrid,resetRowKeyWarning});
@@ -1 +1 @@
1
- "use client";import kr,{useState as h,useRef as xe,useCallback as x,useEffect as Qe,useMemo as X,forwardRef as Cr,useImperativeHandle as Nr}from"react";import{cn as f}from"../../lib/cn.js";import{csvDocument as Sr}from"../../lib/csv.js";import{formatUILabel as _,useUILabels as Rr}from"../../lib/i18n.js";import{Fragment as Br,jsx as r,jsxs as c}from"react/jsx-runtime";var N={compact:"px-3 py-1.5",default:"px-4 py-3",comfortable:"px-6 py-4"},Te={compact:"text-xs",default:"text-sm",comfortable:"text-base"},Tr=()=>r("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:r("path",{d:"M8 3l4 5H4l4-5z"})}),Dr=()=>r("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:r("path",{d:"M8 13l4-5H4l4 5z"})}),Er=()=>r("svg",{className:"w-3.5 h-3.5 opacity-30",viewBox:"0 0 16 16",fill:"currentColor",children:r("path",{d:"M8 3l3 4H5l3-4zM8 13l3-4H5l3 4z"})}),St=({className:s})=>r("svg",{className:f("w-4 h-4",s),viewBox:"0 0 20 20",fill:"currentColor",children:r("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})}),Gr=()=>r("svg",{className:"w-4 h-4 text-gray-400",viewBox:"0 0 20 20",fill:"currentColor",children:r("path",{fillRule:"evenodd",d:"M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z",clipRule:"evenodd"})}),Mr=()=>r("svg",{className:"w-4 h-4 text-gray-400",viewBox:"0 0 20 20",fill:"currentColor",children:r("path",{d:"M7 4a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3zM7 10.5a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3zM7 17a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3z"})}),Fr=()=>r("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor",children:r("path",{fillRule:"evenodd",d:"M2.628 1.601C5.028 1.206 7.49 1 10 1s4.973.206 7.372.601a.75.75 0 01.628.74v2.288a2.25 2.25 0 01-.659 1.59l-4.682 4.683a2.25 2.25 0 00-.659 1.59v3.037c0 .684-.31 1.33-.844 1.757l-1.937 1.55A.75.75 0 018 18.25v-5.757a2.25 2.25 0 00-.659-1.591L2.659 6.22A2.25 2.25 0 012 4.629V2.34a.75.75 0 01.628-.74z",clipRule:"evenodd"})}),Pr=()=>c("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:[r("path",{d:"M10.75 2.75a.75.75 0 00-1.5 0v8.614L6.295 8.235a.75.75 0 10-1.09 1.03l4.25 4.5a.75.75 0 001.09 0l4.25-4.5a.75.75 0 00-1.09-1.03l-2.955 3.129V2.75z"}),r("path",{d:"M3.5 12.75a.75.75 0 00-1.5 0v2.5A2.75 2.75 0 004.75 18h10.5A2.75 2.75 0 0018 15.25v-2.5a.75.75 0 00-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5z"})]}),zr=()=>r("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:r("path",{fillRule:"evenodd",d:"M2.5 3A1.5 1.5 0 001 4.5v11A1.5 1.5 0 002.5 17h15a1.5 1.5 0 001.5-1.5v-11A1.5 1.5 0 0017.5 3h-15zM2.5 4.5h6v11h-6v-11zm7.5 0h7.5v11H10v-11z",clipRule:"evenodd"})});function _e(s,d,i){return typeof i=="function"?i(s,d):String(typeof i=="string"?s[i]:d)}var Je=!1;function Xr(){Je=!1}function Ir(){Je||(Je=!0,console.warn("[@synertech/ui] DataGrid has no `rowKey`: each row is known by its position in `data`. Selection, expansion and edits follow that position when `data` is refetched or reordered, and from one page to the next in server mode. Pass `rowKey` to tie them to the row."))}function P(s,d){return s[d]}function Or(s,d){return s==null&&d==null?0:s==null?-1:d==null?1:typeof s=="number"&&typeof d=="number"?s-d:String(s).localeCompare(String(d))}function Ar(s,d){let i=String(s??"").toLowerCase(),u=d.value.toLowerCase();switch(d.operator){case"contains":return i.includes(u);case"equals":return i===u;case"startsWith":return i.startsWith(u);case"endsWith":return i.endsWith(u);case"gt":return Number(s)>Number(d.value);case"gte":return Number(s)>=Number(d.value);case"lt":return Number(s)<Number(d.value);case"lte":return Number(s)<=Number(d.value);case"isEmpty":return i==="";case"isNotEmpty":return i!=="";default:return!0}}function Rt(s,d,i){let u=[];for(let l of s){let b=Number(P(l,d));isNaN(b)||u.push(b)}if(u.length===0)return 0;switch(i){case"sum":return u.reduce((l,b)=>l+b,0);case"avg":return u.reduce((l,b)=>l+b,0)/u.length;case"count":return u.length;case"min":return Math.min(...u);case"max":return Math.max(...u)}}function Lr(s,d,i){if(s==="count")return d;let u=s==="avg"?i.dataGridAggregateAvg:s==="sum"?i.dataGridAggregateSum:s==="min"?i.dataGridAggregateMin:i.dataGridAggregateMax;return _(u,{value:d})}function Hr({cols:s,density:d}){return r("tr",{className:"border-b border-gray-200 dark:border-gray-700",children:Array.from({length:s}).map((i,u)=>r("td",{className:N[d],children:r("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse"})},u))})}function Vr({column:s,value:d,onApply:i,onClear:u,labels:l}){let b=s.filterType??"text",H=String(s.header),z=b==="number"?[{value:"equals",label:l.dataGridOperatorEquals},{value:"gt",label:l.dataGridOperatorGreaterThan},{value:"gte",label:l.dataGridOperatorGreaterOrEqual},{value:"lt",label:l.dataGridOperatorLessThan},{value:"lte",label:l.dataGridOperatorLessOrEqual}]:[{value:"contains",label:l.dataGridOperatorContains},{value:"equals",label:l.dataGridOperatorEquals},{value:"startsWith",label:l.dataGridOperatorStartsWith},{value:"endsWith",label:l.dataGridOperatorEndsWith},{value:"isEmpty",label:l.dataGridOperatorIsEmpty},{value:"isNotEmpty",label:l.dataGridOperatorIsNotEmpty}],T=g=>g&&z.some(D=>D.value===g.operator)?g.operator:z[0].value,[G,C]=h(!1),[M,oe]=h(()=>T(d)),[J,V]=h(d?.value??""),se=xe(null),I=()=>{G||(oe(T(d)),V(d?.value??"")),C(!G)};return Qe(()=>{let g=D=>{se.current&&!se.current.contains(D.target)&&C(!1)};return G&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[G]),c("div",{className:"relative inline-block",ref:se,onClick:g=>g.stopPropagation(),children:[r("button",{type:"button",onClick:I,className:f("p-0.5 rounded hover:bg-gray-200 dark:hover:bg-gray-600 cursor-pointer",d&&"text-blue-600 dark:text-blue-400"),"aria-label":_(l.dataGridFilterColumn,{column:H}),children:r(Fr,{})}),G&&r("div",{className:"absolute z-50 top-full left-0 mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg p-3 min-w-[220px]",children:b==="select"&&s.filterOptions?c("div",{className:"flex flex-col gap-1.5",children:[s.filterOptions.map(g=>c("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[r("input",{type:"radio",name:`filter-${s.key}`,value:g,checked:J===g,onChange:()=>V(g),className:"cursor-pointer"}),r("span",{className:"text-gray-700 dark:text-gray-300",children:g})]},g)),c("div",{className:"flex gap-2 mt-2",children:[r("button",{type:"button",onClick:()=>{i({column:s.key,operator:"equals",value:J}),C(!1)},className:"px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 cursor-pointer",children:l.dataGridFilterApply}),r("button",{type:"button",onClick:()=>{V(""),u(),C(!1)},className:"px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 cursor-pointer",children:l.dataGridFilterClear})]})]}):c("div",{className:"flex flex-col gap-2",children:[r("select",{value:M,onChange:g=>oe(g.target.value),className:"text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200",children:z.map(g=>r("option",{value:g.value,children:g.label},g.value))}),M!=="isEmpty"&&M!=="isNotEmpty"&&r("input",{type:b==="number"?"number":b==="date"?"date":"text",value:J,onChange:g=>V(g.target.value),placeholder:l.dataGridFilterValuePlaceholder,className:"text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200",autoFocus:!0,"aria-label":_(l.dataGridFilterValue,{column:H})}),c("div",{className:"flex gap-2",children:[r("button",{type:"button",onClick:()=>{i({column:s.key,operator:M,value:J}),C(!1)},className:"px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 cursor-pointer",children:l.dataGridFilterApply}),r("button",{type:"button",onClick:()=>{V(""),u(),C(!1)},className:"px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 cursor-pointer",children:l.dataGridFilterClear})]})]})})]})}function Kr({value:s,onSave:d,density:i,labels:u}){let[l,b]=h(!1),[H,z]=h(String(s??"")),T=xe(null);if(Qe(()=>{l&&T.current&&(T.current.focus(),T.current.select())},[l]),!l)return r("div",{onDoubleClick:()=>{z(String(s??"")),b(!0)},className:"cursor-text min-h-[1.5em]",title:u.dataGridEditHint,children:String(s??"")});let G=()=>{b(!1),H!==String(s??"")&&d(H)};return r("input",{ref:T,type:"text",value:H,onChange:C=>z(C.target.value),onBlur:G,"aria-label":u.dataGridEditCell,onKeyDown:C=>{C.key==="Enter"&&G(),C.key==="Escape"&&b(!1)},className:f("w-full border border-blue-500 rounded px-1 py-0.5 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 outline-none",Te[i])})}function Wr(s,d){let{columns:i,data:u,rowKey:l,mode:b="client",sortable:H=!1,multiSort:z=!1,sort:T,defaultSort:G,onSort:C,pagination:M=!1,page:oe,onPageChange:J,onPageSizeChange:V,totalItems:se,selectable:I=!1,selectionMode:g="multiple",selectedRows:D,onSelectionChange:K,searchable:Ye=!1,searchPlaceholder:Tt,searchValue:fe,onSearch:we,filters:Q,onFilterChange:ie,expandable:le=!1,expandedContent:Ze,expandedRows:De,onExpandChange:et,editable:tt=!1,onCellEdit:Dt,reorderable:de=!1,onReorder:rt,columnReorderable:W=!1,onColumnReorder:at,columnToggle:nt=!1,hiddenColumns:Ee,onColumnVisibilityChange:ot,groupBy:B,renderGroupHeader:st,exportable:it=!1,exportFormats:Et=["csv","json"],exportFilename:lt="export",exportNeutralizeFormulas:dt,virtualized:Y=!1,rowHeight:Z=40,virtualHeight:Ge=400,density:v="default",striped:ct=!1,bordered:Me=!1,borderless:Gt=!1,stickyHeader:ut=!1,maxHeight:ke,loading:Mt=!1,loadingRows:Ft=5,emptyState:Pt,labels:zt,showFooter:It=!1,onRowClick:Fe,onRowDoubleClick:gt,onRowContextMenu:pt,className:Ot,rowClassName:Pe,cellClassName:At,headerClassName:Lt}=s,y=Rr(zt),[Ht,mt]=h(G??[]),[Vt,Kt]=h(1),ce=typeof M=="object"?M.pageSize:void 0,[Wt,bt]=h(ce??10),[Bt,Ut]=h(ce);ce!==Bt&&(Ut(ce),ce!==void 0&&bt(ce));let[jt,Ce]=h([]),[qt,yt]=h(""),[$t,ze]=h([]),[Xt,_t]=h([]),[Jt,Qt]=h(()=>i.flatMap(e=>e.hidden?[e.key]:[])),[Ie,Yt]=h({}),[Ne,Zt]=h(()=>i.map(e=>e.key)),[ee,Oe]=h(null),[ue,ft]=h(null),[Se,ht]=h(!1),[er,tr]=h(new Set),Ae=xe(null),[vt,rr]=h(0),Le=xe(null),He=xe(!1),U=T??Ht,xt=oe??Vt,S=D??jt,Re=fe??qt,j=Q??$t,he=De??Xt,te=Ee??Jt,ge=M?typeof M=="object"?M:{pageSize:10,pageSizeOptions:[10,25,50,100]}:null,ve=Wt;!l&&(I||le||tt||de)&&Ir();let wt=e=>_e(e.row,e.sourceIndex,l),O=X(()=>{let e=new Map(i.map(n=>[n.key,n])),t=Ne.flatMap(n=>{let o=e.get(n);return o?[o]:[]}),a=new Set(t.map(n=>n.key));for(let n of i)a.has(n.key)||(t.push(n),a.add(n.key));return t.filter(n=>!te.includes(n.key))},[i,Ne,te]),re=X(()=>{let e=u.map((t,a)=>({row:t,sourceIndex:a}));if(b==="server")return e;if(Re){let t=Re.toLowerCase();e=e.filter(({row:a})=>O.some(n=>{let o=P(a,n.key);return String(o??"").toLowerCase().includes(t)}))}if(j.length>0&&(e=e.filter(({row:t})=>j.every(a=>Ar(P(t,a.column),a)))),U.length>0){let t=new Map(i.map(a=>[a.key,a]));e.sort((a,n)=>{for(let o of U){if(!o.direction)continue;let m=t.get(o.key),w=m?.sortComparator?m.sortComparator(a.row,n.row):Or(P(a.row,o.key),P(n.row,o.key));if(w!==0)return o.direction==="asc"?w:-w}return 0})}return e},[u,b,Re,j,U,O,i]),pe=X(()=>re.map(e=>e.row),[re]),kt=X(()=>{if(!B)return null;let e=Array.isArray(B)?B:[B],t=new Map;for(let a of re){let n=e.map(m=>String(P(a.row,m)??"")).join(" / "),o=t.get(n)??[];o.push(a),t.set(n,o)}return t},[re,B]),Ve=se??pe.length,ae=Math.max(1,Math.ceil(Ve/ve)),A=b==="server"&&se===void 0?xt:Math.min(Math.max(1,xt),ae),Ct=ge!==null,L=X(()=>{if(!Ct||b==="server")return re;let e=(A-1)*ve;return re.slice(e,e+ve)},[re,Ct,A,ve,b]),q=X(()=>L.map(e=>e.row),[L]),me=X(()=>{if(!Y)return{start:0,end:q.length};let e=Math.floor(vt/Z),t=Math.ceil(Ge/Z),a=5;return{start:Math.max(0,e-a),end:Math.min(q.length,e+t+a)}},[Y,vt,Z,Ge,q.length]),Ke=x(e=>{T||mt(e),C?.(e)},[T,C]),ar=x(e=>{let t=U.find(n=>n.key===e),a;if(!t||!t.direction?a="asc":t.direction==="asc"?a="desc":a=null,z){let n=U.filter(o=>o.key!==e);a&&n.push({key:e,direction:a}),Ke(n)}else Ke(a?[{key:e,direction:a}]:[])},[U,z,Ke]),R=x(e=>{let t=Math.max(1,Math.min(e,ae));oe||Kt(t),J?.(t)},[oe,J,ae]),nr=x(e=>{bt(e),R(1),V?.(e)},[R,V]),or=x(e=>{let t;g==="single"?t=S.includes(e)?[]:[e]:t=S.includes(e)?S.filter(a=>a!==e):[...S,e],D||Ce(t),K?.(t)},[g,S,D,K]),We=X(()=>new Set(S),[S]),Be=x(()=>{let e=new Set(S),t=[...S];for(let a of L){let n=_e(a.row,a.sourceIndex,l);e.has(n)||(e.add(n),t.push(n))}D||Ce(t),K?.(t)},[L,l,S,D,K]),Nt=x(()=>{D||Ce([]),K?.([])},[D,K]),sr=x(()=>{let e=new Set(L.map(a=>_e(a.row,a.sourceIndex,l))),t=S.filter(a=>!e.has(a));D||Ce(t),K?.(t)},[L,l,S,D,K]),Ue=I?L.map(wt):[],je=Ue.length>0&&Ue.every(e=>We.has(e)),ir=!je&&Ue.some(e=>We.has(e)),lr=x(e=>{let t=he.includes(e)?he.filter(a=>a!==e):[...he,e];De||_t(t),et?.(t)},[he,De,et]),dr=x(e=>{let t=e.target.value;fe||yt(t),we?.(t),R(1)},[fe,we,R]),cr=x(e=>{let t=[...j.filter(a=>a.column!==e.column),e];Q||ze(t),ie?.(t),R(1)},[j,Q,ie,R]),ur=x(e=>{let t=j.filter(a=>a.column!==e);Q||ze(t),ie?.(t),R(1)},[j,Q,ie,R]),gr=x(e=>{let t=te.includes(e)?te.filter(a=>a!==e):[...te,e];Ee||Qt(t),ot?.(t)},[te,Ee,ot]),pr=x((e,t)=>{e.preventDefault(),e.stopPropagation(),He.current=!0;let a=e.clientX,n=Ie[t]??e.currentTarget.parentElement?.getBoundingClientRect().width??100,o=i.find(k=>k.key===t),m=o?.minWidth??50,w=o?.maxWidth??1/0,ne=k=>{let $=k.clientX-a,F=Math.min(w,Math.max(m,n+$));Yt(ye=>({...ye,[t]:F}))},p=()=>{document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",p),setTimeout(()=>{He.current=!1},0)};document.addEventListener("mousemove",ne),document.addEventListener("mouseup",p)},[Ie,i]),E=de&&!(b==="client"&&U.some(e=>e.direction)),mr=x((e,t)=>{E&&Oe({key:e,sourceIndex:t})},[E]),br=x(e=>{!E||ee===null||e.preventDefault()},[E,ee]),yr=x((e,t)=>{!E||ee===null||(Oe(null),ee.key!==e&&rt?.(ee.sourceIndex,t))},[E,ee,rt]),fr=x(e=>{W&&ft(e)},[W]),hr=x(e=>{if(!W||!ue||ue===e)return;let t=[...Ne],a=t.indexOf(ue),n=t.indexOf(e);a===-1||n===-1||(t.splice(a,1),t.splice(n,0,ue),Zt(t),at?.(ue,e),ft(null))},[W,ue,Ne,at]),qe=x(e=>{let t=O.filter(k=>k.type!=="actions"&&k.type!=="selection"&&k.type!=="expand"),a=pe,n,o,m;if(e==="csv")n=Sr([t.map(k=>String(k.header)),...a.map(k=>t.map($=>{let F=P(k,$.key);return typeof F=="number"?F:String(F??"")}))],{neutralizeFormulas:dt}),o="text/csv",m="csv";else{let k=a.map($=>{let F={};for(let ye of t)F[ye.key]=P($,ye.key);return F});n=JSON.stringify(k,null,2),o="application/json",m="json"}let w=new Blob([n],{type:o}),ne=URL.createObjectURL(w),p=document.createElement("a");p.href=ne,p.download=`${lt}.${m}`,p.click(),URL.revokeObjectURL(ne)},[O,pe,lt,dt]);Qe(()=>{if(!Se)return;let e=t=>{Le.current&&!Le.current.contains(t.target)&&ht(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[Se]),Nr(d,()=>({getVisibleData:()=>q,resetFilters:()=>{Q||ze([]),fe||yt(""),ie?.([]),we?.(""),R(1)},resetSort:()=>{T||mt([]),C?.([])},selectAll:Be,deselectAll:Nt,exportData:qe,scrollToRow:e=>{Ae.current&&Y&&(Ae.current.scrollTop=e*Z)}}),[q,Q,fe,T,ie,we,C,R,Be,Nt,qe,Y,Z]);let $e=e=>{let t={},a=Ie[e.key]??e.width;return a&&(t.width=typeof a=="number"?`${a}px`:a,t.minWidth=typeof a=="number"?`${a}px`:a),e.sticky&&(t.position="sticky",t[e.sticky]=0,t.zIndex=10),t},be=O.length+(I?1:0)+(le?1:0)+(de?1:0),vr=e=>{let t=H&&e.sortable!==!1&&e.type!=="actions",a=U.find(o=>o.key===e.key),n=e.filterable&&(e.filterType||e.filterOptions);return c("th",{className:f(N[v],Te[v],"relative font-semibold text-gray-700 dark:text-gray-300 whitespace-nowrap",e.align==="center"&&"text-center",e.align==="right"&&"text-right",t&&"cursor-pointer select-none hover:bg-gray-100 dark:hover:bg-gray-700",Me&&"border border-gray-200 dark:border-gray-700",e.sticky&&"bg-gray-50 dark:bg-gray-800",e.headerClassName,Lt),style:$e(e),onClick:t?()=>{He.current||ar(e.key)}:void 0,draggable:W,onDragStart:W?()=>fr(e.key):void 0,onDragOver:W?o=>o.preventDefault():void 0,onDrop:W?()=>hr(e.key):void 0,"aria-sort":a?.direction==="asc"?"ascending":a?.direction==="desc"?"descending":void 0,children:[c("div",{className:"flex items-center gap-1",children:[e.renderHeader?e.renderHeader(e):e.header,t&&r("span",{className:"inline-flex ml-1",children:a?.direction==="asc"?r(Tr,{}):a?.direction==="desc"?r(Dr,{}):r(Er,{})}),n&&r(Vr,{column:e,value:j.find(o=>o.column===e.key),onApply:cr,onClear:()=>ur(e.key),labels:y})]}),e.resizable!==!1&&r("div",{className:"absolute top-0 right-0 w-1 h-full cursor-col-resize hover:bg-blue-500 opacity-0 hover:opacity-100",onMouseDown:o=>pr(o,e.key)})]},e.key)},Xe=(e,t)=>{let{row:a,sourceIndex:n}=e,o=wt(e),m=We.has(o),w=he.includes(o),ne=typeof Pe=="function"?Pe(a,t):Pe;return c(kr.Fragment,{children:[c("tr",{className:f("border-b border-gray-200 dark:border-gray-700 transition-colors",ct&&t%2===1&&"bg-gray-50/50 dark:bg-gray-800/50",m&&"bg-blue-50 dark:bg-blue-900/20",Fe&&"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700/50",ee?.key===o&&"opacity-50",ne),onClick:Fe?()=>Fe(a,t):void 0,onDoubleClick:gt?()=>gt(a,t):void 0,onContextMenu:pt?p=>pt(a,t,p):void 0,draggable:E,onDragStart:E?()=>mr(o,n):void 0,onDragOver:E?br:void 0,onDrop:E?()=>yr(o,n):void 0,onDragEnd:E?()=>Oe(null):void 0,"data-row-key":o,"aria-selected":I?m:void 0,children:[de&&r("td",{className:f(N[v],E?"cursor-grab active:cursor-grabbing":"cursor-not-allowed opacity-40"),children:r(Mr,{})}),I&&r("td",{className:f(N[v],"w-10"),children:r("input",{type:"checkbox",checked:m,onChange:()=>or(o),onClick:p=>p.stopPropagation(),className:"rounded border-gray-300 dark:border-gray-600 cursor-pointer","aria-label":_(y.dataGridSelectRow,{row:o})})}),le&&r("td",{className:f(N[v],"w-10"),children:r("button",{type:"button",onClick:p=>{p.stopPropagation(),lr(o)},className:"p-0.5 rounded hover:bg-gray-200 dark:hover:bg-gray-600 cursor-pointer","aria-label":w?y.dataGridCollapseRow:y.dataGridExpandRow,"aria-expanded":w,children:r(St,{className:f("transition-transform",w&&"rotate-180")})})}),O.map(p=>{let k=P(a,p.key),$=p.colSpan?.(a,t);if($===0)return null;let F=tt&&p.editable!==!1&&p.type!=="actions";return r("td",{className:f(N[v],Te[v],"text-gray-700 dark:text-gray-300",p.align==="center"&&"text-center",p.align==="right"&&"text-right",Me&&"border border-gray-200 dark:border-gray-700",p.sticky&&(m?"bg-blue-50 dark:bg-blue-900/20":ct&&t%2===1?"bg-gray-50/50 dark:bg-gray-800/50":"bg-white dark:bg-gray-900"),p.cellClassName,At),style:$e(p),colSpan:$,children:F?r(Kr,{value:k,onSave:ye=>Dt?.(o,p.key,ye),density:v,labels:y}):p.render?p.render(k,a,t):String(k??"")},p.key)})]}),le&&w&&Ze&&r("tr",{className:"bg-gray-50 dark:bg-gray-800/70",children:r("td",{colSpan:be,className:f(N[v]),children:Ze(a,t)})})]},o)},xr=()=>{if(Mt)return Array.from({length:Ft}).map((e,t)=>r(Hr,{cols:be,density:v},t));if(q.length===0)return r("tr",{children:r("td",{colSpan:be,className:f("text-center text-gray-400 dark:text-gray-500",N[v]),children:Pt??y.dataGridNoData})});if(kt){let e=[],t=0;for(let[a,n]of kt){let o=er.has(a);if(e.push(r("tr",{className:"bg-gray-100 dark:bg-gray-800 font-medium",children:r("td",{colSpan:be,className:f(N[v],"cursor-pointer"),onClick:()=>{tr(m=>{let w=new Set(m);return w.has(a)?w.delete(a):w.add(a),w})},children:c("div",{className:"flex items-center gap-2",children:[r(St,{className:f("transition-transform",o&&"-rotate-90")}),st?st(a,P(n[0].row,Array.isArray(B)?B[0]:B),n.map(m=>m.row)):`${a} (${n.length})`]})})},`group-${a}`)),o)t+=n.length;else for(let m=0;m<n.length;m++)e.push(Xe(n[m],t)),t++}return e}if(Y){let e=[];for(let t=me.start;t<me.end;t++)e.push(Xe(L[t],t));return c(Br,{children:[me.start>0&&r("tr",{children:r("td",{colSpan:be,style:{height:me.start*Z,padding:0}})}),e,me.end<q.length&&r("tr",{children:r("td",{colSpan:be,style:{height:(q.length-me.end)*Z,padding:0}})})]})}return L.map((e,t)=>Xe(e,t))},wr=()=>!It||!O.some(t=>t.aggregate)?null:r("tfoot",{children:c("tr",{className:"bg-gray-50 dark:bg-gray-800 font-semibold border-t-2 border-gray-300 dark:border-gray-600",children:[de&&r("td",{className:N[v]}),I&&r("td",{className:N[v]}),le&&r("td",{className:N[v]}),O.map(t=>r("td",{className:f(N[v],Te[v],"text-gray-700 dark:text-gray-300",t.align==="center"&&"text-center",t.align==="right"&&"text-right",Me&&"border border-gray-200 dark:border-gray-700"),style:$e(t),children:t.aggregate?t.renderAggregate?t.renderAggregate(Rt(pe,t.key,t.aggregate),pe):Lr(t.aggregate,Rt(pe,t.key,t.aggregate).toLocaleString(),y):""},t.key))]})});return c("div",{className:f("flex flex-col gap-3",Ot),children:[(Ye||it||nt)&&c("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[c("div",{className:"flex items-center gap-3 flex-1",children:[Ye&&c("div",{className:"relative flex-1 max-w-xs",children:[r("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:r(Gr,{})}),r("input",{type:"text",value:Re,onChange:dr,placeholder:Tt??y.dataGridSearchPlaceholder,className:"w-full pl-9 pr-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500","aria-label":y.dataGridSearch})]}),S.length>0&&r("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:_(y.dataGridSelectedCount,{count:S.length})})]}),c("div",{className:"flex items-center gap-2",children:[nt&&c("div",{className:"relative",ref:Le,children:[r("button",{type:"button",onClick:()=>ht(!Se),className:"p-1.5 rounded-md border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":y.dataGridToggleColumns,title:y.dataGridToggleColumns,children:r(zr,{})}),Se&&r("div",{className:"absolute z-50 right-0 top-full mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg p-2 min-w-[180px]",children:i.filter(e=>e.type!=="selection"&&e.type!=="expand").map(e=>c("label",{className:"flex items-center gap-2 px-2 py-1.5 text-sm rounded hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",children:[r("input",{type:"checkbox",checked:!te.includes(e.key),onChange:()=>gr(e.key),className:"rounded border-gray-300 dark:border-gray-600 cursor-pointer"}),r("span",{className:"text-gray-700 dark:text-gray-300",children:String(e.header)})]},e.key))})]}),it&&Et.map(e=>c("button",{type:"button",onClick:()=>qe(e),className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",title:_(y.dataGridExportAs,{format:e.toUpperCase()}),children:[r(Pr,{}),e.toUpperCase()]},e))]})]}),r("div",{ref:Ae,className:f("overflow-auto rounded-lg",!Gt&&"border border-gray-200 dark:border-gray-700",ut&&"relative"),style:ke?{maxHeight:typeof ke=="number"?`${ke}px`:ke}:Y?{maxHeight:Ge,overflow:"auto"}:void 0,onScroll:Y?e=>rr(e.target.scrollTop):void 0,children:c("table",{className:"w-full text-left",children:[r("thead",{className:f("bg-gray-50 dark:bg-gray-800 text-xs uppercase",ut&&"sticky top-0 z-20"),children:c("tr",{children:[de&&r("th",{className:f(N[v],"w-10 font-semibold text-gray-700 dark:text-gray-300")}),I&&r("th",{className:f(N[v],"w-10"),children:g==="multiple"&&r("input",{type:"checkbox",checked:je,ref:e=>{e&&(e.indeterminate=ir)},onChange:je?sr:Be,className:"rounded border-gray-300 dark:border-gray-600 cursor-pointer","aria-label":y.dataGridSelectAllRows})}),le&&r("th",{className:f(N[v],"w-10 font-semibold text-gray-700 dark:text-gray-300")}),O.map(vr)]})}),r("tbody",{children:xr()}),wr()]})}),ge&&c("div",{className:"flex items-center justify-between flex-wrap gap-3 text-sm text-gray-600 dark:text-gray-400",children:[c("div",{className:"flex items-center gap-3",children:[ge.showTotalItems!==!1&&r("span",{children:_(Ve===1?y.dataGridItemCount:y.dataGridItemsCount,{count:Ve})}),ge.showPageSizeSelector!==!1&&ge.pageSizeOptions&&c("div",{className:"flex items-center gap-1.5",children:[r("span",{children:y.dataGridRowsPerPage}),r("select",{value:ve,onChange:e=>nr(Number(e.target.value)),className:"border border-gray-300 dark:border-gray-600 rounded px-1.5 py-0.5 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 text-sm",children:ge.pageSizeOptions.map(e=>r("option",{value:e,children:e},e))})]})]}),c("div",{className:"flex items-center gap-1",children:[r("span",{className:"mr-2",children:_(y.dataGridPageOf,{page:A,total:ae})}),r("button",{type:"button",onClick:()=>R(1),disabled:A<=1,className:"px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":y.dataGridFirstPage,children:"\xAB\xAB"}),r("button",{type:"button",onClick:()=>R(A-1),disabled:A<=1,className:"px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":y.dataGridPreviousPage,children:"\xAB"}),r("button",{type:"button",onClick:()=>R(A+1),disabled:A>=ae,className:"px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":y.dataGridNextPage,children:"\xBB"}),r("button",{type:"button",onClick:()=>R(ae),disabled:A>=ae,className:"px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":y.dataGridLastPage,children:"\xBB\xBB"})]})]})]})}var _r=Cr(Wr);export{_r as DataGrid,Xr as resetRowKeyWarning};
1
+ "use client";import kr,{useState as h,useRef as xe,useCallback as x,useEffect as Qe,useMemo as X,forwardRef as Cr,useImperativeHandle as Nr}from"react";import{cn as f}from"../../lib/cn.js";import{csvDocument as Sr}from"../../lib/csv.js";import{formatUILabel as _,useUILabels as Rr}from"../../lib/i18n.js";import{Fragment as Br,jsx as r,jsxs as c}from"react/jsx-runtime";var N={compact:"px-3 py-1.5",default:"px-4 py-3",comfortable:"px-6 py-4"},Te={compact:"text-xs",default:"text-sm",comfortable:"text-base"},Tr=()=>r("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:r("path",{d:"M8 3l4 5H4l4-5z"})}),Dr=()=>r("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:r("path",{d:"M8 13l4-5H4l4 5z"})}),Er=()=>r("svg",{className:"w-3.5 h-3.5 opacity-30",viewBox:"0 0 16 16",fill:"currentColor",children:r("path",{d:"M8 3l3 4H5l3-4zM8 13l3-4H5l3 4z"})}),St=({className:s})=>r("svg",{className:f("w-4 h-4",s),viewBox:"0 0 20 20",fill:"currentColor",children:r("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})}),Gr=()=>r("svg",{className:"w-4 h-4 text-gray-500 dark:text-gray-400",viewBox:"0 0 20 20",fill:"currentColor",children:r("path",{fillRule:"evenodd",d:"M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z",clipRule:"evenodd"})}),Mr=()=>r("svg",{className:"w-4 h-4 text-gray-500 dark:text-gray-400",viewBox:"0 0 20 20",fill:"currentColor",children:r("path",{d:"M7 4a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3zM7 10.5a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3zM7 17a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3z"})}),Fr=()=>r("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor",children:r("path",{fillRule:"evenodd",d:"M2.628 1.601C5.028 1.206 7.49 1 10 1s4.973.206 7.372.601a.75.75 0 01.628.74v2.288a2.25 2.25 0 01-.659 1.59l-4.682 4.683a2.25 2.25 0 00-.659 1.59v3.037c0 .684-.31 1.33-.844 1.757l-1.937 1.55A.75.75 0 018 18.25v-5.757a2.25 2.25 0 00-.659-1.591L2.659 6.22A2.25 2.25 0 012 4.629V2.34a.75.75 0 01.628-.74z",clipRule:"evenodd"})}),Pr=()=>c("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:[r("path",{d:"M10.75 2.75a.75.75 0 00-1.5 0v8.614L6.295 8.235a.75.75 0 10-1.09 1.03l4.25 4.5a.75.75 0 001.09 0l4.25-4.5a.75.75 0 00-1.09-1.03l-2.955 3.129V2.75z"}),r("path",{d:"M3.5 12.75a.75.75 0 00-1.5 0v2.5A2.75 2.75 0 004.75 18h10.5A2.75 2.75 0 0018 15.25v-2.5a.75.75 0 00-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5z"})]}),zr=()=>r("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:r("path",{fillRule:"evenodd",d:"M2.5 3A1.5 1.5 0 001 4.5v11A1.5 1.5 0 002.5 17h15a1.5 1.5 0 001.5-1.5v-11A1.5 1.5 0 0017.5 3h-15zM2.5 4.5h6v11h-6v-11zm7.5 0h7.5v11H10v-11z",clipRule:"evenodd"})});function _e(s,d,i){return typeof i=="function"?i(s,d):String(typeof i=="string"?s[i]:d)}var Je=!1;function Xr(){Je=!1}function Ir(){Je||(Je=!0,console.warn("[@synertech/ui] DataGrid has no `rowKey`: each row is known by its position in `data`. Selection, expansion and edits follow that position when `data` is refetched or reordered, and from one page to the next in server mode. Pass `rowKey` to tie them to the row."))}function P(s,d){return s[d]}function Or(s,d){return s==null&&d==null?0:s==null?-1:d==null?1:typeof s=="number"&&typeof d=="number"?s-d:String(s).localeCompare(String(d))}function Ar(s,d){let i=String(s??"").toLowerCase(),u=d.value.toLowerCase();switch(d.operator){case"contains":return i.includes(u);case"equals":return i===u;case"startsWith":return i.startsWith(u);case"endsWith":return i.endsWith(u);case"gt":return Number(s)>Number(d.value);case"gte":return Number(s)>=Number(d.value);case"lt":return Number(s)<Number(d.value);case"lte":return Number(s)<=Number(d.value);case"isEmpty":return i==="";case"isNotEmpty":return i!=="";default:return!0}}function Rt(s,d,i){let u=[];for(let l of s){let b=Number(P(l,d));isNaN(b)||u.push(b)}if(u.length===0)return 0;switch(i){case"sum":return u.reduce((l,b)=>l+b,0);case"avg":return u.reduce((l,b)=>l+b,0)/u.length;case"count":return u.length;case"min":return Math.min(...u);case"max":return Math.max(...u)}}function Lr(s,d,i){if(s==="count")return d;let u=s==="avg"?i.dataGridAggregateAvg:s==="sum"?i.dataGridAggregateSum:s==="min"?i.dataGridAggregateMin:i.dataGridAggregateMax;return _(u,{value:d})}function Hr({cols:s,density:d}){return r("tr",{className:"border-b border-gray-200 dark:border-gray-700",children:Array.from({length:s}).map((i,u)=>r("td",{className:N[d],children:r("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse"})},u))})}function Vr({column:s,value:d,onApply:i,onClear:u,labels:l}){let b=s.filterType??"text",H=String(s.header),z=b==="number"?[{value:"equals",label:l.dataGridOperatorEquals},{value:"gt",label:l.dataGridOperatorGreaterThan},{value:"gte",label:l.dataGridOperatorGreaterOrEqual},{value:"lt",label:l.dataGridOperatorLessThan},{value:"lte",label:l.dataGridOperatorLessOrEqual}]:[{value:"contains",label:l.dataGridOperatorContains},{value:"equals",label:l.dataGridOperatorEquals},{value:"startsWith",label:l.dataGridOperatorStartsWith},{value:"endsWith",label:l.dataGridOperatorEndsWith},{value:"isEmpty",label:l.dataGridOperatorIsEmpty},{value:"isNotEmpty",label:l.dataGridOperatorIsNotEmpty}],T=g=>g&&z.some(D=>D.value===g.operator)?g.operator:z[0].value,[G,C]=h(!1),[M,oe]=h(()=>T(d)),[J,V]=h(d?.value??""),se=xe(null),I=()=>{G||(oe(T(d)),V(d?.value??"")),C(!G)};return Qe(()=>{let g=D=>{se.current&&!se.current.contains(D.target)&&C(!1)};return G&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[G]),c("div",{className:"relative inline-block",ref:se,onClick:g=>g.stopPropagation(),children:[r("button",{type:"button",onClick:I,className:f("p-0.5 rounded hover:bg-gray-200 dark:hover:bg-gray-600 cursor-pointer",d&&"text-blue-600 dark:text-blue-400"),"aria-label":_(l.dataGridFilterColumn,{column:H}),children:r(Fr,{})}),G&&r("div",{className:"absolute z-50 top-full left-0 mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg p-3 min-w-[220px]",children:b==="select"&&s.filterOptions?c("div",{className:"flex flex-col gap-1.5",children:[s.filterOptions.map(g=>c("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[r("input",{type:"radio",name:`filter-${s.key}`,value:g,checked:J===g,onChange:()=>V(g),className:"cursor-pointer"}),r("span",{className:"text-gray-700 dark:text-gray-300",children:g})]},g)),c("div",{className:"flex gap-2 mt-2",children:[r("button",{type:"button",onClick:()=>{i({column:s.key,operator:"equals",value:J}),C(!1)},className:"px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 cursor-pointer",children:l.dataGridFilterApply}),r("button",{type:"button",onClick:()=>{V(""),u(),C(!1)},className:"px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 cursor-pointer",children:l.dataGridFilterClear})]})]}):c("div",{className:"flex flex-col gap-2",children:[r("select",{value:M,onChange:g=>oe(g.target.value),className:"text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200",children:z.map(g=>r("option",{value:g.value,children:g.label},g.value))}),M!=="isEmpty"&&M!=="isNotEmpty"&&r("input",{type:b==="number"?"number":b==="date"?"date":"text",value:J,onChange:g=>V(g.target.value),placeholder:l.dataGridFilterValuePlaceholder,className:"text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200",autoFocus:!0,"aria-label":_(l.dataGridFilterValue,{column:H})}),c("div",{className:"flex gap-2",children:[r("button",{type:"button",onClick:()=>{i({column:s.key,operator:M,value:J}),C(!1)},className:"px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 cursor-pointer",children:l.dataGridFilterApply}),r("button",{type:"button",onClick:()=>{V(""),u(),C(!1)},className:"px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 cursor-pointer",children:l.dataGridFilterClear})]})]})})]})}function Kr({value:s,onSave:d,density:i,labels:u}){let[l,b]=h(!1),[H,z]=h(String(s??"")),T=xe(null);if(Qe(()=>{l&&T.current&&(T.current.focus(),T.current.select())},[l]),!l)return r("div",{onDoubleClick:()=>{z(String(s??"")),b(!0)},className:"cursor-text min-h-[1.5em]",title:u.dataGridEditHint,children:String(s??"")});let G=()=>{b(!1),H!==String(s??"")&&d(H)};return r("input",{ref:T,type:"text",value:H,onChange:C=>z(C.target.value),onBlur:G,"aria-label":u.dataGridEditCell,onKeyDown:C=>{C.key==="Enter"&&G(),C.key==="Escape"&&b(!1)},className:f("w-full border border-blue-500 rounded px-1 py-0.5 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 outline-none",Te[i])})}function Wr(s,d){let{columns:i,data:u,rowKey:l,mode:b="client",sortable:H=!1,multiSort:z=!1,sort:T,defaultSort:G,onSort:C,pagination:M=!1,page:oe,onPageChange:J,onPageSizeChange:V,totalItems:se,selectable:I=!1,selectionMode:g="multiple",selectedRows:D,onSelectionChange:K,searchable:Ye=!1,searchPlaceholder:Tt,searchValue:fe,onSearch:we,filters:Q,onFilterChange:ie,expandable:le=!1,expandedContent:Ze,expandedRows:De,onExpandChange:et,editable:tt=!1,onCellEdit:Dt,reorderable:de=!1,onReorder:rt,columnReorderable:W=!1,onColumnReorder:at,columnToggle:nt=!1,hiddenColumns:Ee,onColumnVisibilityChange:ot,groupBy:B,renderGroupHeader:st,exportable:it=!1,exportFormats:Et=["csv","json"],exportFilename:lt="export",exportNeutralizeFormulas:dt,virtualized:Y=!1,rowHeight:Z=40,virtualHeight:Ge=400,density:v="default",striped:ct=!1,bordered:Me=!1,borderless:Gt=!1,stickyHeader:ut=!1,maxHeight:ke,loading:Mt=!1,loadingRows:Ft=5,emptyState:Pt,labels:zt,showFooter:It=!1,onRowClick:Fe,onRowDoubleClick:gt,onRowContextMenu:pt,className:Ot,rowClassName:Pe,cellClassName:At,headerClassName:Lt}=s,y=Rr(zt),[Ht,mt]=h(G??[]),[Vt,Kt]=h(1),ce=typeof M=="object"?M.pageSize:void 0,[Wt,bt]=h(ce??10),[Bt,Ut]=h(ce);ce!==Bt&&(Ut(ce),ce!==void 0&&bt(ce));let[jt,Ce]=h([]),[qt,yt]=h(""),[$t,ze]=h([]),[Xt,_t]=h([]),[Jt,Qt]=h(()=>i.flatMap(e=>e.hidden?[e.key]:[])),[Ie,Yt]=h({}),[Ne,Zt]=h(()=>i.map(e=>e.key)),[ee,Oe]=h(null),[ue,ft]=h(null),[Se,ht]=h(!1),[er,tr]=h(new Set),Ae=xe(null),[vt,rr]=h(0),Le=xe(null),He=xe(!1),U=T??Ht,xt=oe??Vt,S=D??jt,Re=fe??qt,j=Q??$t,he=De??Xt,te=Ee??Jt,ge=M?typeof M=="object"?M:{pageSize:10,pageSizeOptions:[10,25,50,100]}:null,ve=Wt;!l&&(I||le||tt||de)&&Ir();let wt=e=>_e(e.row,e.sourceIndex,l),O=X(()=>{let e=new Map(i.map(n=>[n.key,n])),t=Ne.flatMap(n=>{let o=e.get(n);return o?[o]:[]}),a=new Set(t.map(n=>n.key));for(let n of i)a.has(n.key)||(t.push(n),a.add(n.key));return t.filter(n=>!te.includes(n.key))},[i,Ne,te]),re=X(()=>{let e=u.map((t,a)=>({row:t,sourceIndex:a}));if(b==="server")return e;if(Re){let t=Re.toLowerCase();e=e.filter(({row:a})=>O.some(n=>{let o=P(a,n.key);return String(o??"").toLowerCase().includes(t)}))}if(j.length>0&&(e=e.filter(({row:t})=>j.every(a=>Ar(P(t,a.column),a)))),U.length>0){let t=new Map(i.map(a=>[a.key,a]));e.sort((a,n)=>{for(let o of U){if(!o.direction)continue;let m=t.get(o.key),w=m?.sortComparator?m.sortComparator(a.row,n.row):Or(P(a.row,o.key),P(n.row,o.key));if(w!==0)return o.direction==="asc"?w:-w}return 0})}return e},[u,b,Re,j,U,O,i]),pe=X(()=>re.map(e=>e.row),[re]),kt=X(()=>{if(!B)return null;let e=Array.isArray(B)?B:[B],t=new Map;for(let a of re){let n=e.map(m=>String(P(a.row,m)??"")).join(" / "),o=t.get(n)??[];o.push(a),t.set(n,o)}return t},[re,B]),Ve=se??pe.length,ae=Math.max(1,Math.ceil(Ve/ve)),A=b==="server"&&se===void 0?xt:Math.min(Math.max(1,xt),ae),Ct=ge!==null,L=X(()=>{if(!Ct||b==="server")return re;let e=(A-1)*ve;return re.slice(e,e+ve)},[re,Ct,A,ve,b]),q=X(()=>L.map(e=>e.row),[L]),me=X(()=>{if(!Y)return{start:0,end:q.length};let e=Math.floor(vt/Z),t=Math.ceil(Ge/Z),a=5;return{start:Math.max(0,e-a),end:Math.min(q.length,e+t+a)}},[Y,vt,Z,Ge,q.length]),Ke=x(e=>{T||mt(e),C?.(e)},[T,C]),ar=x(e=>{let t=U.find(n=>n.key===e),a;if(!t||!t.direction?a="asc":t.direction==="asc"?a="desc":a=null,z){let n=U.filter(o=>o.key!==e);a&&n.push({key:e,direction:a}),Ke(n)}else Ke(a?[{key:e,direction:a}]:[])},[U,z,Ke]),R=x(e=>{let t=Math.max(1,Math.min(e,ae));oe||Kt(t),J?.(t)},[oe,J,ae]),nr=x(e=>{bt(e),R(1),V?.(e)},[R,V]),or=x(e=>{let t;g==="single"?t=S.includes(e)?[]:[e]:t=S.includes(e)?S.filter(a=>a!==e):[...S,e],D||Ce(t),K?.(t)},[g,S,D,K]),We=X(()=>new Set(S),[S]),Be=x(()=>{let e=new Set(S),t=[...S];for(let a of L){let n=_e(a.row,a.sourceIndex,l);e.has(n)||(e.add(n),t.push(n))}D||Ce(t),K?.(t)},[L,l,S,D,K]),Nt=x(()=>{D||Ce([]),K?.([])},[D,K]),sr=x(()=>{let e=new Set(L.map(a=>_e(a.row,a.sourceIndex,l))),t=S.filter(a=>!e.has(a));D||Ce(t),K?.(t)},[L,l,S,D,K]),Ue=I?L.map(wt):[],je=Ue.length>0&&Ue.every(e=>We.has(e)),ir=!je&&Ue.some(e=>We.has(e)),lr=x(e=>{let t=he.includes(e)?he.filter(a=>a!==e):[...he,e];De||_t(t),et?.(t)},[he,De,et]),dr=x(e=>{let t=e.target.value;fe||yt(t),we?.(t),R(1)},[fe,we,R]),cr=x(e=>{let t=[...j.filter(a=>a.column!==e.column),e];Q||ze(t),ie?.(t),R(1)},[j,Q,ie,R]),ur=x(e=>{let t=j.filter(a=>a.column!==e);Q||ze(t),ie?.(t),R(1)},[j,Q,ie,R]),gr=x(e=>{let t=te.includes(e)?te.filter(a=>a!==e):[...te,e];Ee||Qt(t),ot?.(t)},[te,Ee,ot]),pr=x((e,t)=>{e.preventDefault(),e.stopPropagation(),He.current=!0;let a=e.clientX,n=Ie[t]??e.currentTarget.parentElement?.getBoundingClientRect().width??100,o=i.find(k=>k.key===t),m=o?.minWidth??50,w=o?.maxWidth??1/0,ne=k=>{let $=k.clientX-a,F=Math.min(w,Math.max(m,n+$));Yt(ye=>({...ye,[t]:F}))},p=()=>{document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",p),setTimeout(()=>{He.current=!1},0)};document.addEventListener("mousemove",ne),document.addEventListener("mouseup",p)},[Ie,i]),E=de&&!(b==="client"&&U.some(e=>e.direction)),mr=x((e,t)=>{E&&Oe({key:e,sourceIndex:t})},[E]),br=x(e=>{!E||ee===null||e.preventDefault()},[E,ee]),yr=x((e,t)=>{!E||ee===null||(Oe(null),ee.key!==e&&rt?.(ee.sourceIndex,t))},[E,ee,rt]),fr=x(e=>{W&&ft(e)},[W]),hr=x(e=>{if(!W||!ue||ue===e)return;let t=[...Ne],a=t.indexOf(ue),n=t.indexOf(e);a===-1||n===-1||(t.splice(a,1),t.splice(n,0,ue),Zt(t),at?.(ue,e),ft(null))},[W,ue,Ne,at]),qe=x(e=>{let t=O.filter(k=>k.type!=="actions"&&k.type!=="selection"&&k.type!=="expand"),a=pe,n,o,m;if(e==="csv")n=Sr([t.map(k=>String(k.header)),...a.map(k=>t.map($=>{let F=P(k,$.key);return typeof F=="number"?F:String(F??"")}))],{neutralizeFormulas:dt}),o="text/csv",m="csv";else{let k=a.map($=>{let F={};for(let ye of t)F[ye.key]=P($,ye.key);return F});n=JSON.stringify(k,null,2),o="application/json",m="json"}let w=new Blob([n],{type:o}),ne=URL.createObjectURL(w),p=document.createElement("a");p.href=ne,p.download=`${lt}.${m}`,p.click(),URL.revokeObjectURL(ne)},[O,pe,lt,dt]);Qe(()=>{if(!Se)return;let e=t=>{Le.current&&!Le.current.contains(t.target)&&ht(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[Se]),Nr(d,()=>({getVisibleData:()=>q,resetFilters:()=>{Q||ze([]),fe||yt(""),ie?.([]),we?.(""),R(1)},resetSort:()=>{T||mt([]),C?.([])},selectAll:Be,deselectAll:Nt,exportData:qe,scrollToRow:e=>{Ae.current&&Y&&(Ae.current.scrollTop=e*Z)}}),[q,Q,fe,T,ie,we,C,R,Be,Nt,qe,Y,Z]);let $e=e=>{let t={},a=Ie[e.key]??e.width;return a&&(t.width=typeof a=="number"?`${a}px`:a,t.minWidth=typeof a=="number"?`${a}px`:a),e.sticky&&(t.position="sticky",t[e.sticky]=0,t.zIndex=10),t},be=O.length+(I?1:0)+(le?1:0)+(de?1:0),vr=e=>{let t=H&&e.sortable!==!1&&e.type!=="actions",a=U.find(o=>o.key===e.key),n=e.filterable&&(e.filterType||e.filterOptions);return c("th",{className:f(N[v],Te[v],"relative font-semibold text-gray-700 dark:text-gray-300 whitespace-nowrap",e.align==="center"&&"text-center",e.align==="right"&&"text-right",t&&"cursor-pointer select-none hover:bg-gray-100 dark:hover:bg-gray-700",Me&&"border border-gray-200 dark:border-gray-700",e.sticky&&"bg-gray-50 dark:bg-gray-800",e.headerClassName,Lt),style:$e(e),onClick:t?()=>{He.current||ar(e.key)}:void 0,draggable:W,onDragStart:W?()=>fr(e.key):void 0,onDragOver:W?o=>o.preventDefault():void 0,onDrop:W?()=>hr(e.key):void 0,"aria-sort":a?.direction==="asc"?"ascending":a?.direction==="desc"?"descending":void 0,children:[c("div",{className:"flex items-center gap-1",children:[e.renderHeader?e.renderHeader(e):e.header,t&&r("span",{className:"inline-flex ml-1",children:a?.direction==="asc"?r(Tr,{}):a?.direction==="desc"?r(Dr,{}):r(Er,{})}),n&&r(Vr,{column:e,value:j.find(o=>o.column===e.key),onApply:cr,onClear:()=>ur(e.key),labels:y})]}),e.resizable!==!1&&r("div",{className:"absolute top-0 right-0 w-1 h-full cursor-col-resize hover:bg-blue-500 opacity-0 hover:opacity-100",onMouseDown:o=>pr(o,e.key)})]},e.key)},Xe=(e,t)=>{let{row:a,sourceIndex:n}=e,o=wt(e),m=We.has(o),w=he.includes(o),ne=typeof Pe=="function"?Pe(a,t):Pe;return c(kr.Fragment,{children:[c("tr",{className:f("border-b border-gray-200 dark:border-gray-700 transition-colors",ct&&t%2===1&&"bg-gray-50/50 dark:bg-gray-800/50",m&&"bg-blue-50 dark:bg-blue-900/20",Fe&&"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700/50",ee?.key===o&&"opacity-50",ne),onClick:Fe?()=>Fe(a,t):void 0,onDoubleClick:gt?()=>gt(a,t):void 0,onContextMenu:pt?p=>pt(a,t,p):void 0,draggable:E,onDragStart:E?()=>mr(o,n):void 0,onDragOver:E?br:void 0,onDrop:E?()=>yr(o,n):void 0,onDragEnd:E?()=>Oe(null):void 0,"data-row-key":o,"aria-selected":I?m:void 0,children:[de&&r("td",{className:f(N[v],E?"cursor-grab active:cursor-grabbing":"cursor-not-allowed opacity-40"),children:r(Mr,{})}),I&&r("td",{className:f(N[v],"w-10"),children:r("input",{type:"checkbox",checked:m,onChange:()=>or(o),onClick:p=>p.stopPropagation(),className:"rounded border-gray-300 dark:border-gray-600 cursor-pointer","aria-label":_(y.dataGridSelectRow,{row:o})})}),le&&r("td",{className:f(N[v],"w-10"),children:r("button",{type:"button",onClick:p=>{p.stopPropagation(),lr(o)},className:"p-0.5 rounded hover:bg-gray-200 dark:hover:bg-gray-600 cursor-pointer","aria-label":w?y.dataGridCollapseRow:y.dataGridExpandRow,"aria-expanded":w,children:r(St,{className:f("transition-transform",w&&"rotate-180")})})}),O.map(p=>{let k=P(a,p.key),$=p.colSpan?.(a,t);if($===0)return null;let F=tt&&p.editable!==!1&&p.type!=="actions";return r("td",{className:f(N[v],Te[v],"text-gray-700 dark:text-gray-300",p.align==="center"&&"text-center",p.align==="right"&&"text-right",Me&&"border border-gray-200 dark:border-gray-700",p.sticky&&(m?"bg-blue-50 dark:bg-blue-900/20":ct&&t%2===1?"bg-gray-50/50 dark:bg-gray-800/50":"bg-white dark:bg-gray-900"),p.cellClassName,At),style:$e(p),colSpan:$,children:F?r(Kr,{value:k,onSave:ye=>Dt?.(o,p.key,ye),density:v,labels:y}):p.render?p.render(k,a,t):String(k??"")},p.key)})]}),le&&w&&Ze&&r("tr",{className:"bg-gray-50 dark:bg-gray-800/70",children:r("td",{colSpan:be,className:f(N[v]),children:Ze(a,t)})})]},o)},xr=()=>{if(Mt)return Array.from({length:Ft}).map((e,t)=>r(Hr,{cols:be,density:v},t));if(q.length===0)return r("tr",{children:r("td",{colSpan:be,className:f("text-center text-gray-500 dark:text-gray-400",N[v]),children:Pt??y.dataGridNoData})});if(kt){let e=[],t=0;for(let[a,n]of kt){let o=er.has(a);if(e.push(r("tr",{className:"bg-gray-100 dark:bg-gray-800 font-medium",children:r("td",{colSpan:be,className:f(N[v],"cursor-pointer"),onClick:()=>{tr(m=>{let w=new Set(m);return w.has(a)?w.delete(a):w.add(a),w})},children:c("div",{className:"flex items-center gap-2",children:[r(St,{className:f("transition-transform",o&&"-rotate-90")}),st?st(a,P(n[0].row,Array.isArray(B)?B[0]:B),n.map(m=>m.row)):`${a} (${n.length})`]})})},`group-${a}`)),o)t+=n.length;else for(let m=0;m<n.length;m++)e.push(Xe(n[m],t)),t++}return e}if(Y){let e=[];for(let t=me.start;t<me.end;t++)e.push(Xe(L[t],t));return c(Br,{children:[me.start>0&&r("tr",{children:r("td",{colSpan:be,style:{height:me.start*Z,padding:0}})}),e,me.end<q.length&&r("tr",{children:r("td",{colSpan:be,style:{height:(q.length-me.end)*Z,padding:0}})})]})}return L.map((e,t)=>Xe(e,t))},wr=()=>!It||!O.some(t=>t.aggregate)?null:r("tfoot",{children:c("tr",{className:"bg-gray-50 dark:bg-gray-800 font-semibold border-t-2 border-gray-300 dark:border-gray-600",children:[de&&r("td",{className:N[v]}),I&&r("td",{className:N[v]}),le&&r("td",{className:N[v]}),O.map(t=>r("td",{className:f(N[v],Te[v],"text-gray-700 dark:text-gray-300",t.align==="center"&&"text-center",t.align==="right"&&"text-right",Me&&"border border-gray-200 dark:border-gray-700"),style:$e(t),children:t.aggregate?t.renderAggregate?t.renderAggregate(Rt(pe,t.key,t.aggregate),pe):Lr(t.aggregate,Rt(pe,t.key,t.aggregate).toLocaleString(),y):""},t.key))]})});return c("div",{className:f("flex flex-col gap-3",Ot),children:[(Ye||it||nt)&&c("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[c("div",{className:"flex items-center gap-3 flex-1",children:[Ye&&c("div",{className:"relative flex-1 max-w-xs",children:[r("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:r(Gr,{})}),r("input",{type:"text",value:Re,onChange:dr,placeholder:Tt??y.dataGridSearchPlaceholder,className:"w-full pl-9 pr-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500","aria-label":y.dataGridSearch})]}),S.length>0&&r("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:_(y.dataGridSelectedCount,{count:S.length})})]}),c("div",{className:"flex items-center gap-2",children:[nt&&c("div",{className:"relative",ref:Le,children:[r("button",{type:"button",onClick:()=>ht(!Se),className:"p-1.5 rounded-md border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":y.dataGridToggleColumns,title:y.dataGridToggleColumns,children:r(zr,{})}),Se&&r("div",{className:"absolute z-50 right-0 top-full mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg p-2 min-w-[180px]",children:i.filter(e=>e.type!=="selection"&&e.type!=="expand").map(e=>c("label",{className:"flex items-center gap-2 px-2 py-1.5 text-sm rounded hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",children:[r("input",{type:"checkbox",checked:!te.includes(e.key),onChange:()=>gr(e.key),className:"rounded border-gray-300 dark:border-gray-600 cursor-pointer"}),r("span",{className:"text-gray-700 dark:text-gray-300",children:String(e.header)})]},e.key))})]}),it&&Et.map(e=>c("button",{type:"button",onClick:()=>qe(e),className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",title:_(y.dataGridExportAs,{format:e.toUpperCase()}),children:[r(Pr,{}),e.toUpperCase()]},e))]})]}),r("div",{ref:Ae,className:f("overflow-auto rounded-lg",!Gt&&"border border-gray-200 dark:border-gray-700",ut&&"relative"),style:ke?{maxHeight:typeof ke=="number"?`${ke}px`:ke}:Y?{maxHeight:Ge,overflow:"auto"}:void 0,onScroll:Y?e=>rr(e.target.scrollTop):void 0,children:c("table",{className:"w-full text-left",children:[r("thead",{className:f("bg-gray-50 dark:bg-gray-800 text-xs uppercase",ut&&"sticky top-0 z-20"),children:c("tr",{children:[de&&r("th",{className:f(N[v],"w-10 font-semibold text-gray-700 dark:text-gray-300")}),I&&r("th",{className:f(N[v],"w-10"),children:g==="multiple"&&r("input",{type:"checkbox",checked:je,ref:e=>{e&&(e.indeterminate=ir)},onChange:je?sr:Be,className:"rounded border-gray-300 dark:border-gray-600 cursor-pointer","aria-label":y.dataGridSelectAllRows})}),le&&r("th",{className:f(N[v],"w-10 font-semibold text-gray-700 dark:text-gray-300")}),O.map(vr)]})}),r("tbody",{children:xr()}),wr()]})}),ge&&c("div",{className:"flex items-center justify-between flex-wrap gap-3 text-sm text-gray-600 dark:text-gray-400",children:[c("div",{className:"flex items-center gap-3",children:[ge.showTotalItems!==!1&&r("span",{children:_(Ve===1?y.dataGridItemCount:y.dataGridItemsCount,{count:Ve})}),ge.showPageSizeSelector!==!1&&ge.pageSizeOptions&&c("div",{className:"flex items-center gap-1.5",children:[r("span",{children:y.dataGridRowsPerPage}),r("select",{value:ve,onChange:e=>nr(Number(e.target.value)),className:"border border-gray-300 dark:border-gray-600 rounded px-1.5 py-0.5 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 text-sm",children:ge.pageSizeOptions.map(e=>r("option",{value:e,children:e},e))})]})]}),c("div",{className:"flex items-center gap-1",children:[r("span",{className:"mr-2",children:_(y.dataGridPageOf,{page:A,total:ae})}),r("button",{type:"button",onClick:()=>R(1),disabled:A<=1,className:"px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":y.dataGridFirstPage,children:"\xAB\xAB"}),r("button",{type:"button",onClick:()=>R(A-1),disabled:A<=1,className:"px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":y.dataGridPreviousPage,children:"\xAB"}),r("button",{type:"button",onClick:()=>R(A+1),disabled:A>=ae,className:"px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":y.dataGridNextPage,children:"\xBB"}),r("button",{type:"button",onClick:()=>R(ae),disabled:A>=ae,className:"px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":y.dataGridLastPage,children:"\xBB\xBB"})]})]})]})}var _r=Cr(Wr);export{_r as DataGrid,Xr as resetRowKeyWarning};
@@ -1 +1 @@
1
- "use strict";"use client";var R=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var I=(t,a)=>{for(var r in a)R(t,r,{get:a[r],enumerable:!0})},V=(t,a,r,i)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of P(a))!L.call(t,d)&&d!==r&&R(t,d,{get:()=>a[d],enumerable:!(i=A(a,d))||i.enumerable});return t};var X=t=>V(R({},"__esModule",{value:!0}),t);var ee={};I(ee,{DeviceMockup:()=>$});module.exports=X(ee);var p=require("react"),o=require("../../lib/cn.cjs"),B=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime"),j={phone:{sm:{w:180,h:320},md:{w:240,h:480},lg:{w:300,h:600}},android:{sm:{w:180,h:320},md:{w:240,h:480},lg:{w:300,h:600}},tablet:{sm:{w:320,h:420},md:{w:420,h:560},lg:{w:540,h:720}},laptop:{sm:{w:400,h:250},md:{w:560,h:350},lg:{w:720,h:450}},desktop:{sm:{w:400,h:300},md:{w:560,h:400},lg:{w:720,h:520}},watch:{sm:{w:80,h:96},md:{w:120,h:144},lg:{w:160,h:192}},browser:{sm:{w:400,h:280},md:{w:560,h:380},lg:{w:720,h:480}}},q=({className:t})=>(0,e.jsxs)("svg",{className:(0,o.cn)("w-3 h-3",t),viewBox:"0 0 16 16",fill:"currentColor",children:[(0,e.jsx)("rect",{x:"1",y:"11",width:"2.5",height:"4",rx:"0.5"}),(0,e.jsx)("rect",{x:"5",y:"8",width:"2.5",height:"7",rx:"0.5"}),(0,e.jsx)("rect",{x:"9",y:"5",width:"2.5",height:"10",rx:"0.5"}),(0,e.jsx)("rect",{x:"13",y:"1",width:"2.5",height:"14",rx:"0.5"})]}),E=({className:t})=>(0,e.jsxs)("svg",{className:(0,o.cn)("w-3 h-3",t),viewBox:"0 0 20 20",fill:"currentColor",children:[(0,e.jsx)("path",{d:"M10 14.5a1.5 1.5 0 100 3 1.5 1.5 0 000-3z"}),(0,e.jsx)("path",{fillRule:"evenodd",d:"M6.05 11.95a5.5 5.5 0 017.9 0 .75.75 0 001.08-1.04 7 7 0 00-10.06 0 .75.75 0 001.08 1.04z",clipRule:"evenodd"}),(0,e.jsx)("path",{fillRule:"evenodd",d:"M2.81 8.72a10 10 0 0114.38 0 .75.75 0 001.06-1.06 11.5 11.5 0 00-16.5 0 .75.75 0 001.06 1.06z",clipRule:"evenodd"})]}),O=({className:t})=>(0,e.jsxs)("svg",{className:(0,o.cn)("w-4 h-3",t),viewBox:"0 0 24 14",fill:"currentColor",children:[(0,e.jsx)("rect",{x:"0.5",y:"0.5",width:"20",height:"13",rx:"2",stroke:"currentColor",fill:"none",strokeWidth:"1"}),(0,e.jsx)("rect",{x:"22",y:"4",width:"2",height:"6",rx:"0.5"}),(0,e.jsx)("rect",{x:"2.5",y:"2.5",width:"14",height:"9",rx:"1"})]});function f({time:t="9:41",theme:a,device:r}){let i=r==="watch",d=a==="dark"?"text-white":"text-gray-900";return i?(0,e.jsx)("div",{className:(0,o.cn)("flex items-center justify-center py-0.5",d),style:{fontSize:"8px"},children:(0,e.jsx)("span",{className:"font-medium",children:t})}):(0,e.jsxs)("div",{className:(0,o.cn)("flex items-center justify-between px-4 py-1",a==="dark"?"bg-black/20":"bg-white/20",d),style:{fontSize:"10px"},"data-testid":"status-bar",children:[(0,e.jsx)("span",{className:"font-semibold",children:t}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(q,{className:d}),(0,e.jsx)(E,{className:d}),(0,e.jsx)(O,{className:d})]})]})}function U({theme:t}){let a=t==="dark";return(0,e.jsxs)("div",{className:(0,o.cn)("flex items-center gap-2 px-3 py-2 border-b",a?"bg-gray-800 border-gray-700":"bg-gray-100 border-gray-200"),"data-testid":"browser-chrome",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)("div",{className:"w-2.5 h-2.5 rounded-full bg-red-400"}),(0,e.jsx)("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-400"}),(0,e.jsx)("div",{className:"w-2.5 h-2.5 rounded-full bg-green-400"})]}),(0,e.jsx)("div",{className:(0,o.cn)("flex-1 rounded-md px-3 py-1 text-center",a?"bg-gray-700 text-gray-400":"bg-white text-gray-500 border border-gray-200"),style:{fontSize:"11px"},children:(0,e.jsxs)("span",{className:"flex items-center justify-center gap-1",children:[(0,e.jsx)("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 16 16",fill:"currentColor",children:(0,e.jsx)("path",{fillRule:"evenodd",d:"M8 1a4 4 0 00-4 4v3.5H3a1 1 0 00-1 1V14a1 1 0 001 1h10a1 1 0 001-1V9.5a1 1 0 00-1-1h-1V5a4 4 0 00-4-4zm2.5 7.5V5a2.5 2.5 0 00-5 0v3.5h5z",clipRule:"evenodd"})}),"example.com"]})})]})}function Y({children:t,theme:a,screenW:r,screenH:i,showStatusBar:d,statusBarTime:s,frameColor:l,landscape:n=!1}){let h=a==="dark",c=l??(h?"#1a1a1a":"#e5e7eb");if(n){let m=Math.round(i*.35);return(0,e.jsxs)("div",{className:"relative inline-flex flex-row items-center rounded-[2.5rem] shadow-xl",style:{backgroundColor:c,padding:"8px 12px",height:i+16},"data-testid":"device-frame","data-device":"phone",children:[(0,e.jsx)("div",{className:(0,o.cn)("rounded-full mr-2",h?"bg-gray-600":"bg-gray-400"),style:{width:4,height:Math.round(i*.35)},"data-testid":"home-indicator"}),(0,e.jsxs)("div",{className:"rounded-[2rem] overflow-hidden bg-black relative",style:{width:r,height:i},children:[d&&(0,e.jsx)(f,{time:s,theme:a,device:"phone"}),t]}),(0,e.jsx)("div",{className:"absolute rounded-full bg-black z-10",style:{width:20,height:m,right:10,top:"50%",transform:"translateY(-50%)"},"data-testid":"phone-notch"})]})}let w=Math.round(r*.35);return(0,e.jsxs)("div",{className:"relative inline-flex flex-col items-center rounded-[2.5rem] shadow-xl",style:{backgroundColor:c,padding:"12px 8px",width:r+16},"data-testid":"device-frame","data-device":"phone",children:[(0,e.jsx)("div",{className:"absolute top-[10px] rounded-full bg-black z-10",style:{width:w,height:20,left:"50%",transform:"translateX(-50%)"},"data-testid":"phone-notch"}),(0,e.jsxs)("div",{className:"rounded-[2rem] overflow-hidden bg-black relative",style:{width:r,height:i},children:[d&&(0,e.jsx)(f,{time:s,theme:a,device:"phone"}),t]}),(0,e.jsx)("div",{className:(0,o.cn)("rounded-full mt-2",h?"bg-gray-600":"bg-gray-400"),style:{width:Math.round(r*.35),height:4},"data-testid":"home-indicator"})]})}function G({children:t,theme:a,screenW:r,screenH:i,showStatusBar:d,statusBarTime:s,frameColor:l}){return(0,e.jsxs)("div",{className:"relative inline-flex flex-col items-center rounded-[2rem] shadow-xl",style:{backgroundColor:l??(a==="dark"?"#1a1a1a":"#e5e7eb"),padding:"10px 6px",width:r+12},"data-testid":"device-frame","data-device":"android",children:[(0,e.jsx)("div",{className:"absolute top-[6px] rounded-full bg-gray-800 z-10 border border-gray-700",style:{width:8,height:8,left:"50%",transform:"translateX(-50%)"},"data-testid":"camera-dot"}),(0,e.jsxs)("div",{className:"rounded-[1.5rem] overflow-hidden bg-black relative",style:{width:r,height:i},children:[d&&(0,e.jsx)(f,{time:s,theme:a,device:"android"}),t]})]})}function J({children:t,theme:a,screenW:r,screenH:i,showStatusBar:d,statusBarTime:s,frameColor:l}){return(0,e.jsxs)("div",{className:"relative inline-flex flex-col items-center rounded-[1.5rem] shadow-xl",style:{backgroundColor:l??(a==="dark"?"#1a1a1a":"#e5e7eb"),padding:"16px 12px",width:r+24},"data-testid":"device-frame","data-device":"tablet",children:[(0,e.jsx)("div",{className:"absolute top-[8px] rounded-full bg-gray-700 z-10",style:{width:6,height:6,left:"50%",transform:"translateX(-50%)"}}),(0,e.jsxs)("div",{className:"rounded-lg overflow-hidden bg-black relative",style:{width:r,height:i},children:[d&&(0,e.jsx)(f,{time:s,theme:a,device:"tablet"}),t]})]})}function K({children:t,theme:a,screenW:r,screenH:i,frameColor:d}){let s=a==="dark",l=d??(s?"#1a1a1a":"#d1d5db"),n=r+60;return(0,e.jsxs)("div",{className:"inline-flex flex-col items-center","data-testid":"device-frame","data-device":"laptop",children:[(0,e.jsxs)("div",{className:"rounded-t-xl shadow-xl relative",style:{backgroundColor:l,padding:"8px 8px 0",width:r+16},children:[(0,e.jsx)("div",{className:"absolute top-[3px] rounded-full bg-gray-700 z-10",style:{width:4,height:4,left:"50%",transform:"translateX(-50%)"}}),(0,e.jsx)("div",{className:"rounded-t-sm overflow-hidden bg-black",style:{width:r,height:i},children:t})]}),(0,e.jsx)("div",{className:(0,o.cn)(s?"bg-gray-800":"bg-gray-400"),style:{width:r+16,height:3}}),(0,e.jsx)("div",{className:"rounded-b-xl shadow-lg",style:{backgroundColor:l,width:n,height:12,clipPath:"polygon(3% 0%, 97% 0%, 100% 100%, 0% 100%)"},"data-testid":"laptop-base"})]})}function Q({children:t,theme:a,screenW:r,screenH:i,frameColor:d}){let s=a==="dark";return(0,e.jsxs)("div",{className:"inline-flex flex-col items-center","data-testid":"device-frame","data-device":"desktop",children:[(0,e.jsx)("div",{className:"rounded-lg shadow-xl",style:{backgroundColor:d??(s?"#1a1a1a":"#d1d5db"),padding:"8px 8px 20px",width:r+16},children:(0,e.jsx)("div",{className:"rounded-sm overflow-hidden bg-black",style:{width:r,height:i},children:t})}),(0,e.jsx)("div",{className:(0,o.cn)(s?"bg-gray-800":"bg-gray-400"),style:{width:40,height:24},"data-testid":"monitor-stand"}),(0,e.jsx)("div",{className:(0,o.cn)("rounded-t-sm",s?"bg-gray-800":"bg-gray-400"),style:{width:Math.round(r*.4),height:6,borderRadius:"2px 2px 4px 4px"}})]})}function Z({children:t,theme:a,screenW:r,screenH:i,showStatusBar:d,statusBarTime:s,frameColor:l}){let n=a==="dark",h=l??(n?"#1a1a1a":"#d1d5db"),c=Math.round(r*.7);return(0,e.jsxs)("div",{className:"inline-flex flex-col items-center","data-testid":"device-frame","data-device":"watch",children:[(0,e.jsx)("div",{className:(0,o.cn)("rounded-t-lg",n?"bg-gray-800":"bg-gray-400"),style:{width:c,height:30},"data-testid":"watch-band"}),(0,e.jsxs)("div",{className:"relative rounded-[1.2rem] shadow-xl",style:{backgroundColor:h,padding:"8px 6px",width:r+12},children:[(0,e.jsx)("div",{className:(0,o.cn)("absolute rounded-sm",n?"bg-gray-600":"bg-gray-400"),style:{width:4,height:16,right:-4,top:"30%"},"data-testid":"watch-crown"}),(0,e.jsxs)("div",{className:"rounded-xl overflow-hidden bg-black",style:{width:r,height:i},children:[d&&(0,e.jsx)(f,{time:s,theme:a,device:"watch"}),t]})]}),(0,e.jsx)("div",{className:(0,o.cn)("rounded-b-lg",n?"bg-gray-800":"bg-gray-400"),style:{width:c,height:30}})]})}function _({children:t,theme:a,screenW:r,screenH:i,frameColor:d}){return(0,e.jsxs)("div",{className:"inline-flex flex-col rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:d??(a==="dark"?"#1f2937":"#f3f4f6"),width:r},"data-testid":"device-frame","data-device":"browser",children:[(0,e.jsx)(U,{theme:a}),(0,e.jsx)("div",{className:"overflow-hidden bg-white",style:{width:r,height:i},children:t})]})}function $({device:t="phone",src:a,alt:r,children:i,orientation:d="portrait",theme:s="dark",size:l="md",showStatusBar:n=!1,statusBarTime:h,animated:c=!1,scrollSpeed:w=30,frameColor:m,className:F,contentClassName:H}){let M=(0,B.useUILabels)(),D=(0,p.useRef)(null),x=(0,p.useRef)(null),y=j[t][l],C=d==="landscape"&&t!=="watch"&&t!=="browser",g=C?y.h:y.w,u=C?y.w:y.h;(0,p.useEffect)(()=>{if(!c||!D.current)return;let b=D.current,k=null,z=T=>{k===null&&(k=T);let W=(T-k)/1e3;k=T,b.scrollTop+=w*W,b.scrollTop>=b.scrollHeight-b.clientHeight&&(b.scrollTop=0),x.current=requestAnimationFrame(z)};return x.current=requestAnimationFrame(z),()=>{x.current!==null&&cancelAnimationFrame(x.current)}},[c,w]);let v=(0,e.jsx)("div",{ref:c?D:void 0,className:(0,o.cn)("w-full h-full overflow-hidden",c&&"overflow-y-auto scrollbar-hide",H),style:c?{scrollBehavior:"auto"}:void 0,children:a?(0,e.jsx)("img",{src:a,alt:r??M.deviceMockupAlt,className:"w-full h-auto object-cover",draggable:!1}):i}),N={showStatusBar:n,statusBarTime:h},S=()=>{switch(t){case"phone":return(0,e.jsx)(Y,{theme:s,screenW:g,screenH:u,frameColor:m,landscape:C,...N,children:v});case"android":return(0,e.jsx)(G,{theme:s,screenW:g,screenH:u,frameColor:m,...N,children:v});case"tablet":return(0,e.jsx)(J,{theme:s,screenW:g,screenH:u,frameColor:m,...N,children:v});case"laptop":return(0,e.jsx)(K,{theme:s,screenW:g,screenH:u,frameColor:m,children:v});case"desktop":return(0,e.jsx)(Q,{theme:s,screenW:g,screenH:u,frameColor:m,children:v});case"watch":return(0,e.jsx)(Z,{theme:s,screenW:g,screenH:u,frameColor:m,...N,children:v});case"browser":return(0,e.jsx)(_,{theme:s,screenW:g,screenH:u,frameColor:m,children:v})}};return(0,e.jsx)("div",{className:(0,o.cn)("inline-flex",F),"data-testid":"device-mockup","data-orientation":d,"data-theme":s,"data-size":l,children:S()})}0&&(module.exports={DeviceMockup});
1
+ "use strict";"use client";var R=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var I=(t,a)=>{for(var r in a)R(t,r,{get:a[r],enumerable:!0})},V=(t,a,r,i)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of P(a))!L.call(t,d)&&d!==r&&R(t,d,{get:()=>a[d],enumerable:!(i=A(a,d))||i.enumerable});return t};var X=t=>V(R({},"__esModule",{value:!0}),t);var ee={};I(ee,{DeviceMockup:()=>$});module.exports=X(ee);var p=require("react"),o=require("../../lib/cn.cjs"),B=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime"),j={phone:{sm:{w:180,h:320},md:{w:240,h:480},lg:{w:300,h:600}},android:{sm:{w:180,h:320},md:{w:240,h:480},lg:{w:300,h:600}},tablet:{sm:{w:320,h:420},md:{w:420,h:560},lg:{w:540,h:720}},laptop:{sm:{w:400,h:250},md:{w:560,h:350},lg:{w:720,h:450}},desktop:{sm:{w:400,h:300},md:{w:560,h:400},lg:{w:720,h:520}},watch:{sm:{w:80,h:96},md:{w:120,h:144},lg:{w:160,h:192}},browser:{sm:{w:400,h:280},md:{w:560,h:380},lg:{w:720,h:480}}},q=({className:t})=>(0,e.jsxs)("svg",{className:(0,o.cn)("w-3 h-3",t),viewBox:"0 0 16 16",fill:"currentColor",children:[(0,e.jsx)("rect",{x:"1",y:"11",width:"2.5",height:"4",rx:"0.5"}),(0,e.jsx)("rect",{x:"5",y:"8",width:"2.5",height:"7",rx:"0.5"}),(0,e.jsx)("rect",{x:"9",y:"5",width:"2.5",height:"10",rx:"0.5"}),(0,e.jsx)("rect",{x:"13",y:"1",width:"2.5",height:"14",rx:"0.5"})]}),E=({className:t})=>(0,e.jsxs)("svg",{className:(0,o.cn)("w-3 h-3",t),viewBox:"0 0 20 20",fill:"currentColor",children:[(0,e.jsx)("path",{d:"M10 14.5a1.5 1.5 0 100 3 1.5 1.5 0 000-3z"}),(0,e.jsx)("path",{fillRule:"evenodd",d:"M6.05 11.95a5.5 5.5 0 017.9 0 .75.75 0 001.08-1.04 7 7 0 00-10.06 0 .75.75 0 001.08 1.04z",clipRule:"evenodd"}),(0,e.jsx)("path",{fillRule:"evenodd",d:"M2.81 8.72a10 10 0 0114.38 0 .75.75 0 001.06-1.06 11.5 11.5 0 00-16.5 0 .75.75 0 001.06 1.06z",clipRule:"evenodd"})]}),O=({className:t})=>(0,e.jsxs)("svg",{className:(0,o.cn)("w-4 h-3",t),viewBox:"0 0 24 14",fill:"currentColor",children:[(0,e.jsx)("rect",{x:"0.5",y:"0.5",width:"20",height:"13",rx:"2",stroke:"currentColor",fill:"none",strokeWidth:"1"}),(0,e.jsx)("rect",{x:"22",y:"4",width:"2",height:"6",rx:"0.5"}),(0,e.jsx)("rect",{x:"2.5",y:"2.5",width:"14",height:"9",rx:"1"})]});function f({time:t="9:41",theme:a,device:r}){let i=r==="watch",d=a==="dark"?"text-white":"text-gray-900";return i?(0,e.jsx)("div",{className:(0,o.cn)("flex items-center justify-center py-0.5",d),style:{fontSize:"8px"},children:(0,e.jsx)("span",{className:"font-medium",children:t})}):(0,e.jsxs)("div",{className:(0,o.cn)("flex items-center justify-between px-4 py-1",a==="dark"?"bg-black/20":"bg-white/20",d),style:{fontSize:"10px"},"data-testid":"status-bar",children:[(0,e.jsx)("span",{className:"font-semibold",children:t}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(q,{className:d}),(0,e.jsx)(E,{className:d}),(0,e.jsx)(O,{className:d})]})]})}function U({theme:t}){let a=t==="dark";return(0,e.jsxs)("div",{className:(0,o.cn)("flex items-center gap-2 px-3 py-2 border-b",a?"bg-gray-800 border-gray-700":"bg-gray-100 border-gray-200"),"data-testid":"browser-chrome",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)("div",{className:"w-2.5 h-2.5 rounded-full bg-red-400"}),(0,e.jsx)("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-400"}),(0,e.jsx)("div",{className:"w-2.5 h-2.5 rounded-full bg-green-400"})]}),(0,e.jsx)("div",{className:(0,o.cn)("flex-1 rounded-md px-3 py-1 text-center",a?"bg-gray-700 text-gray-300":"bg-white text-gray-500 border border-gray-200"),style:{fontSize:"11px"},children:(0,e.jsxs)("span",{className:"flex items-center justify-center gap-1",children:[(0,e.jsx)("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 16 16",fill:"currentColor",children:(0,e.jsx)("path",{fillRule:"evenodd",d:"M8 1a4 4 0 00-4 4v3.5H3a1 1 0 00-1 1V14a1 1 0 001 1h10a1 1 0 001-1V9.5a1 1 0 00-1-1h-1V5a4 4 0 00-4-4zm2.5 7.5V5a2.5 2.5 0 00-5 0v3.5h5z",clipRule:"evenodd"})}),"example.com"]})})]})}function Y({children:t,theme:a,screenW:r,screenH:i,showStatusBar:d,statusBarTime:s,frameColor:l,landscape:n=!1}){let h=a==="dark",c=l??(h?"#1a1a1a":"#e5e7eb");if(n){let m=Math.round(i*.35);return(0,e.jsxs)("div",{className:"relative inline-flex flex-row items-center rounded-[2.5rem] shadow-xl",style:{backgroundColor:c,padding:"8px 12px",height:i+16},"data-testid":"device-frame","data-device":"phone",children:[(0,e.jsx)("div",{className:(0,o.cn)("rounded-full mr-2",h?"bg-gray-600":"bg-gray-400"),style:{width:4,height:Math.round(i*.35)},"data-testid":"home-indicator"}),(0,e.jsxs)("div",{className:"rounded-[2rem] overflow-hidden bg-black relative",style:{width:r,height:i},children:[d&&(0,e.jsx)(f,{time:s,theme:a,device:"phone"}),t]}),(0,e.jsx)("div",{className:"absolute rounded-full bg-black z-10",style:{width:20,height:m,right:10,top:"50%",transform:"translateY(-50%)"},"data-testid":"phone-notch"})]})}let w=Math.round(r*.35);return(0,e.jsxs)("div",{className:"relative inline-flex flex-col items-center rounded-[2.5rem] shadow-xl",style:{backgroundColor:c,padding:"12px 8px",width:r+16},"data-testid":"device-frame","data-device":"phone",children:[(0,e.jsx)("div",{className:"absolute top-[10px] rounded-full bg-black z-10",style:{width:w,height:20,left:"50%",transform:"translateX(-50%)"},"data-testid":"phone-notch"}),(0,e.jsxs)("div",{className:"rounded-[2rem] overflow-hidden bg-black relative",style:{width:r,height:i},children:[d&&(0,e.jsx)(f,{time:s,theme:a,device:"phone"}),t]}),(0,e.jsx)("div",{className:(0,o.cn)("rounded-full mt-2",h?"bg-gray-600":"bg-gray-400"),style:{width:Math.round(r*.35),height:4},"data-testid":"home-indicator"})]})}function G({children:t,theme:a,screenW:r,screenH:i,showStatusBar:d,statusBarTime:s,frameColor:l}){return(0,e.jsxs)("div",{className:"relative inline-flex flex-col items-center rounded-[2rem] shadow-xl",style:{backgroundColor:l??(a==="dark"?"#1a1a1a":"#e5e7eb"),padding:"10px 6px",width:r+12},"data-testid":"device-frame","data-device":"android",children:[(0,e.jsx)("div",{className:"absolute top-[6px] rounded-full bg-gray-800 z-10 border border-gray-700",style:{width:8,height:8,left:"50%",transform:"translateX(-50%)"},"data-testid":"camera-dot"}),(0,e.jsxs)("div",{className:"rounded-[1.5rem] overflow-hidden bg-black relative",style:{width:r,height:i},children:[d&&(0,e.jsx)(f,{time:s,theme:a,device:"android"}),t]})]})}function J({children:t,theme:a,screenW:r,screenH:i,showStatusBar:d,statusBarTime:s,frameColor:l}){return(0,e.jsxs)("div",{className:"relative inline-flex flex-col items-center rounded-[1.5rem] shadow-xl",style:{backgroundColor:l??(a==="dark"?"#1a1a1a":"#e5e7eb"),padding:"16px 12px",width:r+24},"data-testid":"device-frame","data-device":"tablet",children:[(0,e.jsx)("div",{className:"absolute top-[8px] rounded-full bg-gray-700 z-10",style:{width:6,height:6,left:"50%",transform:"translateX(-50%)"}}),(0,e.jsxs)("div",{className:"rounded-lg overflow-hidden bg-black relative",style:{width:r,height:i},children:[d&&(0,e.jsx)(f,{time:s,theme:a,device:"tablet"}),t]})]})}function K({children:t,theme:a,screenW:r,screenH:i,frameColor:d}){let s=a==="dark",l=d??(s?"#1a1a1a":"#d1d5db"),n=r+60;return(0,e.jsxs)("div",{className:"inline-flex flex-col items-center","data-testid":"device-frame","data-device":"laptop",children:[(0,e.jsxs)("div",{className:"rounded-t-xl shadow-xl relative",style:{backgroundColor:l,padding:"8px 8px 0",width:r+16},children:[(0,e.jsx)("div",{className:"absolute top-[3px] rounded-full bg-gray-700 z-10",style:{width:4,height:4,left:"50%",transform:"translateX(-50%)"}}),(0,e.jsx)("div",{className:"rounded-t-sm overflow-hidden bg-black",style:{width:r,height:i},children:t})]}),(0,e.jsx)("div",{className:(0,o.cn)(s?"bg-gray-800":"bg-gray-400"),style:{width:r+16,height:3}}),(0,e.jsx)("div",{className:"rounded-b-xl shadow-lg",style:{backgroundColor:l,width:n,height:12,clipPath:"polygon(3% 0%, 97% 0%, 100% 100%, 0% 100%)"},"data-testid":"laptop-base"})]})}function Q({children:t,theme:a,screenW:r,screenH:i,frameColor:d}){let s=a==="dark";return(0,e.jsxs)("div",{className:"inline-flex flex-col items-center","data-testid":"device-frame","data-device":"desktop",children:[(0,e.jsx)("div",{className:"rounded-lg shadow-xl",style:{backgroundColor:d??(s?"#1a1a1a":"#d1d5db"),padding:"8px 8px 20px",width:r+16},children:(0,e.jsx)("div",{className:"rounded-sm overflow-hidden bg-black",style:{width:r,height:i},children:t})}),(0,e.jsx)("div",{className:(0,o.cn)(s?"bg-gray-800":"bg-gray-400"),style:{width:40,height:24},"data-testid":"monitor-stand"}),(0,e.jsx)("div",{className:(0,o.cn)("rounded-t-sm",s?"bg-gray-800":"bg-gray-400"),style:{width:Math.round(r*.4),height:6,borderRadius:"2px 2px 4px 4px"}})]})}function Z({children:t,theme:a,screenW:r,screenH:i,showStatusBar:d,statusBarTime:s,frameColor:l}){let n=a==="dark",h=l??(n?"#1a1a1a":"#d1d5db"),c=Math.round(r*.7);return(0,e.jsxs)("div",{className:"inline-flex flex-col items-center","data-testid":"device-frame","data-device":"watch",children:[(0,e.jsx)("div",{className:(0,o.cn)("rounded-t-lg",n?"bg-gray-800":"bg-gray-400"),style:{width:c,height:30},"data-testid":"watch-band"}),(0,e.jsxs)("div",{className:"relative rounded-[1.2rem] shadow-xl",style:{backgroundColor:h,padding:"8px 6px",width:r+12},children:[(0,e.jsx)("div",{className:(0,o.cn)("absolute rounded-sm",n?"bg-gray-600":"bg-gray-400"),style:{width:4,height:16,right:-4,top:"30%"},"data-testid":"watch-crown"}),(0,e.jsxs)("div",{className:"rounded-xl overflow-hidden bg-black",style:{width:r,height:i},children:[d&&(0,e.jsx)(f,{time:s,theme:a,device:"watch"}),t]})]}),(0,e.jsx)("div",{className:(0,o.cn)("rounded-b-lg",n?"bg-gray-800":"bg-gray-400"),style:{width:c,height:30}})]})}function _({children:t,theme:a,screenW:r,screenH:i,frameColor:d}){return(0,e.jsxs)("div",{className:"inline-flex flex-col rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:d??(a==="dark"?"#1f2937":"#f3f4f6"),width:r},"data-testid":"device-frame","data-device":"browser",children:[(0,e.jsx)(U,{theme:a}),(0,e.jsx)("div",{className:"overflow-hidden bg-white",style:{width:r,height:i},children:t})]})}function $({device:t="phone",src:a,alt:r,children:i,orientation:d="portrait",theme:s="dark",size:l="md",showStatusBar:n=!1,statusBarTime:h,animated:c=!1,scrollSpeed:w=30,frameColor:m,className:F,contentClassName:H}){let M=(0,B.useUILabels)(),D=(0,p.useRef)(null),x=(0,p.useRef)(null),y=j[t][l],C=d==="landscape"&&t!=="watch"&&t!=="browser",g=C?y.h:y.w,u=C?y.w:y.h;(0,p.useEffect)(()=>{if(!c||!D.current)return;let b=D.current,k=null,z=T=>{k===null&&(k=T);let W=(T-k)/1e3;k=T,b.scrollTop+=w*W,b.scrollTop>=b.scrollHeight-b.clientHeight&&(b.scrollTop=0),x.current=requestAnimationFrame(z)};return x.current=requestAnimationFrame(z),()=>{x.current!==null&&cancelAnimationFrame(x.current)}},[c,w]);let v=(0,e.jsx)("div",{ref:c?D:void 0,className:(0,o.cn)("w-full h-full overflow-hidden",c&&"overflow-y-auto scrollbar-hide",H),style:c?{scrollBehavior:"auto"}:void 0,children:a?(0,e.jsx)("img",{src:a,alt:r??M.deviceMockupAlt,className:"w-full h-auto object-cover",draggable:!1}):i}),N={showStatusBar:n,statusBarTime:h},S=()=>{switch(t){case"phone":return(0,e.jsx)(Y,{theme:s,screenW:g,screenH:u,frameColor:m,landscape:C,...N,children:v});case"android":return(0,e.jsx)(G,{theme:s,screenW:g,screenH:u,frameColor:m,...N,children:v});case"tablet":return(0,e.jsx)(J,{theme:s,screenW:g,screenH:u,frameColor:m,...N,children:v});case"laptop":return(0,e.jsx)(K,{theme:s,screenW:g,screenH:u,frameColor:m,children:v});case"desktop":return(0,e.jsx)(Q,{theme:s,screenW:g,screenH:u,frameColor:m,children:v});case"watch":return(0,e.jsx)(Z,{theme:s,screenW:g,screenH:u,frameColor:m,...N,children:v});case"browser":return(0,e.jsx)(_,{theme:s,screenW:g,screenH:u,frameColor:m,children:v})}};return(0,e.jsx)("div",{className:(0,o.cn)("inline-flex",F),"data-testid":"device-mockup","data-orientation":d,"data-theme":s,"data-size":l,children:S()})}0&&(module.exports={DeviceMockup});
@@ -1 +1 @@
1
- "use client";import{useRef as z,useEffect as W}from"react";import{cn as l}from"../../lib/cn.js";import{useUILabels as A}from"../../lib/i18n.js";import{jsx as e,jsxs as i}from"react/jsx-runtime";var P={phone:{sm:{w:180,h:320},md:{w:240,h:480},lg:{w:300,h:600}},android:{sm:{w:180,h:320},md:{w:240,h:480},lg:{w:300,h:600}},tablet:{sm:{w:320,h:420},md:{w:420,h:560},lg:{w:540,h:720}},laptop:{sm:{w:400,h:250},md:{w:560,h:350},lg:{w:720,h:450}},desktop:{sm:{w:400,h:300},md:{w:560,h:400},lg:{w:720,h:520}},watch:{sm:{w:80,h:96},md:{w:120,h:144},lg:{w:160,h:192}},browser:{sm:{w:400,h:280},md:{w:560,h:380},lg:{w:720,h:480}}},L=({className:a})=>i("svg",{className:l("w-3 h-3",a),viewBox:"0 0 16 16",fill:"currentColor",children:[e("rect",{x:"1",y:"11",width:"2.5",height:"4",rx:"0.5"}),e("rect",{x:"5",y:"8",width:"2.5",height:"7",rx:"0.5"}),e("rect",{x:"9",y:"5",width:"2.5",height:"10",rx:"0.5"}),e("rect",{x:"13",y:"1",width:"2.5",height:"14",rx:"0.5"})]}),I=({className:a})=>i("svg",{className:l("w-3 h-3",a),viewBox:"0 0 20 20",fill:"currentColor",children:[e("path",{d:"M10 14.5a1.5 1.5 0 100 3 1.5 1.5 0 000-3z"}),e("path",{fillRule:"evenodd",d:"M6.05 11.95a5.5 5.5 0 017.9 0 .75.75 0 001.08-1.04 7 7 0 00-10.06 0 .75.75 0 001.08 1.04z",clipRule:"evenodd"}),e("path",{fillRule:"evenodd",d:"M2.81 8.72a10 10 0 0114.38 0 .75.75 0 001.06-1.06 11.5 11.5 0 00-16.5 0 .75.75 0 001.06 1.06z",clipRule:"evenodd"})]}),V=({className:a})=>i("svg",{className:l("w-4 h-3",a),viewBox:"0 0 24 14",fill:"currentColor",children:[e("rect",{x:"0.5",y:"0.5",width:"20",height:"13",rx:"2",stroke:"currentColor",fill:"none",strokeWidth:"1"}),e("rect",{x:"22",y:"4",width:"2",height:"6",rx:"0.5"}),e("rect",{x:"2.5",y:"2.5",width:"14",height:"9",rx:"1"})]});function f({time:a="9:41",theme:r,device:t}){let o=t==="watch",s=r==="dark"?"text-white":"text-gray-900";return o?e("div",{className:l("flex items-center justify-center py-0.5",s),style:{fontSize:"8px"},children:e("span",{className:"font-medium",children:a})}):i("div",{className:l("flex items-center justify-between px-4 py-1",r==="dark"?"bg-black/20":"bg-white/20",s),style:{fontSize:"10px"},"data-testid":"status-bar",children:[e("span",{className:"font-semibold",children:a}),i("div",{className:"flex items-center gap-1",children:[e(L,{className:s}),e(I,{className:s}),e(V,{className:s})]})]})}function X({theme:a}){let r=a==="dark";return i("div",{className:l("flex items-center gap-2 px-3 py-2 border-b",r?"bg-gray-800 border-gray-700":"bg-gray-100 border-gray-200"),"data-testid":"browser-chrome",children:[i("div",{className:"flex items-center gap-1.5",children:[e("div",{className:"w-2.5 h-2.5 rounded-full bg-red-400"}),e("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-400"}),e("div",{className:"w-2.5 h-2.5 rounded-full bg-green-400"})]}),e("div",{className:l("flex-1 rounded-md px-3 py-1 text-center",r?"bg-gray-700 text-gray-400":"bg-white text-gray-500 border border-gray-200"),style:{fontSize:"11px"},children:i("span",{className:"flex items-center justify-center gap-1",children:[e("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 16 16",fill:"currentColor",children:e("path",{fillRule:"evenodd",d:"M8 1a4 4 0 00-4 4v3.5H3a1 1 0 00-1 1V14a1 1 0 001 1h10a1 1 0 001-1V9.5a1 1 0 00-1-1h-1V5a4 4 0 00-4-4zm2.5 7.5V5a2.5 2.5 0 00-5 0v3.5h5z",clipRule:"evenodd"})}),"example.com"]})})]})}function j({children:a,theme:r,screenW:t,screenH:o,showStatusBar:s,statusBarTime:d,frameColor:n,landscape:c=!1}){let m=r==="dark",h=n??(m?"#1a1a1a":"#e5e7eb");if(c){let g=Math.round(o*.35);return i("div",{className:"relative inline-flex flex-row items-center rounded-[2.5rem] shadow-xl",style:{backgroundColor:h,padding:"8px 12px",height:o+16},"data-testid":"device-frame","data-device":"phone",children:[e("div",{className:l("rounded-full mr-2",m?"bg-gray-600":"bg-gray-400"),style:{width:4,height:Math.round(o*.35)},"data-testid":"home-indicator"}),i("div",{className:"rounded-[2rem] overflow-hidden bg-black relative",style:{width:t,height:o},children:[s&&e(f,{time:d,theme:r,device:"phone"}),a]}),e("div",{className:"absolute rounded-full bg-black z-10",style:{width:20,height:g,right:10,top:"50%",transform:"translateY(-50%)"},"data-testid":"phone-notch"})]})}let w=Math.round(t*.35);return i("div",{className:"relative inline-flex flex-col items-center rounded-[2.5rem] shadow-xl",style:{backgroundColor:h,padding:"12px 8px",width:t+16},"data-testid":"device-frame","data-device":"phone",children:[e("div",{className:"absolute top-[10px] rounded-full bg-black z-10",style:{width:w,height:20,left:"50%",transform:"translateX(-50%)"},"data-testid":"phone-notch"}),i("div",{className:"rounded-[2rem] overflow-hidden bg-black relative",style:{width:t,height:o},children:[s&&e(f,{time:d,theme:r,device:"phone"}),a]}),e("div",{className:l("rounded-full mt-2",m?"bg-gray-600":"bg-gray-400"),style:{width:Math.round(t*.35),height:4},"data-testid":"home-indicator"})]})}function q({children:a,theme:r,screenW:t,screenH:o,showStatusBar:s,statusBarTime:d,frameColor:n}){return i("div",{className:"relative inline-flex flex-col items-center rounded-[2rem] shadow-xl",style:{backgroundColor:n??(r==="dark"?"#1a1a1a":"#e5e7eb"),padding:"10px 6px",width:t+12},"data-testid":"device-frame","data-device":"android",children:[e("div",{className:"absolute top-[6px] rounded-full bg-gray-800 z-10 border border-gray-700",style:{width:8,height:8,left:"50%",transform:"translateX(-50%)"},"data-testid":"camera-dot"}),i("div",{className:"rounded-[1.5rem] overflow-hidden bg-black relative",style:{width:t,height:o},children:[s&&e(f,{time:d,theme:r,device:"android"}),a]})]})}function E({children:a,theme:r,screenW:t,screenH:o,showStatusBar:s,statusBarTime:d,frameColor:n}){return i("div",{className:"relative inline-flex flex-col items-center rounded-[1.5rem] shadow-xl",style:{backgroundColor:n??(r==="dark"?"#1a1a1a":"#e5e7eb"),padding:"16px 12px",width:t+24},"data-testid":"device-frame","data-device":"tablet",children:[e("div",{className:"absolute top-[8px] rounded-full bg-gray-700 z-10",style:{width:6,height:6,left:"50%",transform:"translateX(-50%)"}}),i("div",{className:"rounded-lg overflow-hidden bg-black relative",style:{width:t,height:o},children:[s&&e(f,{time:d,theme:r,device:"tablet"}),a]})]})}function O({children:a,theme:r,screenW:t,screenH:o,frameColor:s}){let d=r==="dark",n=s??(d?"#1a1a1a":"#d1d5db"),c=t+60;return i("div",{className:"inline-flex flex-col items-center","data-testid":"device-frame","data-device":"laptop",children:[i("div",{className:"rounded-t-xl shadow-xl relative",style:{backgroundColor:n,padding:"8px 8px 0",width:t+16},children:[e("div",{className:"absolute top-[3px] rounded-full bg-gray-700 z-10",style:{width:4,height:4,left:"50%",transform:"translateX(-50%)"}}),e("div",{className:"rounded-t-sm overflow-hidden bg-black",style:{width:t,height:o},children:a})]}),e("div",{className:l(d?"bg-gray-800":"bg-gray-400"),style:{width:t+16,height:3}}),e("div",{className:"rounded-b-xl shadow-lg",style:{backgroundColor:n,width:c,height:12,clipPath:"polygon(3% 0%, 97% 0%, 100% 100%, 0% 100%)"},"data-testid":"laptop-base"})]})}function U({children:a,theme:r,screenW:t,screenH:o,frameColor:s}){let d=r==="dark";return i("div",{className:"inline-flex flex-col items-center","data-testid":"device-frame","data-device":"desktop",children:[e("div",{className:"rounded-lg shadow-xl",style:{backgroundColor:s??(d?"#1a1a1a":"#d1d5db"),padding:"8px 8px 20px",width:t+16},children:e("div",{className:"rounded-sm overflow-hidden bg-black",style:{width:t,height:o},children:a})}),e("div",{className:l(d?"bg-gray-800":"bg-gray-400"),style:{width:40,height:24},"data-testid":"monitor-stand"}),e("div",{className:l("rounded-t-sm",d?"bg-gray-800":"bg-gray-400"),style:{width:Math.round(t*.4),height:6,borderRadius:"2px 2px 4px 4px"}})]})}function Y({children:a,theme:r,screenW:t,screenH:o,showStatusBar:s,statusBarTime:d,frameColor:n}){let c=r==="dark",m=n??(c?"#1a1a1a":"#d1d5db"),h=Math.round(t*.7);return i("div",{className:"inline-flex flex-col items-center","data-testid":"device-frame","data-device":"watch",children:[e("div",{className:l("rounded-t-lg",c?"bg-gray-800":"bg-gray-400"),style:{width:h,height:30},"data-testid":"watch-band"}),i("div",{className:"relative rounded-[1.2rem] shadow-xl",style:{backgroundColor:m,padding:"8px 6px",width:t+12},children:[e("div",{className:l("absolute rounded-sm",c?"bg-gray-600":"bg-gray-400"),style:{width:4,height:16,right:-4,top:"30%"},"data-testid":"watch-crown"}),i("div",{className:"rounded-xl overflow-hidden bg-black",style:{width:t,height:o},children:[s&&e(f,{time:d,theme:r,device:"watch"}),a]})]}),e("div",{className:l("rounded-b-lg",c?"bg-gray-800":"bg-gray-400"),style:{width:h,height:30}})]})}function G({children:a,theme:r,screenW:t,screenH:o,frameColor:s}){return i("div",{className:"inline-flex flex-col rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:s??(r==="dark"?"#1f2937":"#f3f4f6"),width:t},"data-testid":"device-frame","data-device":"browser",children:[e(X,{theme:r}),e("div",{className:"overflow-hidden bg-white",style:{width:t,height:o},children:a})]})}function Z({device:a="phone",src:r,alt:t,children:o,orientation:s="portrait",theme:d="dark",size:n="md",showStatusBar:c=!1,statusBarTime:m,animated:h=!1,scrollSpeed:w=30,frameColor:g,className:B,contentClassName:F}){let H=A(),D=z(null),x=z(null),y=P[a][n],C=s==="landscape"&&a!=="watch"&&a!=="browser",u=C?y.h:y.w,v=C?y.w:y.h;W(()=>{if(!h||!D.current)return;let p=D.current,k=null,R=T=>{k===null&&(k=T);let S=(T-k)/1e3;k=T,p.scrollTop+=w*S,p.scrollTop>=p.scrollHeight-p.clientHeight&&(p.scrollTop=0),x.current=requestAnimationFrame(R)};return x.current=requestAnimationFrame(R),()=>{x.current!==null&&cancelAnimationFrame(x.current)}},[h,w]);let b=e("div",{ref:h?D:void 0,className:l("w-full h-full overflow-hidden",h&&"overflow-y-auto scrollbar-hide",F),style:h?{scrollBehavior:"auto"}:void 0,children:r?e("img",{src:r,alt:t??H.deviceMockupAlt,className:"w-full h-auto object-cover",draggable:!1}):o}),N={showStatusBar:c,statusBarTime:m},M=()=>{switch(a){case"phone":return e(j,{theme:d,screenW:u,screenH:v,frameColor:g,landscape:C,...N,children:b});case"android":return e(q,{theme:d,screenW:u,screenH:v,frameColor:g,...N,children:b});case"tablet":return e(E,{theme:d,screenW:u,screenH:v,frameColor:g,...N,children:b});case"laptop":return e(O,{theme:d,screenW:u,screenH:v,frameColor:g,children:b});case"desktop":return e(U,{theme:d,screenW:u,screenH:v,frameColor:g,children:b});case"watch":return e(Y,{theme:d,screenW:u,screenH:v,frameColor:g,...N,children:b});case"browser":return e(G,{theme:d,screenW:u,screenH:v,frameColor:g,children:b})}};return e("div",{className:l("inline-flex",B),"data-testid":"device-mockup","data-orientation":s,"data-theme":d,"data-size":n,children:M()})}export{Z as DeviceMockup};
1
+ "use client";import{useRef as z,useEffect as W}from"react";import{cn as l}from"../../lib/cn.js";import{useUILabels as A}from"../../lib/i18n.js";import{jsx as e,jsxs as i}from"react/jsx-runtime";var P={phone:{sm:{w:180,h:320},md:{w:240,h:480},lg:{w:300,h:600}},android:{sm:{w:180,h:320},md:{w:240,h:480},lg:{w:300,h:600}},tablet:{sm:{w:320,h:420},md:{w:420,h:560},lg:{w:540,h:720}},laptop:{sm:{w:400,h:250},md:{w:560,h:350},lg:{w:720,h:450}},desktop:{sm:{w:400,h:300},md:{w:560,h:400},lg:{w:720,h:520}},watch:{sm:{w:80,h:96},md:{w:120,h:144},lg:{w:160,h:192}},browser:{sm:{w:400,h:280},md:{w:560,h:380},lg:{w:720,h:480}}},L=({className:a})=>i("svg",{className:l("w-3 h-3",a),viewBox:"0 0 16 16",fill:"currentColor",children:[e("rect",{x:"1",y:"11",width:"2.5",height:"4",rx:"0.5"}),e("rect",{x:"5",y:"8",width:"2.5",height:"7",rx:"0.5"}),e("rect",{x:"9",y:"5",width:"2.5",height:"10",rx:"0.5"}),e("rect",{x:"13",y:"1",width:"2.5",height:"14",rx:"0.5"})]}),I=({className:a})=>i("svg",{className:l("w-3 h-3",a),viewBox:"0 0 20 20",fill:"currentColor",children:[e("path",{d:"M10 14.5a1.5 1.5 0 100 3 1.5 1.5 0 000-3z"}),e("path",{fillRule:"evenodd",d:"M6.05 11.95a5.5 5.5 0 017.9 0 .75.75 0 001.08-1.04 7 7 0 00-10.06 0 .75.75 0 001.08 1.04z",clipRule:"evenodd"}),e("path",{fillRule:"evenodd",d:"M2.81 8.72a10 10 0 0114.38 0 .75.75 0 001.06-1.06 11.5 11.5 0 00-16.5 0 .75.75 0 001.06 1.06z",clipRule:"evenodd"})]}),V=({className:a})=>i("svg",{className:l("w-4 h-3",a),viewBox:"0 0 24 14",fill:"currentColor",children:[e("rect",{x:"0.5",y:"0.5",width:"20",height:"13",rx:"2",stroke:"currentColor",fill:"none",strokeWidth:"1"}),e("rect",{x:"22",y:"4",width:"2",height:"6",rx:"0.5"}),e("rect",{x:"2.5",y:"2.5",width:"14",height:"9",rx:"1"})]});function f({time:a="9:41",theme:r,device:t}){let o=t==="watch",s=r==="dark"?"text-white":"text-gray-900";return o?e("div",{className:l("flex items-center justify-center py-0.5",s),style:{fontSize:"8px"},children:e("span",{className:"font-medium",children:a})}):i("div",{className:l("flex items-center justify-between px-4 py-1",r==="dark"?"bg-black/20":"bg-white/20",s),style:{fontSize:"10px"},"data-testid":"status-bar",children:[e("span",{className:"font-semibold",children:a}),i("div",{className:"flex items-center gap-1",children:[e(L,{className:s}),e(I,{className:s}),e(V,{className:s})]})]})}function X({theme:a}){let r=a==="dark";return i("div",{className:l("flex items-center gap-2 px-3 py-2 border-b",r?"bg-gray-800 border-gray-700":"bg-gray-100 border-gray-200"),"data-testid":"browser-chrome",children:[i("div",{className:"flex items-center gap-1.5",children:[e("div",{className:"w-2.5 h-2.5 rounded-full bg-red-400"}),e("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-400"}),e("div",{className:"w-2.5 h-2.5 rounded-full bg-green-400"})]}),e("div",{className:l("flex-1 rounded-md px-3 py-1 text-center",r?"bg-gray-700 text-gray-300":"bg-white text-gray-500 border border-gray-200"),style:{fontSize:"11px"},children:i("span",{className:"flex items-center justify-center gap-1",children:[e("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 16 16",fill:"currentColor",children:e("path",{fillRule:"evenodd",d:"M8 1a4 4 0 00-4 4v3.5H3a1 1 0 00-1 1V14a1 1 0 001 1h10a1 1 0 001-1V9.5a1 1 0 00-1-1h-1V5a4 4 0 00-4-4zm2.5 7.5V5a2.5 2.5 0 00-5 0v3.5h5z",clipRule:"evenodd"})}),"example.com"]})})]})}function j({children:a,theme:r,screenW:t,screenH:o,showStatusBar:s,statusBarTime:d,frameColor:n,landscape:c=!1}){let m=r==="dark",h=n??(m?"#1a1a1a":"#e5e7eb");if(c){let g=Math.round(o*.35);return i("div",{className:"relative inline-flex flex-row items-center rounded-[2.5rem] shadow-xl",style:{backgroundColor:h,padding:"8px 12px",height:o+16},"data-testid":"device-frame","data-device":"phone",children:[e("div",{className:l("rounded-full mr-2",m?"bg-gray-600":"bg-gray-400"),style:{width:4,height:Math.round(o*.35)},"data-testid":"home-indicator"}),i("div",{className:"rounded-[2rem] overflow-hidden bg-black relative",style:{width:t,height:o},children:[s&&e(f,{time:d,theme:r,device:"phone"}),a]}),e("div",{className:"absolute rounded-full bg-black z-10",style:{width:20,height:g,right:10,top:"50%",transform:"translateY(-50%)"},"data-testid":"phone-notch"})]})}let w=Math.round(t*.35);return i("div",{className:"relative inline-flex flex-col items-center rounded-[2.5rem] shadow-xl",style:{backgroundColor:h,padding:"12px 8px",width:t+16},"data-testid":"device-frame","data-device":"phone",children:[e("div",{className:"absolute top-[10px] rounded-full bg-black z-10",style:{width:w,height:20,left:"50%",transform:"translateX(-50%)"},"data-testid":"phone-notch"}),i("div",{className:"rounded-[2rem] overflow-hidden bg-black relative",style:{width:t,height:o},children:[s&&e(f,{time:d,theme:r,device:"phone"}),a]}),e("div",{className:l("rounded-full mt-2",m?"bg-gray-600":"bg-gray-400"),style:{width:Math.round(t*.35),height:4},"data-testid":"home-indicator"})]})}function q({children:a,theme:r,screenW:t,screenH:o,showStatusBar:s,statusBarTime:d,frameColor:n}){return i("div",{className:"relative inline-flex flex-col items-center rounded-[2rem] shadow-xl",style:{backgroundColor:n??(r==="dark"?"#1a1a1a":"#e5e7eb"),padding:"10px 6px",width:t+12},"data-testid":"device-frame","data-device":"android",children:[e("div",{className:"absolute top-[6px] rounded-full bg-gray-800 z-10 border border-gray-700",style:{width:8,height:8,left:"50%",transform:"translateX(-50%)"},"data-testid":"camera-dot"}),i("div",{className:"rounded-[1.5rem] overflow-hidden bg-black relative",style:{width:t,height:o},children:[s&&e(f,{time:d,theme:r,device:"android"}),a]})]})}function E({children:a,theme:r,screenW:t,screenH:o,showStatusBar:s,statusBarTime:d,frameColor:n}){return i("div",{className:"relative inline-flex flex-col items-center rounded-[1.5rem] shadow-xl",style:{backgroundColor:n??(r==="dark"?"#1a1a1a":"#e5e7eb"),padding:"16px 12px",width:t+24},"data-testid":"device-frame","data-device":"tablet",children:[e("div",{className:"absolute top-[8px] rounded-full bg-gray-700 z-10",style:{width:6,height:6,left:"50%",transform:"translateX(-50%)"}}),i("div",{className:"rounded-lg overflow-hidden bg-black relative",style:{width:t,height:o},children:[s&&e(f,{time:d,theme:r,device:"tablet"}),a]})]})}function O({children:a,theme:r,screenW:t,screenH:o,frameColor:s}){let d=r==="dark",n=s??(d?"#1a1a1a":"#d1d5db"),c=t+60;return i("div",{className:"inline-flex flex-col items-center","data-testid":"device-frame","data-device":"laptop",children:[i("div",{className:"rounded-t-xl shadow-xl relative",style:{backgroundColor:n,padding:"8px 8px 0",width:t+16},children:[e("div",{className:"absolute top-[3px] rounded-full bg-gray-700 z-10",style:{width:4,height:4,left:"50%",transform:"translateX(-50%)"}}),e("div",{className:"rounded-t-sm overflow-hidden bg-black",style:{width:t,height:o},children:a})]}),e("div",{className:l(d?"bg-gray-800":"bg-gray-400"),style:{width:t+16,height:3}}),e("div",{className:"rounded-b-xl shadow-lg",style:{backgroundColor:n,width:c,height:12,clipPath:"polygon(3% 0%, 97% 0%, 100% 100%, 0% 100%)"},"data-testid":"laptop-base"})]})}function U({children:a,theme:r,screenW:t,screenH:o,frameColor:s}){let d=r==="dark";return i("div",{className:"inline-flex flex-col items-center","data-testid":"device-frame","data-device":"desktop",children:[e("div",{className:"rounded-lg shadow-xl",style:{backgroundColor:s??(d?"#1a1a1a":"#d1d5db"),padding:"8px 8px 20px",width:t+16},children:e("div",{className:"rounded-sm overflow-hidden bg-black",style:{width:t,height:o},children:a})}),e("div",{className:l(d?"bg-gray-800":"bg-gray-400"),style:{width:40,height:24},"data-testid":"monitor-stand"}),e("div",{className:l("rounded-t-sm",d?"bg-gray-800":"bg-gray-400"),style:{width:Math.round(t*.4),height:6,borderRadius:"2px 2px 4px 4px"}})]})}function Y({children:a,theme:r,screenW:t,screenH:o,showStatusBar:s,statusBarTime:d,frameColor:n}){let c=r==="dark",m=n??(c?"#1a1a1a":"#d1d5db"),h=Math.round(t*.7);return i("div",{className:"inline-flex flex-col items-center","data-testid":"device-frame","data-device":"watch",children:[e("div",{className:l("rounded-t-lg",c?"bg-gray-800":"bg-gray-400"),style:{width:h,height:30},"data-testid":"watch-band"}),i("div",{className:"relative rounded-[1.2rem] shadow-xl",style:{backgroundColor:m,padding:"8px 6px",width:t+12},children:[e("div",{className:l("absolute rounded-sm",c?"bg-gray-600":"bg-gray-400"),style:{width:4,height:16,right:-4,top:"30%"},"data-testid":"watch-crown"}),i("div",{className:"rounded-xl overflow-hidden bg-black",style:{width:t,height:o},children:[s&&e(f,{time:d,theme:r,device:"watch"}),a]})]}),e("div",{className:l("rounded-b-lg",c?"bg-gray-800":"bg-gray-400"),style:{width:h,height:30}})]})}function G({children:a,theme:r,screenW:t,screenH:o,frameColor:s}){return i("div",{className:"inline-flex flex-col rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:s??(r==="dark"?"#1f2937":"#f3f4f6"),width:t},"data-testid":"device-frame","data-device":"browser",children:[e(X,{theme:r}),e("div",{className:"overflow-hidden bg-white",style:{width:t,height:o},children:a})]})}function Z({device:a="phone",src:r,alt:t,children:o,orientation:s="portrait",theme:d="dark",size:n="md",showStatusBar:c=!1,statusBarTime:m,animated:h=!1,scrollSpeed:w=30,frameColor:g,className:B,contentClassName:F}){let H=A(),D=z(null),x=z(null),y=P[a][n],C=s==="landscape"&&a!=="watch"&&a!=="browser",u=C?y.h:y.w,v=C?y.w:y.h;W(()=>{if(!h||!D.current)return;let p=D.current,k=null,R=T=>{k===null&&(k=T);let S=(T-k)/1e3;k=T,p.scrollTop+=w*S,p.scrollTop>=p.scrollHeight-p.clientHeight&&(p.scrollTop=0),x.current=requestAnimationFrame(R)};return x.current=requestAnimationFrame(R),()=>{x.current!==null&&cancelAnimationFrame(x.current)}},[h,w]);let b=e("div",{ref:h?D:void 0,className:l("w-full h-full overflow-hidden",h&&"overflow-y-auto scrollbar-hide",F),style:h?{scrollBehavior:"auto"}:void 0,children:r?e("img",{src:r,alt:t??H.deviceMockupAlt,className:"w-full h-auto object-cover",draggable:!1}):o}),N={showStatusBar:c,statusBarTime:m},M=()=>{switch(a){case"phone":return e(j,{theme:d,screenW:u,screenH:v,frameColor:g,landscape:C,...N,children:b});case"android":return e(q,{theme:d,screenW:u,screenH:v,frameColor:g,...N,children:b});case"tablet":return e(E,{theme:d,screenW:u,screenH:v,frameColor:g,...N,children:b});case"laptop":return e(O,{theme:d,screenW:u,screenH:v,frameColor:g,children:b});case"desktop":return e(U,{theme:d,screenW:u,screenH:v,frameColor:g,children:b});case"watch":return e(Y,{theme:d,screenW:u,screenH:v,frameColor:g,...N,children:b});case"browser":return e(G,{theme:d,screenW:u,screenH:v,frameColor:g,children:b})}};return e("div",{className:l("inline-flex",B),"data-testid":"device-mockup","data-orientation":s,"data-theme":d,"data-size":n,children:M()})}export{Z as DeviceMockup};
@@ -1 +1 @@
1
- "use strict";"use client";var f=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var H=(o,e)=>{for(var a in e)f(o,a,{get:e[a],enumerable:!0})},U=(o,e,a,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of A(e))!B.call(o,i)&&i!==a&&f(o,i,{get:()=>e[i],enumerable:!(r=j(e,i))||r.enumerable});return o};var $=o=>U(f({},"__esModule",{value:!0}),o);var K={};H(K,{Drawer:()=>v});module.exports=$(K);var l=require("react"),w=require("react-dom"),y=require("../../hooks/useDialogA11y.cjs"),s=require("../../lib/cn.cjs"),x=require("../../lib/i18n.cjs"),t=require("react/jsx-runtime"),q={left:{sm:"w-64",md:"w-80",lg:"w-96",xl:"w-[32rem]",full:"w-full",half:"w-1/2 h-full"},right:{sm:"w-64",md:"w-80",lg:"w-96",xl:"w-[32rem]",full:"w-full",half:"w-1/2 h-full"},top:{sm:"h-64",md:"h-80",lg:"h-96",xl:"h-[32rem]",full:"h-full",half:"w-1/2 h-full"},bottom:{sm:"h-64",md:"h-80",lg:"h-96",xl:"h-[32rem]",full:"h-full",half:"w-1/2 h-full"}},G={left:"left-0 top-0 bottom-0",right:"right-0 top-0 bottom-0",top:"top-0 left-0 right-0",bottom:"bottom-0 left-0 right-0"},p={left:{enter:"animate-in slide-in-from-left duration-300",exit:"animate-out slide-out-to-left duration-200"},right:{enter:"animate-in slide-in-from-right duration-300",exit:"animate-out slide-out-to-right duration-200"},top:{enter:"animate-in slide-in-from-top duration-300",exit:"animate-out slide-out-to-top duration-200"},bottom:{enter:"animate-in slide-in-from-bottom duration-300",exit:"animate-out slide-out-to-bottom duration-200"}},J=(0,t.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})});function v({open:o,onClose:e,children:a,position:r="right",size:i="md",customWidth:d,customHeight:u,showOverlay:D=!0,closeOnOverlayClick:m=!0,closeOnEscape:k=!0,title:n,footer:c,className:N,overlayClassName:R,closeLabel:C,"aria-label":I,trapFocus:P=!0,initialFocus:z,returnFocus:F,lockScroll:L=!0}){let M=!!(d||u),g=(0,l.useRef)(null),S=(0,x.useUILabels)(),h=`${(0,l.useId)()}-drawer-title`,{dialogRef:E,dialogProps:O}=(0,y.useDialogA11y)({open:o,onClose:e,closeOnEscape:k,trapFocus:P,initialFocus:z,returnFocus:F,lockScroll:L,keepInteractive:[g]}),T=(0,l.useCallback)(()=>{m&&e()},[m,e]);if(!o)return null;let b=(0,t.jsxs)(t.Fragment,{children:[D&&(0,t.jsx)("div",{ref:g,className:(0,s.cn)("fixed inset-0 bg-black/50 z-40 transition-opacity",o?"animate-in fade-in duration-200":"animate-out fade-out duration-150",R),onClick:T,"aria-hidden":"true"}),(0,t.jsxs)("div",{ref:E,...O,"aria-labelledby":n?h:void 0,"aria-label":n?void 0:I,className:(0,s.cn)("fixed z-50 bg-white dark:bg-gray-900","shadow-xl overflow-hidden","flex flex-col focus:outline-none",G[r],!M&&q[r][i],o?p[r].enter:p[r].exit,N),style:{...d?{width:d}:{},...u?{height:u}:{}},children:[n&&(0,t.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:[(0,t.jsx)("h2",{id:h,className:"text-lg font-semibold text-gray-900 dark:text-white",children:n}),(0,t.jsx)("button",{type:"button",onClick:e,className:(0,s.cn)("rounded-lg p-1.5 text-gray-400 hover:bg-gray-100 hover:text-gray-900","dark:hover:bg-gray-800 dark:hover:text-white","focus:outline-none focus:ring-2 focus:ring-gray-300 dark:focus:ring-gray-600"),"aria-label":C??S.closeDrawer,children:J})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:a}),c&&(0,t.jsx)("div",{className:"px-6 py-4 border-t border-gray-200 dark:border-gray-700",children:c})]})]});return typeof document<"u"?(0,w.createPortal)(b,document.body):b}v.displayName="Drawer";0&&(module.exports={Drawer});
1
+ "use strict";"use client";var f=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var H=(o,e)=>{for(var i in e)f(o,i,{get:e[i],enumerable:!0})},U=(o,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of A(e))!B.call(o,a)&&a!==i&&f(o,a,{get:()=>e[a],enumerable:!(r=j(e,a))||r.enumerable});return o};var $=o=>U(f({},"__esModule",{value:!0}),o);var K={};H(K,{Drawer:()=>v});module.exports=$(K);var l=require("react"),w=require("react-dom"),y=require("../../hooks/useDialogA11y.cjs"),s=require("../../lib/cn.cjs"),x=require("../../lib/i18n.cjs"),t=require("react/jsx-runtime"),q={left:{sm:"w-64",md:"w-80",lg:"w-96",xl:"w-[32rem]",full:"w-full",half:"w-1/2 h-full"},right:{sm:"w-64",md:"w-80",lg:"w-96",xl:"w-[32rem]",full:"w-full",half:"w-1/2 h-full"},top:{sm:"h-64",md:"h-80",lg:"h-96",xl:"h-[32rem]",full:"h-full",half:"w-1/2 h-full"},bottom:{sm:"h-64",md:"h-80",lg:"h-96",xl:"h-[32rem]",full:"h-full",half:"w-1/2 h-full"}},G={left:"left-0 top-0 bottom-0",right:"right-0 top-0 bottom-0",top:"top-0 left-0 right-0",bottom:"bottom-0 left-0 right-0"},p={left:{enter:"animate-in slide-in-from-left duration-300",exit:"animate-out slide-out-to-left duration-200"},right:{enter:"animate-in slide-in-from-right duration-300",exit:"animate-out slide-out-to-right duration-200"},top:{enter:"animate-in slide-in-from-top duration-300",exit:"animate-out slide-out-to-top duration-200"},bottom:{enter:"animate-in slide-in-from-bottom duration-300",exit:"animate-out slide-out-to-bottom duration-200"}},J=(0,t.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})});function v({open:o,onClose:e,children:i,position:r="right",size:a="md",customWidth:d,customHeight:u,showOverlay:D=!0,closeOnOverlayClick:m=!0,closeOnEscape:k=!0,title:n,footer:c,className:N,overlayClassName:R,closeLabel:C,"aria-label":I,trapFocus:P=!0,initialFocus:z,returnFocus:F,lockScroll:L=!0}){let M=!!(d||u),g=(0,l.useRef)(null),S=(0,x.useUILabels)(),h=`${(0,l.useId)()}-drawer-title`,{dialogRef:E,dialogProps:O}=(0,y.useDialogA11y)({open:o,onClose:e,closeOnEscape:k,trapFocus:P,initialFocus:z,returnFocus:F,lockScroll:L,keepInteractive:[g]}),T=(0,l.useCallback)(()=>{m&&e()},[m,e]);if(!o)return null;let b=(0,t.jsxs)(t.Fragment,{children:[D&&(0,t.jsx)("div",{ref:g,className:(0,s.cn)("fixed inset-0 bg-black/50 z-40 transition-opacity",o?"animate-in fade-in duration-200":"animate-out fade-out duration-150",R),onClick:T,"aria-hidden":"true"}),(0,t.jsxs)("div",{ref:E,...O,"aria-labelledby":n?h:void 0,"aria-label":n?void 0:I,className:(0,s.cn)("fixed z-50 bg-white dark:bg-gray-900","shadow-xl overflow-hidden","flex flex-col focus:outline-none",G[r],!M&&q[r][a],o?p[r].enter:p[r].exit,N),style:{...d?{width:d}:{},...u?{height:u}:{}},children:[n&&(0,t.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:[(0,t.jsx)("h2",{id:h,className:"text-lg font-semibold text-gray-900 dark:text-white",children:n}),(0,t.jsx)("button",{type:"button",onClick:e,className:(0,s.cn)("rounded-lg p-1.5 text-gray-500 dark:text-gray-400 hover:bg-gray-100 hover:text-gray-900","dark:hover:bg-gray-800 dark:hover:text-white","focus:outline-none focus:ring-2 focus:ring-gray-300 dark:focus:ring-gray-600"),"aria-label":C??S.closeDrawer,children:J})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:i}),c&&(0,t.jsx)("div",{className:"px-6 py-4 border-t border-gray-200 dark:border-gray-700",children:c})]})]});return typeof document<"u"?(0,w.createPortal)(b,document.body):b}v.displayName="Drawer";0&&(module.exports={Drawer});