@synertech/ui 0.46.0 → 0.46.2

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 (66) hide show
  1. package/dist/components/badge/Badge.cjs +1 -1
  2. package/dist/components/badge/Badge.js +1 -1
  3. package/dist/components/banner/Banner.cjs +1 -1
  4. package/dist/components/banner/Banner.js +1 -1
  5. package/dist/components/calendar/Calendar.cjs +1 -1
  6. package/dist/components/calendar/Calendar.js +1 -1
  7. package/dist/components/checkbox/Checkbox.cjs +1 -1
  8. package/dist/components/checkbox/Checkbox.js +1 -1
  9. package/dist/components/checkbox/CheckboxGroup.cjs +1 -1
  10. package/dist/components/checkbox/CheckboxGroup.js +1 -1
  11. package/dist/components/chip/Chip.cjs +1 -1
  12. package/dist/components/chip/Chip.js +1 -1
  13. package/dist/components/circular-progress/CircularProgress.cjs +1 -1
  14. package/dist/components/circular-progress/CircularProgress.js +1 -1
  15. package/dist/components/device-mockup/DeviceMockup.cjs +1 -1
  16. package/dist/components/device-mockup/DeviceMockup.js +1 -1
  17. package/dist/components/dropdown/DropdownItem.cjs +1 -1
  18. package/dist/components/dropdown/DropdownItem.js +1 -1
  19. package/dist/components/dropdown/DropdownRadio.cjs +1 -1
  20. package/dist/components/dropdown/DropdownRadio.js +1 -1
  21. package/dist/components/file-selector/FileSelector.cjs +1 -1
  22. package/dist/components/file-selector/FileSelector.js +1 -1
  23. package/dist/components/form/shared/inputStyles.cjs +1 -1
  24. package/dist/components/form/shared/inputStyles.js +1 -1
  25. package/dist/components/header/Header.cjs +1 -1
  26. package/dist/components/header/Header.js +1 -1
  27. package/dist/components/help-button/HelpButton.cjs +1 -1
  28. package/dist/components/help-button/HelpButton.js +1 -1
  29. package/dist/components/help-button/MarkdownEditor.cjs +1 -1
  30. package/dist/components/help-button/MarkdownEditor.js +1 -1
  31. package/dist/components/image-uploader/ImageUploader.cjs +1 -1
  32. package/dist/components/image-uploader/ImageUploader.js +1 -1
  33. package/dist/components/indicator/Indicator.cjs +1 -1
  34. package/dist/components/indicator/Indicator.js +1 -1
  35. package/dist/components/label/Label.cjs +1 -1
  36. package/dist/components/label/Label.js +1 -1
  37. package/dist/components/modal/Modal.cjs +1 -1
  38. package/dist/components/modal/Modal.js +1 -1
  39. package/dist/components/pagination/Pagination.cjs +1 -1
  40. package/dist/components/pagination/Pagination.js +1 -1
  41. package/dist/components/progress-bar/ProgressBar.cjs +1 -1
  42. package/dist/components/progress-bar/ProgressBar.js +1 -1
  43. package/dist/components/radio-button/RadioButton.cjs +1 -1
  44. package/dist/components/radio-button/RadioButton.js +1 -1
  45. package/dist/components/schema-editor/legend/SchemaLegend.cjs +1 -1
  46. package/dist/components/schema-editor/legend/SchemaLegend.js +1 -1
  47. package/dist/components/schema-editor/tables/SchemaTableRenderer.cjs +1 -1
  48. package/dist/components/schema-editor/tables/SchemaTableRenderer.js +1 -1
  49. package/dist/components/select/Select.cjs +1 -1
  50. package/dist/components/select/Select.js +1 -1
  51. package/dist/components/slider/Slider.cjs +1 -1
  52. package/dist/components/slider/Slider.js +1 -1
  53. package/dist/components/stat-card/StatCard.cjs +1 -1
  54. package/dist/components/stat-card/StatCard.js +1 -1
  55. package/dist/components/table/TableHeader.cjs +1 -1
  56. package/dist/components/table/TableHeader.js +1 -1
  57. package/dist/components/tabs/TabsTrigger.cjs +1 -1
  58. package/dist/components/tabs/TabsTrigger.js +1 -1
  59. package/dist/components/toast/Toast.cjs +1 -1
  60. package/dist/components/toast/Toast.js +1 -1
  61. package/dist/components/tooltip/Tooltip.cjs +1 -1
  62. package/dist/components/tooltip/Tooltip.js +1 -1
  63. package/dist/components/wizard/Wizard.cjs +1 -1
  64. package/dist/components/wizard/Wizard.js +1 -1
  65. package/dist/styles.css +178 -175
  66. package/package.json +3 -3
@@ -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 c=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var C=(t,e)=>{for(var o in e)c(t,o,{get:e[o],enumerable:!0})},E=(t,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of N(e))!w.call(t,r)&&r!==o&&c(t,r,{get:()=>e[r],enumerable:!(a=v(e,r))||a.enumerable});return t};var M=t=>E(c({},"__esModule",{value:!0}),t);var R={};C(R,{DropdownItem:()=>u});module.exports=M(R);var d=require("./Dropdown.cjs"),p=require("../../lib/cn.cjs"),n=require("react/jsx-runtime"),O={default:"text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700",danger:"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20",success:"text-green-600 dark:text-green-400 hover:bg-green-50 dark:hover:bg-green-900/20"};function u({children:t,icon:e,iconPosition:o="left",description:a,shortcut:r,variant:i="default",closeOnSelect:m,onSelect:g,disabled:s=!1,className:f,onClick:x,index:S,...h}){let{setIsOpen:b,closeOnSelect:k}=(0,d.useDropdownContext)(),y=m??k;return(0,n.jsxs)("button",{role:"menuitem",type:"button",tabIndex:-1,disabled:s,"data-disabled":s||void 0,onClick:l=>{s||(g?.(),x?.(l),y&&b(!1))},onMouseEnter:l=>{s||l.currentTarget.focus({preventScroll:!0})},className:(0,p.cn)("relative flex w-full items-center px-3 py-2 text-left text-sm","outline-none transition-colors","focus:bg-gray-100 dark:focus:bg-gray-700",O[i],s&&"opacity-50 cursor-not-allowed hover:bg-transparent",f),...h,children:[e&&o==="left"&&(0,n.jsx)("span",{className:"mr-2 shrink-0 w-5 h-5",children:e}),(0,n.jsxs)("span",{className:"flex-1 min-w-0",children:[(0,n.jsx)("span",{className:"block truncate",children:t}),a&&(0,n.jsx)("span",{className:"block text-xs text-gray-500 dark:text-gray-400 truncate",children:a})]}),e&&o==="right"&&(0,n.jsx)("span",{className:"ml-2 shrink-0 w-5 h-5",children:e}),r&&(0,n.jsx)("span",{className:"ml-auto pl-4 text-xs text-gray-400 dark:text-gray-500",children:r})]})}u.displayName="DropdownItem";0&&(module.exports={DropdownItem});
1
+ "use strict";"use client";var c=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var C=(t,e)=>{for(var o in e)c(t,o,{get:e[o],enumerable:!0})},E=(t,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of N(e))!w.call(t,r)&&r!==o&&c(t,r,{get:()=>e[r],enumerable:!(a=v(e,r))||a.enumerable});return t};var M=t=>E(c({},"__esModule",{value:!0}),t);var R={};C(R,{DropdownItem:()=>u});module.exports=M(R);var d=require("./Dropdown.cjs"),p=require("../../lib/cn.cjs"),n=require("react/jsx-runtime"),O={default:"text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700",danger:"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20",success:"text-green-700 dark:text-green-400 hover:bg-green-50 dark:hover:bg-green-900/20"};function u({children:t,icon:e,iconPosition:o="left",description:a,shortcut:r,variant:i="default",closeOnSelect:m,onSelect:g,disabled:s=!1,className:f,onClick:x,index:S,...h}){let{setIsOpen:b,closeOnSelect:k}=(0,d.useDropdownContext)(),y=m??k;return(0,n.jsxs)("button",{role:"menuitem",type:"button",tabIndex:-1,disabled:s,"data-disabled":s||void 0,onClick:l=>{s||(g?.(),x?.(l),y&&b(!1))},onMouseEnter:l=>{s||l.currentTarget.focus({preventScroll:!0})},className:(0,p.cn)("relative flex w-full items-center px-3 py-2 text-left text-sm","outline-none transition-colors","focus:bg-gray-100 dark:focus:bg-gray-700",O[i],s&&"opacity-50 cursor-not-allowed hover:bg-transparent",f),...h,children:[e&&o==="left"&&(0,n.jsx)("span",{className:"mr-2 shrink-0 w-5 h-5",children:e}),(0,n.jsxs)("span",{className:"flex-1 min-w-0",children:[(0,n.jsx)("span",{className:"block truncate",children:t}),a&&(0,n.jsx)("span",{className:"block text-xs text-gray-500 dark:text-gray-400 truncate",children:a})]}),e&&o==="right"&&(0,n.jsx)("span",{className:"ml-2 shrink-0 w-5 h-5",children:e}),r&&(0,n.jsx)("span",{className:"ml-auto pl-4 text-xs text-gray-400 dark:text-gray-500",children:r})]})}u.displayName="DropdownItem";0&&(module.exports={DropdownItem});
@@ -1 +1 @@
1
- "use client";import{useDropdownContext as b}from"./Dropdown.js";import{cn as k}from"../../lib/cn.js";import{jsx as t,jsxs as l}from"react/jsx-runtime";var y={default:"text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700",danger:"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20",success:"text-green-600 dark:text-green-400 hover:bg-green-50 dark:hover:bg-green-900/20"};function v({children:c,icon:n,iconPosition:o="left",description:a,shortcut:s,variant:d="default",closeOnSelect:p,onSelect:u,disabled:e=!1,className:i,onClick:m,index:N,...g}){let{setIsOpen:f,closeOnSelect:x}=b(),h=p??x;return l("button",{role:"menuitem",type:"button",tabIndex:-1,disabled:e,"data-disabled":e||void 0,onClick:r=>{e||(u?.(),m?.(r),h&&f(!1))},onMouseEnter:r=>{e||r.currentTarget.focus({preventScroll:!0})},className:k("relative flex w-full items-center px-3 py-2 text-left text-sm","outline-none transition-colors","focus:bg-gray-100 dark:focus:bg-gray-700",y[d],e&&"opacity-50 cursor-not-allowed hover:bg-transparent",i),...g,children:[n&&o==="left"&&t("span",{className:"mr-2 shrink-0 w-5 h-5",children:n}),l("span",{className:"flex-1 min-w-0",children:[t("span",{className:"block truncate",children:c}),a&&t("span",{className:"block text-xs text-gray-500 dark:text-gray-400 truncate",children:a})]}),n&&o==="right"&&t("span",{className:"ml-2 shrink-0 w-5 h-5",children:n}),s&&t("span",{className:"ml-auto pl-4 text-xs text-gray-400 dark:text-gray-500",children:s})]})}v.displayName="DropdownItem";export{v as DropdownItem};
1
+ "use client";import{useDropdownContext as b}from"./Dropdown.js";import{cn as k}from"../../lib/cn.js";import{jsx as t,jsxs as l}from"react/jsx-runtime";var y={default:"text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700",danger:"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20",success:"text-green-700 dark:text-green-400 hover:bg-green-50 dark:hover:bg-green-900/20"};function v({children:c,icon:n,iconPosition:o="left",description:a,shortcut:s,variant:d="default",closeOnSelect:p,onSelect:u,disabled:e=!1,className:i,onClick:m,index:N,...g}){let{setIsOpen:f,closeOnSelect:x}=b(),h=p??x;return l("button",{role:"menuitem",type:"button",tabIndex:-1,disabled:e,"data-disabled":e||void 0,onClick:r=>{e||(u?.(),m?.(r),h&&f(!1))},onMouseEnter:r=>{e||r.currentTarget.focus({preventScroll:!0})},className:k("relative flex w-full items-center px-3 py-2 text-left text-sm","outline-none transition-colors","focus:bg-gray-100 dark:focus:bg-gray-700",y[d],e&&"opacity-50 cursor-not-allowed hover:bg-transparent",i),...g,children:[n&&o==="left"&&t("span",{className:"mr-2 shrink-0 w-5 h-5",children:n}),l("span",{className:"flex-1 min-w-0",children:[t("span",{className:"block truncate",children:c}),a&&t("span",{className:"block text-xs text-gray-500 dark:text-gray-400 truncate",children:a})]}),n&&o==="right"&&t("span",{className:"ml-2 shrink-0 w-5 h-5",children:n}),s&&t("span",{className:"ml-auto pl-4 text-xs text-gray-400 dark:text-gray-500",children:s})]})}v.displayName="DropdownItem";export{v as DropdownItem};
@@ -1 +1 @@
1
- "use strict";"use client";var m=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var y=(e,o)=>{for(var r in o)m(e,r,{get:o[r],enumerable:!0})},N=(e,o,r,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of C(o))!k.call(e,t)&&t!==r&&m(e,t,{get:()=>o[t],enumerable:!(s=R(o,t))||s.enumerable});return e};var D=e=>N(m({},"__esModule",{value:!0}),e);var V={};y(V,{DropdownRadioGroup:()=>b,DropdownRadioItem:()=>v});module.exports=D(V);var a=require("react"),x=require("./Dropdown.cjs"),f=require("../../lib/cn.cjs"),n=require("react/jsx-runtime"),h=(0,a.createContext)(null);function G(){let e=(0,a.useContext)(h);if(!e)throw new Error("DropdownRadioItem must be used within a DropdownRadioGroup");return e}function b({value:e,defaultValue:o="",onValueChange:r,children:s,className:t}){let[c,p]=(0,a.useState)(o),u=e!==void 0,i=u?e:c,d=(0,a.useCallback)(g=>{u||p(g),r?.(g)},[u,r]),l=(0,a.useMemo)(()=>({value:i,onValueChange:d}),[i,d]);return(0,n.jsx)(h.Provider,{value:l,children:(0,n.jsx)("div",{role:"group",className:t,children:s})})}b.displayName="DropdownRadioGroup";function v({value:e,children:o,icon:r,description:s,disabled:t=!1,closeOnChange:c=!0,className:p}){let{value:u,onValueChange:i}=G(),{setIsOpen:d}=(0,x.useDropdownContext)(),l=u===e;return(0,n.jsxs)("button",{role:"menuitemradio",type:"button",tabIndex:-1,"aria-checked":l,disabled:t,"data-disabled":t||void 0,onClick:()=>{t||(i(e),c&&d(!1))},onMouseEnter:w=>{t||w.currentTarget.focus({preventScroll:!0})},className:(0,f.cn)("relative flex w-full items-center px-3 py-2 text-left text-sm","outline-none transition-colors","text-gray-700 dark:text-gray-200","hover:bg-gray-100 dark:hover:bg-gray-700","focus:bg-gray-100 dark:focus:bg-gray-700",t&&"opacity-50 cursor-not-allowed hover:bg-transparent",p),children:[(0,n.jsx)("span",{className:"mr-2 shrink-0 w-4 h-4",children:r||(0,n.jsx)("span",{className:(0,f.cn)("flex items-center justify-center w-4 h-4 rounded-full border-2 transition-colors",l?"border-blue-600":"border-gray-300 dark:border-gray-600"),children:l&&(0,n.jsx)("span",{className:"w-2 h-2 rounded-full bg-blue-600"})})}),(0,n.jsxs)("span",{className:"flex-1 min-w-0",children:[(0,n.jsx)("span",{className:"block truncate",children:o}),s&&(0,n.jsx)("span",{className:"block text-xs text-gray-500 dark:text-gray-400 truncate",children:s})]}),l&&!r&&(0,n.jsx)("svg",{className:"ml-auto w-4 h-4 text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]})}v.displayName="DropdownRadioItem";0&&(module.exports={DropdownRadioGroup,DropdownRadioItem});
1
+ "use strict";"use client";var m=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var y=(e,o)=>{for(var r in o)m(e,r,{get:o[r],enumerable:!0})},N=(e,o,r,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of C(o))!k.call(e,t)&&t!==r&&m(e,t,{get:()=>o[t],enumerable:!(s=R(o,t))||s.enumerable});return e};var D=e=>N(m({},"__esModule",{value:!0}),e);var V={};y(V,{DropdownRadioGroup:()=>b,DropdownRadioItem:()=>v});module.exports=D(V);var a=require("react"),x=require("./Dropdown.cjs"),f=require("../../lib/cn.cjs"),n=require("react/jsx-runtime"),h=(0,a.createContext)(null);function G(){let e=(0,a.useContext)(h);if(!e)throw new Error("DropdownRadioItem must be used within a DropdownRadioGroup");return e}function b({value:e,defaultValue:o="",onValueChange:r,children:s,className:t}){let[c,p]=(0,a.useState)(o),u=e!==void 0,i=u?e:c,d=(0,a.useCallback)(g=>{u||p(g),r?.(g)},[u,r]),l=(0,a.useMemo)(()=>({value:i,onValueChange:d}),[i,d]);return(0,n.jsx)(h.Provider,{value:l,children:(0,n.jsx)("div",{role:"group",className:t,children:s})})}b.displayName="DropdownRadioGroup";function v({value:e,children:o,icon:r,description:s,disabled:t=!1,closeOnChange:c=!0,className:p}){let{value:u,onValueChange:i}=G(),{setIsOpen:d}=(0,x.useDropdownContext)(),l=u===e;return(0,n.jsxs)("button",{role:"menuitemradio",type:"button",tabIndex:-1,"aria-checked":l,disabled:t,"data-disabled":t||void 0,onClick:()=>{t||(i(e),c&&d(!1))},onMouseEnter:w=>{t||w.currentTarget.focus({preventScroll:!0})},className:(0,f.cn)("relative flex w-full items-center px-3 py-2 text-left text-sm","outline-none transition-colors","text-gray-700 dark:text-gray-200","hover:bg-gray-100 dark:hover:bg-gray-700","focus:bg-gray-100 dark:focus:bg-gray-700",t&&"opacity-50 cursor-not-allowed hover:bg-transparent",p),children:[(0,n.jsx)("span",{className:"mr-2 shrink-0 w-4 h-4",children:r||(0,n.jsx)("span",{className:(0,f.cn)("flex items-center justify-center w-4 h-4 rounded-full border-2 transition-colors",l?"border-blue-600":"border-gray-300 dark:border-gray-600"),children:l&&(0,n.jsx)("span",{className:"w-2 h-2 rounded-full bg-blue-600"})})}),(0,n.jsxs)("span",{className:"flex-1 min-w-0",children:[(0,n.jsx)("span",{className:"block truncate",children:o}),s&&(0,n.jsx)("span",{className:"block text-xs text-gray-500 dark:text-gray-400 truncate",children:s})]}),l&&!r&&(0,n.jsx)("svg",{className:"ml-auto w-4 h-4 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]})}v.displayName="DropdownRadioItem";0&&(module.exports={DropdownRadioGroup,DropdownRadioItem});
@@ -1 +1 @@
1
- "use client";import{useState as h,useCallback as b,useMemo as v,createContext as w,useContext as R}from"react";import{useDropdownContext as C}from"./Dropdown.js";import{cn as g}from"../../lib/cn.js";import{jsx as e,jsxs as m}from"react/jsx-runtime";var f=w(null);function k(){let o=R(f);if(!o)throw new Error("DropdownRadioItem must be used within a DropdownRadioGroup");return o}function y({value:o,defaultValue:i="",onValueChange:r,children:s,className:t}){let[d,c]=h(i),a=o!==void 0,l=a?o:d,u=b(p=>{a||c(p),r?.(p)},[a,r]),n=v(()=>({value:l,onValueChange:u}),[l,u]);return e(f.Provider,{value:n,children:e("div",{role:"group",className:t,children:s})})}y.displayName="DropdownRadioGroup";function N({value:o,children:i,icon:r,description:s,disabled:t=!1,closeOnChange:d=!0,className:c}){let{value:a,onValueChange:l}=k(),{setIsOpen:u}=C(),n=a===o;return m("button",{role:"menuitemradio",type:"button",tabIndex:-1,"aria-checked":n,disabled:t,"data-disabled":t||void 0,onClick:()=>{t||(l(o),d&&u(!1))},onMouseEnter:x=>{t||x.currentTarget.focus({preventScroll:!0})},className:g("relative flex w-full items-center px-3 py-2 text-left text-sm","outline-none transition-colors","text-gray-700 dark:text-gray-200","hover:bg-gray-100 dark:hover:bg-gray-700","focus:bg-gray-100 dark:focus:bg-gray-700",t&&"opacity-50 cursor-not-allowed hover:bg-transparent",c),children:[e("span",{className:"mr-2 shrink-0 w-4 h-4",children:r||e("span",{className:g("flex items-center justify-center w-4 h-4 rounded-full border-2 transition-colors",n?"border-blue-600":"border-gray-300 dark:border-gray-600"),children:n&&e("span",{className:"w-2 h-2 rounded-full bg-blue-600"})})}),m("span",{className:"flex-1 min-w-0",children:[e("span",{className:"block truncate",children:i}),s&&e("span",{className:"block text-xs text-gray-500 dark:text-gray-400 truncate",children:s})]}),n&&!r&&e("svg",{className:"ml-auto w-4 h-4 text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]})}N.displayName="DropdownRadioItem";export{y as DropdownRadioGroup,N as DropdownRadioItem};
1
+ "use client";import{useState as h,useCallback as b,useMemo as v,createContext as w,useContext as R}from"react";import{useDropdownContext as C}from"./Dropdown.js";import{cn as g}from"../../lib/cn.js";import{jsx as e,jsxs as m}from"react/jsx-runtime";var f=w(null);function k(){let o=R(f);if(!o)throw new Error("DropdownRadioItem must be used within a DropdownRadioGroup");return o}function y({value:o,defaultValue:i="",onValueChange:r,children:s,className:t}){let[d,c]=h(i),a=o!==void 0,l=a?o:d,u=b(p=>{a||c(p),r?.(p)},[a,r]),n=v(()=>({value:l,onValueChange:u}),[l,u]);return e(f.Provider,{value:n,children:e("div",{role:"group",className:t,children:s})})}y.displayName="DropdownRadioGroup";function N({value:o,children:i,icon:r,description:s,disabled:t=!1,closeOnChange:d=!0,className:c}){let{value:a,onValueChange:l}=k(),{setIsOpen:u}=C(),n=a===o;return m("button",{role:"menuitemradio",type:"button",tabIndex:-1,"aria-checked":n,disabled:t,"data-disabled":t||void 0,onClick:()=>{t||(l(o),d&&u(!1))},onMouseEnter:x=>{t||x.currentTarget.focus({preventScroll:!0})},className:g("relative flex w-full items-center px-3 py-2 text-left text-sm","outline-none transition-colors","text-gray-700 dark:text-gray-200","hover:bg-gray-100 dark:hover:bg-gray-700","focus:bg-gray-100 dark:focus:bg-gray-700",t&&"opacity-50 cursor-not-allowed hover:bg-transparent",c),children:[e("span",{className:"mr-2 shrink-0 w-4 h-4",children:r||e("span",{className:g("flex items-center justify-center w-4 h-4 rounded-full border-2 transition-colors",n?"border-blue-600":"border-gray-300 dark:border-gray-600"),children:n&&e("span",{className:"w-2 h-2 rounded-full bg-blue-600"})})}),m("span",{className:"flex-1 min-w-0",children:[e("span",{className:"block truncate",children:i}),s&&e("span",{className:"block text-xs text-gray-500 dark:text-gray-400 truncate",children:s})]}),n&&!r&&e("svg",{className:"ml-auto w-4 h-4 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]})}N.displayName="DropdownRadioItem";export{y as DropdownRadioGroup,N as DropdownRadioItem};
@@ -1 +1 @@
1
- "use strict";"use client";var H=Object.defineProperty;var me=Object.getOwnPropertyDescriptor;var he=Object.getOwnPropertyNames;var ye=Object.prototype.hasOwnProperty;var ve=(c,l)=>{for(var u in l)H(c,u,{get:l[u],enumerable:!0})},ke=(c,l,u,x)=>{if(l&&typeof l=="object"||typeof l=="function")for(let b of he(l))!ye.call(c,b)&&b!==u&&H(c,b,{get:()=>l[b],enumerable:!(x=me(l,b))||x.enumerable});return c};var Fe=c=>ke(H({},"__esModule",{value:!0}),c);var Ee={};ve(Ee,{FileSelector:()=>Le});module.exports=Fe(Ee);var a=require("react"),g=require("../../lib/cn.cjs"),v=require("../../lib/i18n.cjs"),t=require("react/jsx-runtime"),we={sm:{dropzone:"py-4 px-3",text:"text-xs",subtext:"text-[10px]",icon:"w-6 h-6",button:"px-2.5 py-1.5 text-xs",fileItem:"py-1 px-2 text-xs",gap:"gap-1"},md:{dropzone:"py-6 px-4",text:"text-sm",subtext:"text-xs",icon:"w-8 h-8",button:"px-3 py-2 text-sm",fileItem:"py-1.5 px-3 text-sm",gap:"gap-1.5"},lg:{dropzone:"py-8 px-6",text:"text-base",subtext:"text-sm",icon:"w-10 h-10",button:"px-4 py-2.5 text-base",fileItem:"py-2 px-4 text-base",gap:"gap-2"}},te=c=>{if(c===0)return"0 B";let l=["B","KB","MB","GB"],u=Math.floor(Math.log(c)/Math.log(1024));return`${(c/Math.pow(1024,u)).toFixed(u===0?0:1)} ${l[u]}`},j=c=>c.webkitRelativePath||c.name,Se=(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-full h-full",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"})}),Ne=(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-full h-full",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 00-1.883 2.542l.857 6a2.25 2.25 0 002.227 1.932H19.05a2.25 2.25 0 002.227-1.932l.857-6a2.25 2.25 0 00-1.883-2.542m-16.5 0V6A2.25 2.25 0 016 3.75h3.879a1.5 1.5 0 011.06.44l2.122 2.12a1.5 1.5 0 001.06.44H18A2.25 2.25 0 0120.25 9v.776"})}),De=0;async function Ce(c){let l=[],u=async x=>{if(x.isFile){let b=await new Promise((h,r)=>x.file(h,r));l.push(b)}else if(x.isDirectory){let b=x.createReader(),h=()=>new Promise((L,A)=>b.readEntries(L,A)),r=await h();for(;r.length>0;){for(let L of r)await u(L);r=await h()}}};for(let x of c)await u(x);return l}function Le({value:c,onChange:l,accept:u,multiple:x=!1,maxSize:b=10*1024*1024,maxFiles:h,mode:r="file",variant:L="dropzone",size:A="md",disabled:o=!1,readOnly:s=!1,label:U,helperText:z,error:F,showFileList:V=!0,placeholder:G,browseLabel:B,browseFolderLabel:K,labels:re,icon:oe,onReject:_,className:se}){let i=(0,v.useUILabels)(re),[ie,P]=(0,a.useState)([]),[Z,R]=(0,a.useState)(!1),k=(0,a.useRef)(null),M=(0,a.useRef)(null),S=(0,a.useId)(),w=c!==void 0,N=w?c.map((e,f)=>({file:e,id:`ctrl-${f}`})):ie,d=we[A],D=x||r!=="file";(0,a.useEffect)(()=>{r==="directory"&&k.current&&k.current.setAttribute("webkitdirectory",""),r==="both"&&M.current&&M.current.setAttribute("webkitdirectory","")},[r]);let T=(0,a.useMemo)(()=>te(b),[b]),W=(0,a.useMemo)(()=>u?u.split(",").map(e=>e.trim()).map(e=>e.startsWith(".")?e.toUpperCase():e.endsWith("/*")?e.replace("/*","").toUpperCase():e).join(", "):i.fileSelectorAllFiles,[u,i.fileSelectorAllFiles]),q=r==="directory"?i.fileSelectorDropFolder:r==="both"?i.fileSelectorDropFilesOrFolders:x?i.fileSelectorDropFiles:i.fileSelectorDropFile,ne=r==="directory"?i.fileSelectorBrowseFolder:i.fileSelectorBrowse,le=i.fileSelectorBrowseFolder,J=(0,v.formatUILabel)(i.fileSelectorTooLarge,{maxSize:T}),Q=(0,v.formatUILabel)(i.fileSelectorTypeNotAccepted,{accept:W}),X=(0,a.useCallback)(e=>{if(e.size>b)return J;if(u){let f=u.split(",").map(n=>n.trim()),p=`.${e.name.split(".").pop()?.toLowerCase()}`;if(!f.some(n=>n.startsWith(".")?p===n.toLowerCase():n.endsWith("/*")?e.type.startsWith(n.replace("/*","/")):e.type===n))return Q}return null},[u,b,J,Q]),E=(0,a.useCallback)(e=>{if(o||s)return;let f=Array.from(e),p=[];for(let m of f){let n=X(m);n?_?.(m,n):p.push(m)}if(p.length!==0)if(w)if(D){let n=[...c??[],...p],y=h?n.slice(0,h):n;l?.(y)}else l?.([p[0]]);else P(m=>{let n=p.map(y=>({file:y,id:`file-${++De}`}));if(D){let y=[...m,...n],ee=h?y.slice(0,h):y,be=ee.map(xe=>xe.file);return l?.(be),ee}return l?.([p[0]]),[n[0]]})},[o,s,w,D,h,c,l,_,X]),ae=(0,a.useCallback)(e=>{if(!(o||s)){if(w){let f=(c??[]).filter((p,m)=>m!==e);l?.(f)}else P(f=>{let p=f.filter((m,n)=>n!==e);return l?.(p.map(m=>m.file)),p});k.current&&(k.current.value="")}},[o,s,w,c,l]),ce=(0,a.useCallback)(()=>{o||s||(w?l?.([]):(P([]),l?.([])),k.current&&(k.current.value=""))},[o,s,w,l]),Y=(0,a.useCallback)(e=>{e.target.files&&e.target.files.length>0&&E(e.target.files)},[E]),ue=(0,a.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),!o&&!s&&R(!0)},[o,s]),fe=(0,a.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),R(!1)},[]),pe=(0,a.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),R(!1),o||s)return;let f=e.dataTransfer.items;if(f&&f.length>0&&(r==="directory"||r==="both")){let p=[];for(let n=0;n<f.length;n++){let y=f[n].webkitGetAsEntry?.();y&&p.push(y)}if(p.some(n=>n.isDirectory)){Ce(p).then(n=>{n.length>0&&E(n)});return}}e.dataTransfer.files&&e.dataTransfer.files.length>0&&E(e.dataTransfer.files)},[o,s,r,E]),I=(0,a.useCallback)(()=>{!o&&!s&&k.current?.click()},[o,s]),O=(0,a.useCallback)(()=>{!o&&!s&&M.current?.click()},[o,s]),C=N.length>0,ge=oe||(r==="directory"?Ne:Se),de=V&&C&&(0,t.jsxs)("div",{className:(0,g.cn)("flex flex-col",d.gap),children:[N.map((e,f)=>(0,t.jsxs)("div",{className:(0,g.cn)("flex items-center justify-between rounded-md border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",d.fileItem),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4 shrink-0 text-gray-400 dark:text-gray-500",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),(0,t.jsx)("span",{className:"truncate text-gray-700 dark:text-gray-300",children:j(e.file)}),(0,t.jsxs)("span",{className:"shrink-0 text-gray-400 dark:text-gray-500",children:["(",te(e.file.size),")"]})]}),!o&&!s&&(0,t.jsx)("button",{type:"button",onClick:()=>ae(f),className:"shrink-0 ml-2 text-gray-400 hover:text-red-500 dark:text-gray-500 dark:hover:text-red-400 transition-colors cursor-pointer","aria-label":(0,v.formatUILabel)(i.fileSelectorRemove,{name:j(e.file)}),children:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},e.id)),D&&N.length>1&&!o&&!s&&(0,t.jsx)("button",{type:"button",onClick:ce,className:(0,g.cn)("self-start text-gray-400 hover:text-red-500 dark:text-gray-500 dark:hover:text-red-400 transition-colors cursor-pointer",d.subtext),children:i.fileSelectorRemoveAll})]}),$=(0,g.cn)("rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 font-medium transition-colors","hover:bg-gray-50 dark:hover:bg-gray-700","disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1",d.button,F&&"border-red-300 dark:border-red-600");return(0,t.jsxs)("div",{className:(0,g.cn)("flex flex-col",d.gap,se),children:[U&&(0,t.jsx)("label",{htmlFor:S,className:(0,g.cn)("block font-medium text-gray-700 dark:text-gray-300",d.text),children:U}),(0,t.jsx)("input",{ref:k,id:S,type:"file",accept:r!=="directory"?u:void 0,multiple:D,onChange:Y,className:"sr-only",disabled:o||s,"aria-describedby":F?`${S}-error`:z?`${S}-helper`:void 0,"aria-invalid":!!F}),r==="both"&&(0,t.jsx)("input",{ref:M,type:"file",onChange:Y,className:"sr-only",disabled:o||s,tabIndex:-1,"aria-hidden":"true"}),L==="dropzone"?(0,t.jsxs)("div",{role:r==="both"?"group":"button",tabIndex:r==="both"?void 0:o||s?-1:0,onClick:r==="both"?void 0:I,onKeyDown:r==="both"?void 0:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),I())},onDragOver:ue,onDragLeave:fe,onDrop:pe,className:(0,g.cn)("flex flex-col items-center justify-center rounded-lg border-2 border-dashed transition-colors",d.dropzone,Z&&!o&&!s?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800",!o&&!s&&"hover:border-blue-400 dark:hover:border-blue-500 hover:bg-gray-50 dark:hover:bg-gray-800/70",r!=="both"&&!o&&!s&&"cursor-pointer",o&&"opacity-50 cursor-not-allowed",s&&"cursor-default",F&&"border-red-300 dark:border-red-600"),"aria-label":r==="both"?i.fileSelectorDropZone:G||q,children:[(0,t.jsx)("div",{className:(0,g.cn)("text-gray-400 dark:text-gray-500 mb-2",d.icon,Z&&"text-blue-500 dark:text-blue-400"),children:ge}),(0,t.jsxs)("p",{className:(0,g.cn)("text-gray-600 dark:text-gray-400",d.text),children:[G||q," ",!o&&!s&&r!=="both"&&(0,t.jsx)("span",{className:"text-blue-600 dark:text-blue-400 font-medium",children:B||ne})]}),r==="both"&&!o&&!s&&(0,t.jsxs)("div",{className:(0,g.cn)("flex items-center gap-3 mt-1",d.text),children:[(0,t.jsx)("button",{type:"button",onClick:I,className:"text-blue-600 dark:text-blue-400 font-medium hover:underline cursor-pointer focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded",children:B||i.fileSelectorBrowseFiles}),(0,t.jsx)("span",{className:"text-gray-300 dark:text-gray-600",children:"\xB7"}),(0,t.jsx)("button",{type:"button",onClick:O,className:"text-blue-600 dark:text-blue-400 font-medium hover:underline cursor-pointer focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded",children:K||le})]}),(0,t.jsx)("p",{className:(0,g.cn)("text-gray-400 dark:text-gray-500 mt-1",d.subtext),children:D&&h?(0,v.formatUILabel)(i.fileSelectorConstraintsMaxFiles,{accept:W,maxSize:T,maxFiles:h}):(0,v.formatUILabel)(i.fileSelectorConstraints,{accept:W,maxSize:T})})]}):(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[r==="both"?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",onClick:I,disabled:o||s,className:$,children:B||(C?i.fileSelectorChangeFiles:i.fileSelectorChooseFiles)}),(0,t.jsx)("button",{type:"button",onClick:O,disabled:o||s,className:$,children:K||i.fileSelectorChooseFolder})]}):(0,t.jsx)("button",{type:"button",onClick:I,disabled:o||s,className:$,children:B||(r==="directory"?C?i.fileSelectorChangeFolder:i.fileSelectorChooseFolder:C?i.fileSelectorChangeFile:i.fileSelectorChooseFile)}),!C&&(0,t.jsx)("span",{className:(0,g.cn)("text-gray-400 dark:text-gray-500",d.text),children:r==="directory"?i.fileSelectorNoFolder:r==="both"?i.fileSelectorNoFileOrFolder:i.fileSelectorNoFile}),C&&!V&&(0,t.jsx)("span",{className:(0,g.cn)("text-gray-600 dark:text-gray-400 truncate",d.text),children:N.length===1?j(N[0].file):(0,v.formatUILabel)(i.fileSelectorFilesSelected,{count:N.length})})]}),de,F&&(0,t.jsx)("p",{id:`${S}-error`,className:(0,g.cn)("text-red-600 dark:text-red-400",d.subtext),role:"alert",children:F}),z&&!F&&(0,t.jsx)("p",{id:`${S}-helper`,className:(0,g.cn)("text-gray-400 dark:text-gray-500",d.subtext),children:z})]})}0&&(module.exports={FileSelector});
1
+ "use strict";"use client";var H=Object.defineProperty;var me=Object.getOwnPropertyDescriptor;var he=Object.getOwnPropertyNames;var ye=Object.prototype.hasOwnProperty;var ve=(c,l)=>{for(var u in l)H(c,u,{get:l[u],enumerable:!0})},ke=(c,l,u,x)=>{if(l&&typeof l=="object"||typeof l=="function")for(let b of he(l))!ye.call(c,b)&&b!==u&&H(c,b,{get:()=>l[b],enumerable:!(x=me(l,b))||x.enumerable});return c};var Fe=c=>ke(H({},"__esModule",{value:!0}),c);var Ee={};ve(Ee,{FileSelector:()=>Le});module.exports=Fe(Ee);var a=require("react"),g=require("../../lib/cn.cjs"),v=require("../../lib/i18n.cjs"),t=require("react/jsx-runtime"),we={sm:{dropzone:"py-4 px-3",text:"text-xs",subtext:"text-[10px]",icon:"w-6 h-6",button:"px-2.5 py-1.5 text-xs",fileItem:"py-1 px-2 text-xs",gap:"gap-1"},md:{dropzone:"py-6 px-4",text:"text-sm",subtext:"text-xs",icon:"w-8 h-8",button:"px-3 py-2 text-sm",fileItem:"py-1.5 px-3 text-sm",gap:"gap-1.5"},lg:{dropzone:"py-8 px-6",text:"text-base",subtext:"text-sm",icon:"w-10 h-10",button:"px-4 py-2.5 text-base",fileItem:"py-2 px-4 text-base",gap:"gap-2"}},te=c=>{if(c===0)return"0 B";let l=["B","KB","MB","GB"],u=Math.floor(Math.log(c)/Math.log(1024));return`${(c/Math.pow(1024,u)).toFixed(u===0?0:1)} ${l[u]}`},j=c=>c.webkitRelativePath||c.name,Se=(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-full h-full",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"})}),Ne=(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-full h-full",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 00-1.883 2.542l.857 6a2.25 2.25 0 002.227 1.932H19.05a2.25 2.25 0 002.227-1.932l.857-6a2.25 2.25 0 00-1.883-2.542m-16.5 0V6A2.25 2.25 0 016 3.75h3.879a1.5 1.5 0 011.06.44l2.122 2.12a1.5 1.5 0 001.06.44H18A2.25 2.25 0 0120.25 9v.776"})}),De=0;async function Ce(c){let l=[],u=async x=>{if(x.isFile){let b=await new Promise((h,r)=>x.file(h,r));l.push(b)}else if(x.isDirectory){let b=x.createReader(),h=()=>new Promise((L,A)=>b.readEntries(L,A)),r=await h();for(;r.length>0;){for(let L of r)await u(L);r=await h()}}};for(let x of c)await u(x);return l}function Le({value:c,onChange:l,accept:u,multiple:x=!1,maxSize:b=10*1024*1024,maxFiles:h,mode:r="file",variant:L="dropzone",size:A="md",disabled:o=!1,readOnly:s=!1,label:U,helperText:z,error:F,showFileList:V=!0,placeholder:G,browseLabel:B,browseFolderLabel:K,labels:re,icon:oe,onReject:_,className:se}){let i=(0,v.useUILabels)(re),[ie,P]=(0,a.useState)([]),[Z,R]=(0,a.useState)(!1),k=(0,a.useRef)(null),M=(0,a.useRef)(null),S=(0,a.useId)(),w=c!==void 0,N=w?c.map((e,f)=>({file:e,id:`ctrl-${f}`})):ie,d=we[A],D=x||r!=="file";(0,a.useEffect)(()=>{r==="directory"&&k.current&&k.current.setAttribute("webkitdirectory",""),r==="both"&&M.current&&M.current.setAttribute("webkitdirectory","")},[r]);let T=(0,a.useMemo)(()=>te(b),[b]),W=(0,a.useMemo)(()=>u?u.split(",").map(e=>e.trim()).map(e=>e.startsWith(".")?e.toUpperCase():e.endsWith("/*")?e.replace("/*","").toUpperCase():e).join(", "):i.fileSelectorAllFiles,[u,i.fileSelectorAllFiles]),q=r==="directory"?i.fileSelectorDropFolder:r==="both"?i.fileSelectorDropFilesOrFolders:x?i.fileSelectorDropFiles:i.fileSelectorDropFile,ne=r==="directory"?i.fileSelectorBrowseFolder:i.fileSelectorBrowse,le=i.fileSelectorBrowseFolder,J=(0,v.formatUILabel)(i.fileSelectorTooLarge,{maxSize:T}),Q=(0,v.formatUILabel)(i.fileSelectorTypeNotAccepted,{accept:W}),X=(0,a.useCallback)(e=>{if(e.size>b)return J;if(u){let f=u.split(",").map(n=>n.trim()),p=`.${e.name.split(".").pop()?.toLowerCase()}`;if(!f.some(n=>n.startsWith(".")?p===n.toLowerCase():n.endsWith("/*")?e.type.startsWith(n.replace("/*","/")):e.type===n))return Q}return null},[u,b,J,Q]),E=(0,a.useCallback)(e=>{if(o||s)return;let f=Array.from(e),p=[];for(let m of f){let n=X(m);n?_?.(m,n):p.push(m)}if(p.length!==0)if(w)if(D){let n=[...c??[],...p],y=h?n.slice(0,h):n;l?.(y)}else l?.([p[0]]);else P(m=>{let n=p.map(y=>({file:y,id:`file-${++De}`}));if(D){let y=[...m,...n],ee=h?y.slice(0,h):y,be=ee.map(xe=>xe.file);return l?.(be),ee}return l?.([p[0]]),[n[0]]})},[o,s,w,D,h,c,l,_,X]),ae=(0,a.useCallback)(e=>{if(!(o||s)){if(w){let f=(c??[]).filter((p,m)=>m!==e);l?.(f)}else P(f=>{let p=f.filter((m,n)=>n!==e);return l?.(p.map(m=>m.file)),p});k.current&&(k.current.value="")}},[o,s,w,c,l]),ce=(0,a.useCallback)(()=>{o||s||(w?l?.([]):(P([]),l?.([])),k.current&&(k.current.value=""))},[o,s,w,l]),Y=(0,a.useCallback)(e=>{e.target.files&&e.target.files.length>0&&E(e.target.files)},[E]),ue=(0,a.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),!o&&!s&&R(!0)},[o,s]),fe=(0,a.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),R(!1)},[]),pe=(0,a.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),R(!1),o||s)return;let f=e.dataTransfer.items;if(f&&f.length>0&&(r==="directory"||r==="both")){let p=[];for(let n=0;n<f.length;n++){let y=f[n].webkitGetAsEntry?.();y&&p.push(y)}if(p.some(n=>n.isDirectory)){Ce(p).then(n=>{n.length>0&&E(n)});return}}e.dataTransfer.files&&e.dataTransfer.files.length>0&&E(e.dataTransfer.files)},[o,s,r,E]),I=(0,a.useCallback)(()=>{!o&&!s&&k.current?.click()},[o,s]),O=(0,a.useCallback)(()=>{!o&&!s&&M.current?.click()},[o,s]),C=N.length>0,ge=oe||(r==="directory"?Ne:Se),de=V&&C&&(0,t.jsxs)("div",{className:(0,g.cn)("flex flex-col",d.gap),children:[N.map((e,f)=>(0,t.jsxs)("div",{className:(0,g.cn)("flex items-center justify-between rounded-md border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",d.fileItem),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4 shrink-0 text-gray-400 dark:text-gray-500",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),(0,t.jsx)("span",{className:"truncate text-gray-700 dark:text-gray-300",children:j(e.file)}),(0,t.jsxs)("span",{className:"shrink-0 text-gray-400 dark:text-gray-500",children:["(",te(e.file.size),")"]})]}),!o&&!s&&(0,t.jsx)("button",{type:"button",onClick:()=>ae(f),className:"shrink-0 ml-2 text-gray-400 hover:text-red-600 dark:text-gray-500 dark:hover:text-red-400 transition-colors cursor-pointer","aria-label":(0,v.formatUILabel)(i.fileSelectorRemove,{name:j(e.file)}),children:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},e.id)),D&&N.length>1&&!o&&!s&&(0,t.jsx)("button",{type:"button",onClick:ce,className:(0,g.cn)("self-start text-gray-400 hover:text-red-600 dark:text-gray-500 dark:hover:text-red-400 transition-colors cursor-pointer",d.subtext),children:i.fileSelectorRemoveAll})]}),$=(0,g.cn)("rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 font-medium transition-colors","hover:bg-gray-50 dark:hover:bg-gray-700","disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1",d.button,F&&"border-red-300 dark:border-red-600");return(0,t.jsxs)("div",{className:(0,g.cn)("flex flex-col",d.gap,se),children:[U&&(0,t.jsx)("label",{htmlFor:S,className:(0,g.cn)("block font-medium text-gray-700 dark:text-gray-300",d.text),children:U}),(0,t.jsx)("input",{ref:k,id:S,type:"file",accept:r!=="directory"?u:void 0,multiple:D,onChange:Y,className:"sr-only",disabled:o||s,"aria-describedby":F?`${S}-error`:z?`${S}-helper`:void 0,"aria-invalid":!!F}),r==="both"&&(0,t.jsx)("input",{ref:M,type:"file",onChange:Y,className:"sr-only",disabled:o||s,tabIndex:-1,"aria-hidden":"true"}),L==="dropzone"?(0,t.jsxs)("div",{role:r==="both"?"group":"button",tabIndex:r==="both"?void 0:o||s?-1:0,onClick:r==="both"?void 0:I,onKeyDown:r==="both"?void 0:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),I())},onDragOver:ue,onDragLeave:fe,onDrop:pe,className:(0,g.cn)("flex flex-col items-center justify-center rounded-lg border-2 border-dashed transition-colors",d.dropzone,Z&&!o&&!s?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800",!o&&!s&&"hover:border-blue-400 dark:hover:border-blue-500 hover:bg-gray-50 dark:hover:bg-gray-800/70",r!=="both"&&!o&&!s&&"cursor-pointer",o&&"opacity-50 cursor-not-allowed",s&&"cursor-default",F&&"border-red-300 dark:border-red-600"),"aria-label":r==="both"?i.fileSelectorDropZone:G||q,children:[(0,t.jsx)("div",{className:(0,g.cn)("text-gray-400 dark:text-gray-500 mb-2",d.icon,Z&&"text-blue-600 dark:text-blue-400"),children:ge}),(0,t.jsxs)("p",{className:(0,g.cn)("text-gray-600 dark:text-gray-400",d.text),children:[G||q," ",!o&&!s&&r!=="both"&&(0,t.jsx)("span",{className:"text-blue-600 dark:text-blue-400 font-medium",children:B||ne})]}),r==="both"&&!o&&!s&&(0,t.jsxs)("div",{className:(0,g.cn)("flex items-center gap-3 mt-1",d.text),children:[(0,t.jsx)("button",{type:"button",onClick:I,className:"text-blue-600 dark:text-blue-400 font-medium hover:underline cursor-pointer focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded",children:B||i.fileSelectorBrowseFiles}),(0,t.jsx)("span",{className:"text-gray-300 dark:text-gray-600",children:"\xB7"}),(0,t.jsx)("button",{type:"button",onClick:O,className:"text-blue-600 dark:text-blue-400 font-medium hover:underline cursor-pointer focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded",children:K||le})]}),(0,t.jsx)("p",{className:(0,g.cn)("text-gray-400 dark:text-gray-500 mt-1",d.subtext),children:D&&h?(0,v.formatUILabel)(i.fileSelectorConstraintsMaxFiles,{accept:W,maxSize:T,maxFiles:h}):(0,v.formatUILabel)(i.fileSelectorConstraints,{accept:W,maxSize:T})})]}):(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[r==="both"?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",onClick:I,disabled:o||s,className:$,children:B||(C?i.fileSelectorChangeFiles:i.fileSelectorChooseFiles)}),(0,t.jsx)("button",{type:"button",onClick:O,disabled:o||s,className:$,children:K||i.fileSelectorChooseFolder})]}):(0,t.jsx)("button",{type:"button",onClick:I,disabled:o||s,className:$,children:B||(r==="directory"?C?i.fileSelectorChangeFolder:i.fileSelectorChooseFolder:C?i.fileSelectorChangeFile:i.fileSelectorChooseFile)}),!C&&(0,t.jsx)("span",{className:(0,g.cn)("text-gray-400 dark:text-gray-500",d.text),children:r==="directory"?i.fileSelectorNoFolder:r==="both"?i.fileSelectorNoFileOrFolder:i.fileSelectorNoFile}),C&&!V&&(0,t.jsx)("span",{className:(0,g.cn)("text-gray-600 dark:text-gray-400 truncate",d.text),children:N.length===1?j(N[0].file):(0,v.formatUILabel)(i.fileSelectorFilesSelected,{count:N.length})})]}),de,F&&(0,t.jsx)("p",{id:`${S}-error`,className:(0,g.cn)("text-red-600 dark:text-red-400",d.subtext),role:"alert",children:F}),z&&!F&&(0,t.jsx)("p",{id:`${S}-helper`,className:(0,g.cn)("text-gray-400 dark:text-gray-500",d.subtext),children:z})]})}0&&(module.exports={FileSelector});
@@ -1 +1 @@
1
- "use client";import{useState as te,useRef as re,useCallback as m,useEffect as ve,useMemo as oe,useId as ke}from"react";import{cn as p}from"../../lib/cn.js";import{formatUILabel as L,useUILabels as Fe}from"../../lib/i18n.js";import{Fragment as Le,jsx as n,jsxs as h}from"react/jsx-runtime";var we={sm:{dropzone:"py-4 px-3",text:"text-xs",subtext:"text-[10px]",icon:"w-6 h-6",button:"px-2.5 py-1.5 text-xs",fileItem:"py-1 px-2 text-xs",gap:"gap-1"},md:{dropzone:"py-6 px-4",text:"text-sm",subtext:"text-xs",icon:"w-8 h-8",button:"px-3 py-2 text-sm",fileItem:"py-1.5 px-3 text-sm",gap:"gap-1.5"},lg:{dropzone:"py-8 px-6",text:"text-base",subtext:"text-sm",icon:"w-10 h-10",button:"px-4 py-2.5 text-base",fileItem:"py-2 px-4 text-base",gap:"gap-2"}},se=u=>{if(u===0)return"0 B";let l=["B","KB","MB","GB"],g=Math.floor(Math.log(u)/Math.log(1024));return`${(u/Math.pow(1024,g)).toFixed(g===0?0:1)} ${l[g]}`},j=u=>u.webkitRelativePath||u.name,Se=n("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-full h-full",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"})}),Ne=n("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-full h-full",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 00-1.883 2.542l.857 6a2.25 2.25 0 002.227 1.932H19.05a2.25 2.25 0 002.227-1.932l.857-6a2.25 2.25 0 00-1.883-2.542m-16.5 0V6A2.25 2.25 0 016 3.75h3.879a1.5 1.5 0 011.06.44l2.122 2.12a1.5 1.5 0 001.06.44H18A2.25 2.25 0 0120.25 9v.776"})}),De=0;async function Ce(u){let l=[],g=async x=>{if(x.isFile){let v=await new Promise((b,t)=>x.file(b,t));l.push(v)}else if(x.isDirectory){let v=x.createReader(),b=()=>new Promise((E,z)=>v.readEntries(E,z)),t=await b();for(;t.length>0;){for(let E of t)await g(E);t=await b()}}};for(let x of u)await g(x);return l}function Me({value:u,onChange:l,accept:g,multiple:x=!1,maxSize:v=10*1024*1024,maxFiles:b,mode:t="file",variant:E="dropzone",size:z="md",disabled:r=!1,readOnly:o=!1,label:U,helperText:P,error:F,showFileList:V=!0,placeholder:G,browseLabel:M,browseFolderLabel:K,labels:ie,icon:ne,onReject:_,className:le}){let s=Fe(ie),[ae,R]=te([]),[Z,T]=te(!1),k=re(null),A=re(null),S=ke(),w=u!==void 0,N=w?u.map((e,a)=>({file:e,id:`ctrl-${a}`})):ae,f=we[z],D=x||t!=="file";ve(()=>{t==="directory"&&k.current&&k.current.setAttribute("webkitdirectory",""),t==="both"&&A.current&&A.current.setAttribute("webkitdirectory","")},[t]);let W=oe(()=>se(v),[v]),$=oe(()=>g?g.split(",").map(e=>e.trim()).map(e=>e.startsWith(".")?e.toUpperCase():e.endsWith("/*")?e.replace("/*","").toUpperCase():e).join(", "):s.fileSelectorAllFiles,[g,s.fileSelectorAllFiles]),q=t==="directory"?s.fileSelectorDropFolder:t==="both"?s.fileSelectorDropFilesOrFolders:x?s.fileSelectorDropFiles:s.fileSelectorDropFile,ce=t==="directory"?s.fileSelectorBrowseFolder:s.fileSelectorBrowse,ue=s.fileSelectorBrowseFolder,J=L(s.fileSelectorTooLarge,{maxSize:W}),Q=L(s.fileSelectorTypeNotAccepted,{accept:$}),X=m(e=>{if(e.size>v)return J;if(g){let a=g.split(",").map(i=>i.trim()),c=`.${e.name.split(".").pop()?.toLowerCase()}`;if(!a.some(i=>i.startsWith(".")?c===i.toLowerCase():i.endsWith("/*")?e.type.startsWith(i.replace("/*","/")):e.type===i))return Q}return null},[g,v,J,Q]),I=m(e=>{if(r||o)return;let a=Array.from(e),c=[];for(let d of a){let i=X(d);i?_?.(d,i):c.push(d)}if(c.length!==0)if(w)if(D){let i=[...u??[],...c],y=b?i.slice(0,b):i;l?.(y)}else l?.([c[0]]);else R(d=>{let i=c.map(y=>({file:y,id:`file-${++De}`}));if(D){let y=[...d,...i],ee=b?y.slice(0,b):y,he=ee.map(ye=>ye.file);return l?.(he),ee}return l?.([c[0]]),[i[0]]})},[r,o,w,D,b,u,l,_,X]),fe=m(e=>{if(!(r||o)){if(w){let a=(u??[]).filter((c,d)=>d!==e);l?.(a)}else R(a=>{let c=a.filter((d,i)=>i!==e);return l?.(c.map(d=>d.file)),c});k.current&&(k.current.value="")}},[r,o,w,u,l]),pe=m(()=>{r||o||(w?l?.([]):(R([]),l?.([])),k.current&&(k.current.value=""))},[r,o,w,l]),Y=m(e=>{e.target.files&&e.target.files.length>0&&I(e.target.files)},[I]),ge=m(e=>{e.preventDefault(),e.stopPropagation(),!r&&!o&&T(!0)},[r,o]),de=m(e=>{e.preventDefault(),e.stopPropagation(),T(!1)},[]),be=m(e=>{if(e.preventDefault(),e.stopPropagation(),T(!1),r||o)return;let a=e.dataTransfer.items;if(a&&a.length>0&&(t==="directory"||t==="both")){let c=[];for(let i=0;i<a.length;i++){let y=a[i].webkitGetAsEntry?.();y&&c.push(y)}if(c.some(i=>i.isDirectory)){Ce(c).then(i=>{i.length>0&&I(i)});return}}e.dataTransfer.files&&e.dataTransfer.files.length>0&&I(e.dataTransfer.files)},[r,o,t,I]),B=m(()=>{!r&&!o&&k.current?.click()},[r,o]),O=m(()=>{!r&&!o&&A.current?.click()},[r,o]),C=N.length>0,xe=ne||(t==="directory"?Ne:Se),me=V&&C&&h("div",{className:p("flex flex-col",f.gap),children:[N.map((e,a)=>h("div",{className:p("flex items-center justify-between rounded-md border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",f.fileItem),children:[h("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[n("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4 shrink-0 text-gray-400 dark:text-gray-500",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),n("span",{className:"truncate text-gray-700 dark:text-gray-300",children:j(e.file)}),h("span",{className:"shrink-0 text-gray-400 dark:text-gray-500",children:["(",se(e.file.size),")"]})]}),!r&&!o&&n("button",{type:"button",onClick:()=>fe(a),className:"shrink-0 ml-2 text-gray-400 hover:text-red-500 dark:text-gray-500 dark:hover:text-red-400 transition-colors cursor-pointer","aria-label":L(s.fileSelectorRemove,{name:j(e.file)}),children:n("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},e.id)),D&&N.length>1&&!r&&!o&&n("button",{type:"button",onClick:pe,className:p("self-start text-gray-400 hover:text-red-500 dark:text-gray-500 dark:hover:text-red-400 transition-colors cursor-pointer",f.subtext),children:s.fileSelectorRemoveAll})]}),H=p("rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 font-medium transition-colors","hover:bg-gray-50 dark:hover:bg-gray-700","disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1",f.button,F&&"border-red-300 dark:border-red-600");return h("div",{className:p("flex flex-col",f.gap,le),children:[U&&n("label",{htmlFor:S,className:p("block font-medium text-gray-700 dark:text-gray-300",f.text),children:U}),n("input",{ref:k,id:S,type:"file",accept:t!=="directory"?g:void 0,multiple:D,onChange:Y,className:"sr-only",disabled:r||o,"aria-describedby":F?`${S}-error`:P?`${S}-helper`:void 0,"aria-invalid":!!F}),t==="both"&&n("input",{ref:A,type:"file",onChange:Y,className:"sr-only",disabled:r||o,tabIndex:-1,"aria-hidden":"true"}),E==="dropzone"?h("div",{role:t==="both"?"group":"button",tabIndex:t==="both"?void 0:r||o?-1:0,onClick:t==="both"?void 0:B,onKeyDown:t==="both"?void 0:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),B())},onDragOver:ge,onDragLeave:de,onDrop:be,className:p("flex flex-col items-center justify-center rounded-lg border-2 border-dashed transition-colors",f.dropzone,Z&&!r&&!o?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800",!r&&!o&&"hover:border-blue-400 dark:hover:border-blue-500 hover:bg-gray-50 dark:hover:bg-gray-800/70",t!=="both"&&!r&&!o&&"cursor-pointer",r&&"opacity-50 cursor-not-allowed",o&&"cursor-default",F&&"border-red-300 dark:border-red-600"),"aria-label":t==="both"?s.fileSelectorDropZone:G||q,children:[n("div",{className:p("text-gray-400 dark:text-gray-500 mb-2",f.icon,Z&&"text-blue-500 dark:text-blue-400"),children:xe}),h("p",{className:p("text-gray-600 dark:text-gray-400",f.text),children:[G||q," ",!r&&!o&&t!=="both"&&n("span",{className:"text-blue-600 dark:text-blue-400 font-medium",children:M||ce})]}),t==="both"&&!r&&!o&&h("div",{className:p("flex items-center gap-3 mt-1",f.text),children:[n("button",{type:"button",onClick:B,className:"text-blue-600 dark:text-blue-400 font-medium hover:underline cursor-pointer focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded",children:M||s.fileSelectorBrowseFiles}),n("span",{className:"text-gray-300 dark:text-gray-600",children:"\xB7"}),n("button",{type:"button",onClick:O,className:"text-blue-600 dark:text-blue-400 font-medium hover:underline cursor-pointer focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded",children:K||ue})]}),n("p",{className:p("text-gray-400 dark:text-gray-500 mt-1",f.subtext),children:D&&b?L(s.fileSelectorConstraintsMaxFiles,{accept:$,maxSize:W,maxFiles:b}):L(s.fileSelectorConstraints,{accept:$,maxSize:W})})]}):h("div",{className:"flex items-center gap-2",children:[t==="both"?h(Le,{children:[n("button",{type:"button",onClick:B,disabled:r||o,className:H,children:M||(C?s.fileSelectorChangeFiles:s.fileSelectorChooseFiles)}),n("button",{type:"button",onClick:O,disabled:r||o,className:H,children:K||s.fileSelectorChooseFolder})]}):n("button",{type:"button",onClick:B,disabled:r||o,className:H,children:M||(t==="directory"?C?s.fileSelectorChangeFolder:s.fileSelectorChooseFolder:C?s.fileSelectorChangeFile:s.fileSelectorChooseFile)}),!C&&n("span",{className:p("text-gray-400 dark:text-gray-500",f.text),children:t==="directory"?s.fileSelectorNoFolder:t==="both"?s.fileSelectorNoFileOrFolder:s.fileSelectorNoFile}),C&&!V&&n("span",{className:p("text-gray-600 dark:text-gray-400 truncate",f.text),children:N.length===1?j(N[0].file):L(s.fileSelectorFilesSelected,{count:N.length})})]}),me,F&&n("p",{id:`${S}-error`,className:p("text-red-600 dark:text-red-400",f.subtext),role:"alert",children:F}),P&&!F&&n("p",{id:`${S}-helper`,className:p("text-gray-400 dark:text-gray-500",f.subtext),children:P})]})}export{Me as FileSelector};
1
+ "use client";import{useState as te,useRef as re,useCallback as m,useEffect as ve,useMemo as oe,useId as ke}from"react";import{cn as p}from"../../lib/cn.js";import{formatUILabel as L,useUILabels as Fe}from"../../lib/i18n.js";import{Fragment as Le,jsx as n,jsxs as h}from"react/jsx-runtime";var we={sm:{dropzone:"py-4 px-3",text:"text-xs",subtext:"text-[10px]",icon:"w-6 h-6",button:"px-2.5 py-1.5 text-xs",fileItem:"py-1 px-2 text-xs",gap:"gap-1"},md:{dropzone:"py-6 px-4",text:"text-sm",subtext:"text-xs",icon:"w-8 h-8",button:"px-3 py-2 text-sm",fileItem:"py-1.5 px-3 text-sm",gap:"gap-1.5"},lg:{dropzone:"py-8 px-6",text:"text-base",subtext:"text-sm",icon:"w-10 h-10",button:"px-4 py-2.5 text-base",fileItem:"py-2 px-4 text-base",gap:"gap-2"}},se=u=>{if(u===0)return"0 B";let l=["B","KB","MB","GB"],g=Math.floor(Math.log(u)/Math.log(1024));return`${(u/Math.pow(1024,g)).toFixed(g===0?0:1)} ${l[g]}`},j=u=>u.webkitRelativePath||u.name,Se=n("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-full h-full",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"})}),Ne=n("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-full h-full",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 00-1.883 2.542l.857 6a2.25 2.25 0 002.227 1.932H19.05a2.25 2.25 0 002.227-1.932l.857-6a2.25 2.25 0 00-1.883-2.542m-16.5 0V6A2.25 2.25 0 016 3.75h3.879a1.5 1.5 0 011.06.44l2.122 2.12a1.5 1.5 0 001.06.44H18A2.25 2.25 0 0120.25 9v.776"})}),De=0;async function Ce(u){let l=[],g=async x=>{if(x.isFile){let v=await new Promise((b,t)=>x.file(b,t));l.push(v)}else if(x.isDirectory){let v=x.createReader(),b=()=>new Promise((E,z)=>v.readEntries(E,z)),t=await b();for(;t.length>0;){for(let E of t)await g(E);t=await b()}}};for(let x of u)await g(x);return l}function Me({value:u,onChange:l,accept:g,multiple:x=!1,maxSize:v=10*1024*1024,maxFiles:b,mode:t="file",variant:E="dropzone",size:z="md",disabled:r=!1,readOnly:o=!1,label:U,helperText:P,error:F,showFileList:V=!0,placeholder:G,browseLabel:M,browseFolderLabel:K,labels:ie,icon:ne,onReject:_,className:le}){let s=Fe(ie),[ae,R]=te([]),[Z,T]=te(!1),k=re(null),A=re(null),S=ke(),w=u!==void 0,N=w?u.map((e,a)=>({file:e,id:`ctrl-${a}`})):ae,f=we[z],D=x||t!=="file";ve(()=>{t==="directory"&&k.current&&k.current.setAttribute("webkitdirectory",""),t==="both"&&A.current&&A.current.setAttribute("webkitdirectory","")},[t]);let W=oe(()=>se(v),[v]),$=oe(()=>g?g.split(",").map(e=>e.trim()).map(e=>e.startsWith(".")?e.toUpperCase():e.endsWith("/*")?e.replace("/*","").toUpperCase():e).join(", "):s.fileSelectorAllFiles,[g,s.fileSelectorAllFiles]),q=t==="directory"?s.fileSelectorDropFolder:t==="both"?s.fileSelectorDropFilesOrFolders:x?s.fileSelectorDropFiles:s.fileSelectorDropFile,ce=t==="directory"?s.fileSelectorBrowseFolder:s.fileSelectorBrowse,ue=s.fileSelectorBrowseFolder,J=L(s.fileSelectorTooLarge,{maxSize:W}),Q=L(s.fileSelectorTypeNotAccepted,{accept:$}),X=m(e=>{if(e.size>v)return J;if(g){let a=g.split(",").map(i=>i.trim()),c=`.${e.name.split(".").pop()?.toLowerCase()}`;if(!a.some(i=>i.startsWith(".")?c===i.toLowerCase():i.endsWith("/*")?e.type.startsWith(i.replace("/*","/")):e.type===i))return Q}return null},[g,v,J,Q]),I=m(e=>{if(r||o)return;let a=Array.from(e),c=[];for(let d of a){let i=X(d);i?_?.(d,i):c.push(d)}if(c.length!==0)if(w)if(D){let i=[...u??[],...c],y=b?i.slice(0,b):i;l?.(y)}else l?.([c[0]]);else R(d=>{let i=c.map(y=>({file:y,id:`file-${++De}`}));if(D){let y=[...d,...i],ee=b?y.slice(0,b):y,he=ee.map(ye=>ye.file);return l?.(he),ee}return l?.([c[0]]),[i[0]]})},[r,o,w,D,b,u,l,_,X]),fe=m(e=>{if(!(r||o)){if(w){let a=(u??[]).filter((c,d)=>d!==e);l?.(a)}else R(a=>{let c=a.filter((d,i)=>i!==e);return l?.(c.map(d=>d.file)),c});k.current&&(k.current.value="")}},[r,o,w,u,l]),pe=m(()=>{r||o||(w?l?.([]):(R([]),l?.([])),k.current&&(k.current.value=""))},[r,o,w,l]),Y=m(e=>{e.target.files&&e.target.files.length>0&&I(e.target.files)},[I]),ge=m(e=>{e.preventDefault(),e.stopPropagation(),!r&&!o&&T(!0)},[r,o]),de=m(e=>{e.preventDefault(),e.stopPropagation(),T(!1)},[]),be=m(e=>{if(e.preventDefault(),e.stopPropagation(),T(!1),r||o)return;let a=e.dataTransfer.items;if(a&&a.length>0&&(t==="directory"||t==="both")){let c=[];for(let i=0;i<a.length;i++){let y=a[i].webkitGetAsEntry?.();y&&c.push(y)}if(c.some(i=>i.isDirectory)){Ce(c).then(i=>{i.length>0&&I(i)});return}}e.dataTransfer.files&&e.dataTransfer.files.length>0&&I(e.dataTransfer.files)},[r,o,t,I]),B=m(()=>{!r&&!o&&k.current?.click()},[r,o]),O=m(()=>{!r&&!o&&A.current?.click()},[r,o]),C=N.length>0,xe=ne||(t==="directory"?Ne:Se),me=V&&C&&h("div",{className:p("flex flex-col",f.gap),children:[N.map((e,a)=>h("div",{className:p("flex items-center justify-between rounded-md border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",f.fileItem),children:[h("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[n("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4 shrink-0 text-gray-400 dark:text-gray-500",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),n("span",{className:"truncate text-gray-700 dark:text-gray-300",children:j(e.file)}),h("span",{className:"shrink-0 text-gray-400 dark:text-gray-500",children:["(",se(e.file.size),")"]})]}),!r&&!o&&n("button",{type:"button",onClick:()=>fe(a),className:"shrink-0 ml-2 text-gray-400 hover:text-red-600 dark:text-gray-500 dark:hover:text-red-400 transition-colors cursor-pointer","aria-label":L(s.fileSelectorRemove,{name:j(e.file)}),children:n("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},e.id)),D&&N.length>1&&!r&&!o&&n("button",{type:"button",onClick:pe,className:p("self-start text-gray-400 hover:text-red-600 dark:text-gray-500 dark:hover:text-red-400 transition-colors cursor-pointer",f.subtext),children:s.fileSelectorRemoveAll})]}),H=p("rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 font-medium transition-colors","hover:bg-gray-50 dark:hover:bg-gray-700","disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1",f.button,F&&"border-red-300 dark:border-red-600");return h("div",{className:p("flex flex-col",f.gap,le),children:[U&&n("label",{htmlFor:S,className:p("block font-medium text-gray-700 dark:text-gray-300",f.text),children:U}),n("input",{ref:k,id:S,type:"file",accept:t!=="directory"?g:void 0,multiple:D,onChange:Y,className:"sr-only",disabled:r||o,"aria-describedby":F?`${S}-error`:P?`${S}-helper`:void 0,"aria-invalid":!!F}),t==="both"&&n("input",{ref:A,type:"file",onChange:Y,className:"sr-only",disabled:r||o,tabIndex:-1,"aria-hidden":"true"}),E==="dropzone"?h("div",{role:t==="both"?"group":"button",tabIndex:t==="both"?void 0:r||o?-1:0,onClick:t==="both"?void 0:B,onKeyDown:t==="both"?void 0:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),B())},onDragOver:ge,onDragLeave:de,onDrop:be,className:p("flex flex-col items-center justify-center rounded-lg border-2 border-dashed transition-colors",f.dropzone,Z&&!r&&!o?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800",!r&&!o&&"hover:border-blue-400 dark:hover:border-blue-500 hover:bg-gray-50 dark:hover:bg-gray-800/70",t!=="both"&&!r&&!o&&"cursor-pointer",r&&"opacity-50 cursor-not-allowed",o&&"cursor-default",F&&"border-red-300 dark:border-red-600"),"aria-label":t==="both"?s.fileSelectorDropZone:G||q,children:[n("div",{className:p("text-gray-400 dark:text-gray-500 mb-2",f.icon,Z&&"text-blue-600 dark:text-blue-400"),children:xe}),h("p",{className:p("text-gray-600 dark:text-gray-400",f.text),children:[G||q," ",!r&&!o&&t!=="both"&&n("span",{className:"text-blue-600 dark:text-blue-400 font-medium",children:M||ce})]}),t==="both"&&!r&&!o&&h("div",{className:p("flex items-center gap-3 mt-1",f.text),children:[n("button",{type:"button",onClick:B,className:"text-blue-600 dark:text-blue-400 font-medium hover:underline cursor-pointer focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded",children:M||s.fileSelectorBrowseFiles}),n("span",{className:"text-gray-300 dark:text-gray-600",children:"\xB7"}),n("button",{type:"button",onClick:O,className:"text-blue-600 dark:text-blue-400 font-medium hover:underline cursor-pointer focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded",children:K||ue})]}),n("p",{className:p("text-gray-400 dark:text-gray-500 mt-1",f.subtext),children:D&&b?L(s.fileSelectorConstraintsMaxFiles,{accept:$,maxSize:W,maxFiles:b}):L(s.fileSelectorConstraints,{accept:$,maxSize:W})})]}):h("div",{className:"flex items-center gap-2",children:[t==="both"?h(Le,{children:[n("button",{type:"button",onClick:B,disabled:r||o,className:H,children:M||(C?s.fileSelectorChangeFiles:s.fileSelectorChooseFiles)}),n("button",{type:"button",onClick:O,disabled:r||o,className:H,children:K||s.fileSelectorChooseFolder})]}):n("button",{type:"button",onClick:B,disabled:r||o,className:H,children:M||(t==="directory"?C?s.fileSelectorChangeFolder:s.fileSelectorChooseFolder:C?s.fileSelectorChangeFile:s.fileSelectorChooseFile)}),!C&&n("span",{className:p("text-gray-400 dark:text-gray-500",f.text),children:t==="directory"?s.fileSelectorNoFolder:t==="both"?s.fileSelectorNoFileOrFolder:s.fileSelectorNoFile}),C&&!V&&n("span",{className:p("text-gray-600 dark:text-gray-400 truncate",f.text),children:N.length===1?j(N[0].file):L(s.fileSelectorFilesSelected,{count:N.length})})]}),me,F&&n("p",{id:`${S}-error`,className:p("text-red-600 dark:text-red-400",f.subtext),role:"alert",children:F}),P&&!F&&n("p",{id:`${S}-helper`,className:p("text-gray-400 dark:text-gray-500",f.subtext),children:P})]})}export{Me as FileSelector};
@@ -1 +1 @@
1
- "use strict";var a=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var p=(e,t)=>{for(var o in t)a(e,o,{get:t[o],enumerable:!0})},b=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of d(t))!i.call(e,r)&&r!==o&&a(e,r,{get:()=>t[r],enumerable:!(n=g(t,r))||n.enumerable});return e};var x=e=>b(a({},"__esModule",{value:!0}),e);var k={};p(k,{getBaseInputClasses:()=>m,getHelperTextClasses:()=>y,getIconClasses:()=>f,getLabelClasses:()=>u});module.exports=x(k);var s=require("../../../lib/cn.cjs"),c=(e="md")=>({sm:"text-xs p-1.5",md:"text-sm p-2.5",lg:"text-base p-3.5"})[e],m=({size:e="md",error:t,disabled:o,readOnly:n,icon:r,iconPosition:l})=>(0,s.cn)("bg-gray-50 rounded-lg block w-full","border focus:outline-none focus:ring-0","dark:bg-gray-700 dark:placeholder-gray-400",c(e),r&&l==="left"?"pl-9":"",r&&l==="right"?"pr-9":"",o?"opacity-50 cursor-not-allowed":"",n?"bg-gray-100 dark:bg-gray-600 cursor-default":"",t?"border-red-500 dark:border-red-500":"border-gray-300 dark:border-gray-600"),u=(e,t)=>(0,s.cn)("text-sm font-medium",e?"min-w-[120px]":"block mb-2",!t&&"text-gray-900 dark:text-white"),y=e=>(0,s.cn)("mt-1 text-xs",e?"text-red-500 dark:text-red-400":"text-gray-500 dark:text-gray-400"),f=e=>(0,s.cn)("absolute inset-y-0 flex items-center pointer-events-none",e==="left"?"left-2.5":"right-2.5");0&&(module.exports={getBaseInputClasses,getHelperTextClasses,getIconClasses,getLabelClasses});
1
+ "use strict";var a=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var p=(e,t)=>{for(var o in t)a(e,o,{get:t[o],enumerable:!0})},b=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of d(t))!i.call(e,r)&&r!==o&&a(e,r,{get:()=>t[r],enumerable:!(n=g(t,r))||n.enumerable});return e};var x=e=>b(a({},"__esModule",{value:!0}),e);var k={};p(k,{getBaseInputClasses:()=>m,getHelperTextClasses:()=>y,getIconClasses:()=>f,getLabelClasses:()=>u});module.exports=x(k);var s=require("../../../lib/cn.cjs"),c=(e="md")=>({sm:"text-xs p-1.5",md:"text-sm p-2.5",lg:"text-base p-3.5"})[e],m=({size:e="md",error:t,disabled:o,readOnly:n,icon:r,iconPosition:l})=>(0,s.cn)("bg-gray-50 rounded-lg block w-full","border focus:outline-none focus:ring-0","dark:bg-gray-700 dark:placeholder-gray-400",c(e),r&&l==="left"?"pl-9":"",r&&l==="right"?"pr-9":"",o?"opacity-50 cursor-not-allowed":"",n?"bg-gray-100 dark:bg-gray-600 cursor-default":"",t?"border-red-500 dark:border-red-500":"border-gray-300 dark:border-gray-600"),u=(e,t)=>(0,s.cn)("text-sm font-medium",e?"min-w-[120px]":"block mb-2",!t&&"text-gray-900 dark:text-white"),y=e=>(0,s.cn)("mt-1 text-xs",e?"text-red-600 dark:text-red-400":"text-gray-500 dark:text-gray-400"),f=e=>(0,s.cn)("absolute inset-y-0 flex items-center pointer-events-none",e==="left"?"left-2.5":"right-2.5");0&&(module.exports={getBaseInputClasses,getHelperTextClasses,getIconClasses,getLabelClasses});
@@ -1 +1 @@
1
- import{cn as r}from"../../../lib/cn.js";var l=(e="md")=>({sm:"text-xs p-1.5",md:"text-sm p-2.5",lg:"text-base p-3.5"})[e],d=({size:e="md",error:t,disabled:n,readOnly:a,icon:o,iconPosition:s})=>r("bg-gray-50 rounded-lg block w-full","border focus:outline-none focus:ring-0","dark:bg-gray-700 dark:placeholder-gray-400",l(e),o&&s==="left"?"pl-9":"",o&&s==="right"?"pr-9":"",n?"opacity-50 cursor-not-allowed":"",a?"bg-gray-100 dark:bg-gray-600 cursor-default":"",t?"border-red-500 dark:border-red-500":"border-gray-300 dark:border-gray-600"),i=(e,t)=>r("text-sm font-medium",e?"min-w-[120px]":"block mb-2",!t&&"text-gray-900 dark:text-white"),p=e=>r("mt-1 text-xs",e?"text-red-500 dark:text-red-400":"text-gray-500 dark:text-gray-400"),b=e=>r("absolute inset-y-0 flex items-center pointer-events-none",e==="left"?"left-2.5":"right-2.5");export{d as getBaseInputClasses,p as getHelperTextClasses,b as getIconClasses,i as getLabelClasses};
1
+ import{cn as r}from"../../../lib/cn.js";var l=(e="md")=>({sm:"text-xs p-1.5",md:"text-sm p-2.5",lg:"text-base p-3.5"})[e],d=({size:e="md",error:t,disabled:n,readOnly:a,icon:o,iconPosition:s})=>r("bg-gray-50 rounded-lg block w-full","border focus:outline-none focus:ring-0","dark:bg-gray-700 dark:placeholder-gray-400",l(e),o&&s==="left"?"pl-9":"",o&&s==="right"?"pr-9":"",n?"opacity-50 cursor-not-allowed":"",a?"bg-gray-100 dark:bg-gray-600 cursor-default":"",t?"border-red-500 dark:border-red-500":"border-gray-300 dark:border-gray-600"),i=(e,t)=>r("text-sm font-medium",e?"min-w-[120px]":"block mb-2",!t&&"text-gray-900 dark:text-white"),p=e=>r("mt-1 text-xs",e?"text-red-600 dark:text-red-400":"text-gray-500 dark:text-gray-400"),b=e=>r("absolute inset-y-0 flex items-center pointer-events-none",e==="left"?"left-2.5":"right-2.5");export{d as getBaseInputClasses,p as getHelperTextClasses,b as getIconClasses,i as getLabelClasses};
@@ -1 +1 @@
1
- "use strict";"use client";var y=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var te=Object.prototype.hasOwnProperty;var ne=(o,a)=>{for(var c in a)y(o,c,{get:a[c],enumerable:!0})},oe=(o,a,c,d)=>{if(a&&typeof a=="object"||typeof a=="function")for(let l of ae(a))!te.call(o,l)&&l!==c&&y(o,l,{get:()=>a[l],enumerable:!(d=re(a,l))||d.enumerable});return o};var se=o=>oe(y({},"__esModule",{value:!0}),o);var de={};ne(de,{Header:()=>le});module.exports=se(de);var b=require("react"),s=require("../../lib/cn.cjs"),B=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime");function le({logo:o,logoHref:a="/",onLogoClick:c,navItems:d=[],actions:l,rightContent:p,variant:t="default",size:f="md",backgroundColor:g,textColor:P,hoverColor:R,navItemTextColor:j,navItemHoverColor:D,navItemBgHover:O,navItemActiveColor:T,sticky:W=!1,fixed:z=!1,showSearch:k=!1,onSearch:N,searchPlaceholder:Q,menuLabel:_,className:q,containerClassName:A}){let w=(0,B.useUILabels)(),u=Q??w.headerSearchPlaceholder,[h,E]=(0,b.useState)(!1),[C,F]=(0,b.useState)(null),[m,L]=(0,b.useState)(""),U=()=>{E(!h)},G=r=>{F(C===r?null:r)},M=r=>{r.preventDefault(),N&&N(m)},J=(0,s.cn)(W&&"sticky top-0 z-50",z&&"fixed top-0 left-0 right-0 z-50"),K=(0,s.cn)(t==="default"&&!g&&"bg-gray-900 text-white",t==="transparent"&&!g&&"bg-transparent",t==="bordered"&&!g&&"bg-white border-b border-gray-200 text-gray-900 dark:bg-gray-900 dark:border-gray-800 dark:text-gray-100",t==="shadow"&&!g&&"bg-white shadow-md text-gray-900 dark:bg-gray-900 dark:text-gray-100"),V=(0,s.cn)(f==="sm"&&"py-2",f==="md"&&"py-4",f==="lg"&&"py-6"),X=g||"",Y=P||"",Z=R||"",$=(0,s.cn)(J,K,V,X,Y,q),I=(r,i,x=!1)=>{let ee=r.children&&r.children.length>0,H=C===i,v=(0,s.cn)("px-4 py-2 transition-colors flex items-center gap-2",x?"block w-full text-left":"inline-flex",r.active&&"font-semibold border-b-2",r.active&&(T||"border-current"),j||(t==="default"||t==="transparent"?"text-gray-300":"text-gray-600 dark:text-gray-300"),D||Z||(t==="default"||t==="transparent"?"hover:text-white":"hover:text-blue-600 dark:hover:text-blue-400"),O||"");if(ee)return(0,e.jsxs)("div",{className:x?"w-full":"relative",children:[(0,e.jsxs)("button",{type:"button",onClick:()=>G(i),className:v,children:[r.icon&&(0,e.jsx)("span",{className:"w-5 h-5",children:r.icon}),(0,e.jsx)("span",{children:r.label}),r.badge&&(0,e.jsx)("span",{className:"bg-red-500 text-white text-xs px-2 py-0.5 rounded-full",children:r.badge}),(0,e.jsx)("svg",{className:(0,s.cn)("w-4 h-4 transition-transform",H&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),H&&(0,e.jsx)("div",{className:(0,s.cn)("bg-white shadow-lg rounded-lg overflow-hidden dark:bg-gray-800 dark:shadow-black/40",x?"mt-2 mb-2":"absolute top-full left-0 mt-1 min-w-[200px]"),children:r.children?.map(n=>(0,e.jsx)("a",{href:n.href,onClick:n.onClick,target:n.external?"_blank":void 0,rel:n.external?"noopener noreferrer":void 0,className:"block px-4 py-2 text-gray-700 hover:bg-gray-100 transition-colors dark:text-gray-200 dark:hover:bg-gray-700",children:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[n.icon&&(0,e.jsx)("span",{className:"w-5 h-5",children:n.icon}),(0,e.jsx)("span",{children:n.label}),n.badge&&(0,e.jsx)("span",{className:"bg-red-500 text-white text-xs px-2 py-0.5 rounded-full ml-auto",children:n.badge}),n.external&&(0,e.jsx)("svg",{className:"w-4 h-4 ml-auto",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})},n.href??n.label))})]},r.href??r.label);let S=(0,e.jsxs)(e.Fragment,{children:[r.icon&&(0,e.jsx)("span",{className:"w-5 h-5",children:r.icon}),(0,e.jsx)("span",{children:r.label}),r.badge&&(0,e.jsx)("span",{className:"bg-red-500 text-white text-xs px-2 py-0.5 rounded-full",children:r.badge}),r.external&&(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]});return r.onClick?(0,e.jsx)("button",{type:"button",onClick:r.onClick,className:v,children:S},r.href??r.label):(0,e.jsx)("a",{href:r.href,target:r.external?"_blank":void 0,rel:r.external?"noopener noreferrer":void 0,className:v,children:S},r.href??r.label)};return(0,e.jsxs)("header",{className:$,children:[(0,e.jsxs)("nav",{className:(0,s.cn)("container mx-auto flex items-center justify-between px-4",A),children:[o&&(0,e.jsx)("div",{className:"flex items-center",children:a?(0,e.jsx)("a",{href:a,onClick:c,className:"flex items-center hover:opacity-80 transition-opacity",children:o}):(0,e.jsx)("div",{className:"flex items-center",children:o})}),k&&(0,e.jsx)("form",{onSubmit:M,className:"hidden md:flex flex-1 max-w-md mx-8",children:(0,e.jsx)("input",{type:"search","aria-label":u,value:m,onChange:r=>L(r.target.value),placeholder:u,className:"w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-900 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100 dark:placeholder-gray-500"})}),(0,e.jsx)("div",{className:"hidden md:flex items-center gap-2",children:d.map((r,i)=>I(r,i,!1))}),(l||p)&&(0,e.jsxs)("div",{className:"hidden md:flex items-center gap-2 ml-4",children:[l,p]}),d.length>0&&(0,e.jsx)("div",{className:"md:hidden",children:(0,e.jsx)("button",{type:"button",className:(0,s.cn)("inline-flex rounded-lg border-2 p-2 w-10 h-10 justify-center transition-colors focus:outline-none",t==="default"||t==="transparent"?"text-gray-300 hover:text-white":"text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-gray-100"),onClick:U,"aria-label":_??w.headerToggleMenu,"aria-expanded":h,children:(0,e.jsx)("svg",{className:"w-5 h-5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 14",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M1 1h15M1 7h15M1 13h15"})})})})]}),h&&d.length>0&&(0,e.jsx)("div",{className:(0,s.cn)("md:hidden border-t animate-in slide-in-from-top duration-300",t==="default"||t==="transparent"?"border-gray-700":"border-gray-200 dark:border-gray-800"),children:(0,e.jsxs)("div",{className:"flex flex-col py-2 px-4",children:[k&&(0,e.jsx)("form",{onSubmit:M,className:"mb-4",children:(0,e.jsx)("input",{type:"search","aria-label":u,value:m,onChange:r=>L(r.target.value),placeholder:u,className:"w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-900 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100 dark:placeholder-gray-500"})}),d.map((r,i)=>I(r,i,!0)),(l||p)&&(0,e.jsxs)("div",{className:"flex flex-col gap-2 mt-4 pt-4 border-t border-gray-700",children:[l,p]})]})})]})}0&&(module.exports={Header});
1
+ "use strict";"use client";var y=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var te=Object.prototype.hasOwnProperty;var ne=(o,a)=>{for(var c in a)y(o,c,{get:a[c],enumerable:!0})},oe=(o,a,c,d)=>{if(a&&typeof a=="object"||typeof a=="function")for(let l of ae(a))!te.call(o,l)&&l!==c&&y(o,l,{get:()=>a[l],enumerable:!(d=re(a,l))||d.enumerable});return o};var se=o=>oe(y({},"__esModule",{value:!0}),o);var de={};ne(de,{Header:()=>le});module.exports=se(de);var b=require("react"),s=require("../../lib/cn.cjs"),B=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime");function le({logo:o,logoHref:a="/",onLogoClick:c,navItems:d=[],actions:l,rightContent:p,variant:t="default",size:f="md",backgroundColor:g,textColor:P,hoverColor:R,navItemTextColor:j,navItemHoverColor:D,navItemBgHover:O,navItemActiveColor:T,sticky:W=!1,fixed:z=!1,showSearch:k=!1,onSearch:N,searchPlaceholder:Q,menuLabel:_,className:q,containerClassName:A}){let w=(0,B.useUILabels)(),u=Q??w.headerSearchPlaceholder,[h,E]=(0,b.useState)(!1),[C,F]=(0,b.useState)(null),[m,L]=(0,b.useState)(""),U=()=>{E(!h)},G=r=>{F(C===r?null:r)},M=r=>{r.preventDefault(),N&&N(m)},J=(0,s.cn)(W&&"sticky top-0 z-50",z&&"fixed top-0 left-0 right-0 z-50"),K=(0,s.cn)(t==="default"&&!g&&"bg-gray-900 text-white",t==="transparent"&&!g&&"bg-transparent",t==="bordered"&&!g&&"bg-white border-b border-gray-200 text-gray-900 dark:bg-gray-900 dark:border-gray-800 dark:text-gray-100",t==="shadow"&&!g&&"bg-white shadow-md text-gray-900 dark:bg-gray-900 dark:text-gray-100"),V=(0,s.cn)(f==="sm"&&"py-2",f==="md"&&"py-4",f==="lg"&&"py-6"),X=g||"",Y=P||"",Z=R||"",$=(0,s.cn)(J,K,V,X,Y,q),I=(r,i,x=!1)=>{let ee=r.children&&r.children.length>0,H=C===i,v=(0,s.cn)("px-4 py-2 transition-colors flex items-center gap-2",x?"block w-full text-left":"inline-flex",r.active&&"font-semibold border-b-2",r.active&&(T||"border-current"),j||(t==="default"||t==="transparent"?"text-gray-300":"text-gray-600 dark:text-gray-300"),D||Z||(t==="default"||t==="transparent"?"hover:text-white":"hover:text-blue-600 dark:hover:text-blue-400"),O||"");if(ee)return(0,e.jsxs)("div",{className:x?"w-full":"relative",children:[(0,e.jsxs)("button",{type:"button",onClick:()=>G(i),className:v,children:[r.icon&&(0,e.jsx)("span",{className:"w-5 h-5",children:r.icon}),(0,e.jsx)("span",{children:r.label}),r.badge&&(0,e.jsx)("span",{className:"bg-red-600 text-white text-xs px-2 py-0.5 rounded-full",children:r.badge}),(0,e.jsx)("svg",{className:(0,s.cn)("w-4 h-4 transition-transform",H&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),H&&(0,e.jsx)("div",{className:(0,s.cn)("bg-white shadow-lg rounded-lg overflow-hidden dark:bg-gray-800 dark:shadow-black/40",x?"mt-2 mb-2":"absolute top-full left-0 mt-1 min-w-[200px]"),children:r.children?.map(n=>(0,e.jsx)("a",{href:n.href,onClick:n.onClick,target:n.external?"_blank":void 0,rel:n.external?"noopener noreferrer":void 0,className:"block px-4 py-2 text-gray-700 hover:bg-gray-100 transition-colors dark:text-gray-200 dark:hover:bg-gray-700",children:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[n.icon&&(0,e.jsx)("span",{className:"w-5 h-5",children:n.icon}),(0,e.jsx)("span",{children:n.label}),n.badge&&(0,e.jsx)("span",{className:"bg-red-600 text-white text-xs px-2 py-0.5 rounded-full ml-auto",children:n.badge}),n.external&&(0,e.jsx)("svg",{className:"w-4 h-4 ml-auto",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})},n.href??n.label))})]},r.href??r.label);let S=(0,e.jsxs)(e.Fragment,{children:[r.icon&&(0,e.jsx)("span",{className:"w-5 h-5",children:r.icon}),(0,e.jsx)("span",{children:r.label}),r.badge&&(0,e.jsx)("span",{className:"bg-red-600 text-white text-xs px-2 py-0.5 rounded-full",children:r.badge}),r.external&&(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]});return r.onClick?(0,e.jsx)("button",{type:"button",onClick:r.onClick,className:v,children:S},r.href??r.label):(0,e.jsx)("a",{href:r.href,target:r.external?"_blank":void 0,rel:r.external?"noopener noreferrer":void 0,className:v,children:S},r.href??r.label)};return(0,e.jsxs)("header",{className:$,children:[(0,e.jsxs)("nav",{className:(0,s.cn)("container mx-auto flex items-center justify-between px-4",A),children:[o&&(0,e.jsx)("div",{className:"flex items-center",children:a?(0,e.jsx)("a",{href:a,onClick:c,className:"flex items-center hover:opacity-80 transition-opacity",children:o}):(0,e.jsx)("div",{className:"flex items-center",children:o})}),k&&(0,e.jsx)("form",{onSubmit:M,className:"hidden md:flex flex-1 max-w-md mx-8",children:(0,e.jsx)("input",{type:"search","aria-label":u,value:m,onChange:r=>L(r.target.value),placeholder:u,className:"w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-900 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100 dark:placeholder-gray-500"})}),(0,e.jsx)("div",{className:"hidden md:flex items-center gap-2",children:d.map((r,i)=>I(r,i,!1))}),(l||p)&&(0,e.jsxs)("div",{className:"hidden md:flex items-center gap-2 ml-4",children:[l,p]}),d.length>0&&(0,e.jsx)("div",{className:"md:hidden",children:(0,e.jsx)("button",{type:"button",className:(0,s.cn)("inline-flex rounded-lg border-2 p-2 w-10 h-10 justify-center transition-colors focus:outline-none",t==="default"||t==="transparent"?"text-gray-300 hover:text-white":"text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-gray-100"),onClick:U,"aria-label":_??w.headerToggleMenu,"aria-expanded":h,children:(0,e.jsx)("svg",{className:"w-5 h-5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 14",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M1 1h15M1 7h15M1 13h15"})})})})]}),h&&d.length>0&&(0,e.jsx)("div",{className:(0,s.cn)("md:hidden border-t animate-in slide-in-from-top duration-300",t==="default"||t==="transparent"?"border-gray-700":"border-gray-200 dark:border-gray-800"),children:(0,e.jsxs)("div",{className:"flex flex-col py-2 px-4",children:[k&&(0,e.jsx)("form",{onSubmit:M,className:"mb-4",children:(0,e.jsx)("input",{type:"search","aria-label":u,value:m,onChange:r=>L(r.target.value),placeholder:u,className:"w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-900 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100 dark:placeholder-gray-500"})}),d.map((r,i)=>I(r,i,!0)),(l||p)&&(0,e.jsxs)("div",{className:"flex flex-col gap-2 mt-4 pt-4 border-t border-gray-700",children:[l,p]})]})})]})}0&&(module.exports={Header});
@@ -1 +1 @@
1
- "use client";import{useState as x}from"react";import{cn as n}from"../../lib/cn.js";import{useUILabels as ee}from"../../lib/i18n.js";import{Fragment as re,jsx as r,jsxs as o}from"react/jsx-runtime";function oe({logo:p,logoHref:v="/",onLogoClick:S,navItems:d=[],actions:c,rightContent:i,variant:a="default",size:u="md",backgroundColor:l,textColor:B,hoverColor:P,navItemTextColor:R,navItemHoverColor:j,navItemBgHover:D,navItemActiveColor:O,sticky:T=!1,fixed:W=!1,showSearch:y=!1,onSearch:k,searchPlaceholder:z,menuLabel:Q,className:_,containerClassName:q}){let N=ee(),g=z??N.headerSearchPlaceholder,[b,A]=x(!1),[w,E]=x(null),[f,C]=x(""),F=()=>{A(!b)},U=e=>{E(w===e?null:e)},L=e=>{e.preventDefault(),k&&k(f)},G=n(T&&"sticky top-0 z-50",W&&"fixed top-0 left-0 right-0 z-50"),J=n(a==="default"&&!l&&"bg-gray-900 text-white",a==="transparent"&&!l&&"bg-transparent",a==="bordered"&&!l&&"bg-white border-b border-gray-200 text-gray-900 dark:bg-gray-900 dark:border-gray-800 dark:text-gray-100",a==="shadow"&&!l&&"bg-white shadow-md text-gray-900 dark:bg-gray-900 dark:text-gray-100"),K=n(u==="sm"&&"py-2",u==="md"&&"py-4",u==="lg"&&"py-6"),V=l||"",X=B||"",Y=P||"",Z=n(G,J,K,V,X,_),M=(e,s,h=!1)=>{let $=e.children&&e.children.length>0,I=w===s,m=n("px-4 py-2 transition-colors flex items-center gap-2",h?"block w-full text-left":"inline-flex",e.active&&"font-semibold border-b-2",e.active&&(O||"border-current"),R||(a==="default"||a==="transparent"?"text-gray-300":"text-gray-600 dark:text-gray-300"),j||Y||(a==="default"||a==="transparent"?"hover:text-white":"hover:text-blue-600 dark:hover:text-blue-400"),D||"");if($)return o("div",{className:h?"w-full":"relative",children:[o("button",{type:"button",onClick:()=>U(s),className:m,children:[e.icon&&r("span",{className:"w-5 h-5",children:e.icon}),r("span",{children:e.label}),e.badge&&r("span",{className:"bg-red-500 text-white text-xs px-2 py-0.5 rounded-full",children:e.badge}),r("svg",{className:n("w-4 h-4 transition-transform",I&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),I&&r("div",{className:n("bg-white shadow-lg rounded-lg overflow-hidden dark:bg-gray-800 dark:shadow-black/40",h?"mt-2 mb-2":"absolute top-full left-0 mt-1 min-w-[200px]"),children:e.children?.map(t=>r("a",{href:t.href,onClick:t.onClick,target:t.external?"_blank":void 0,rel:t.external?"noopener noreferrer":void 0,className:"block px-4 py-2 text-gray-700 hover:bg-gray-100 transition-colors dark:text-gray-200 dark:hover:bg-gray-700",children:o("div",{className:"flex items-center gap-2",children:[t.icon&&r("span",{className:"w-5 h-5",children:t.icon}),r("span",{children:t.label}),t.badge&&r("span",{className:"bg-red-500 text-white text-xs px-2 py-0.5 rounded-full ml-auto",children:t.badge}),t.external&&r("svg",{className:"w-4 h-4 ml-auto",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})},t.href??t.label))})]},e.href??e.label);let H=o(re,{children:[e.icon&&r("span",{className:"w-5 h-5",children:e.icon}),r("span",{children:e.label}),e.badge&&r("span",{className:"bg-red-500 text-white text-xs px-2 py-0.5 rounded-full",children:e.badge}),e.external&&r("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]});return e.onClick?r("button",{type:"button",onClick:e.onClick,className:m,children:H},e.href??e.label):r("a",{href:e.href,target:e.external?"_blank":void 0,rel:e.external?"noopener noreferrer":void 0,className:m,children:H},e.href??e.label)};return o("header",{className:Z,children:[o("nav",{className:n("container mx-auto flex items-center justify-between px-4",q),children:[p&&r("div",{className:"flex items-center",children:v?r("a",{href:v,onClick:S,className:"flex items-center hover:opacity-80 transition-opacity",children:p}):r("div",{className:"flex items-center",children:p})}),y&&r("form",{onSubmit:L,className:"hidden md:flex flex-1 max-w-md mx-8",children:r("input",{type:"search","aria-label":g,value:f,onChange:e=>C(e.target.value),placeholder:g,className:"w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-900 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100 dark:placeholder-gray-500"})}),r("div",{className:"hidden md:flex items-center gap-2",children:d.map((e,s)=>M(e,s,!1))}),(c||i)&&o("div",{className:"hidden md:flex items-center gap-2 ml-4",children:[c,i]}),d.length>0&&r("div",{className:"md:hidden",children:r("button",{type:"button",className:n("inline-flex rounded-lg border-2 p-2 w-10 h-10 justify-center transition-colors focus:outline-none",a==="default"||a==="transparent"?"text-gray-300 hover:text-white":"text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-gray-100"),onClick:F,"aria-label":Q??N.headerToggleMenu,"aria-expanded":b,children:r("svg",{className:"w-5 h-5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 14",children:r("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M1 1h15M1 7h15M1 13h15"})})})})]}),b&&d.length>0&&r("div",{className:n("md:hidden border-t animate-in slide-in-from-top duration-300",a==="default"||a==="transparent"?"border-gray-700":"border-gray-200 dark:border-gray-800"),children:o("div",{className:"flex flex-col py-2 px-4",children:[y&&r("form",{onSubmit:L,className:"mb-4",children:r("input",{type:"search","aria-label":g,value:f,onChange:e=>C(e.target.value),placeholder:g,className:"w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-900 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100 dark:placeholder-gray-500"})}),d.map((e,s)=>M(e,s,!0)),(c||i)&&o("div",{className:"flex flex-col gap-2 mt-4 pt-4 border-t border-gray-700",children:[c,i]})]})})]})}export{oe as Header};
1
+ "use client";import{useState as x}from"react";import{cn as n}from"../../lib/cn.js";import{useUILabels as ee}from"../../lib/i18n.js";import{Fragment as re,jsx as r,jsxs as o}from"react/jsx-runtime";function oe({logo:p,logoHref:v="/",onLogoClick:S,navItems:d=[],actions:c,rightContent:i,variant:a="default",size:u="md",backgroundColor:l,textColor:B,hoverColor:P,navItemTextColor:R,navItemHoverColor:j,navItemBgHover:D,navItemActiveColor:O,sticky:T=!1,fixed:W=!1,showSearch:y=!1,onSearch:k,searchPlaceholder:z,menuLabel:Q,className:_,containerClassName:q}){let N=ee(),g=z??N.headerSearchPlaceholder,[b,A]=x(!1),[w,E]=x(null),[f,C]=x(""),F=()=>{A(!b)},U=e=>{E(w===e?null:e)},L=e=>{e.preventDefault(),k&&k(f)},G=n(T&&"sticky top-0 z-50",W&&"fixed top-0 left-0 right-0 z-50"),J=n(a==="default"&&!l&&"bg-gray-900 text-white",a==="transparent"&&!l&&"bg-transparent",a==="bordered"&&!l&&"bg-white border-b border-gray-200 text-gray-900 dark:bg-gray-900 dark:border-gray-800 dark:text-gray-100",a==="shadow"&&!l&&"bg-white shadow-md text-gray-900 dark:bg-gray-900 dark:text-gray-100"),K=n(u==="sm"&&"py-2",u==="md"&&"py-4",u==="lg"&&"py-6"),V=l||"",X=B||"",Y=P||"",Z=n(G,J,K,V,X,_),M=(e,s,h=!1)=>{let $=e.children&&e.children.length>0,I=w===s,m=n("px-4 py-2 transition-colors flex items-center gap-2",h?"block w-full text-left":"inline-flex",e.active&&"font-semibold border-b-2",e.active&&(O||"border-current"),R||(a==="default"||a==="transparent"?"text-gray-300":"text-gray-600 dark:text-gray-300"),j||Y||(a==="default"||a==="transparent"?"hover:text-white":"hover:text-blue-600 dark:hover:text-blue-400"),D||"");if($)return o("div",{className:h?"w-full":"relative",children:[o("button",{type:"button",onClick:()=>U(s),className:m,children:[e.icon&&r("span",{className:"w-5 h-5",children:e.icon}),r("span",{children:e.label}),e.badge&&r("span",{className:"bg-red-600 text-white text-xs px-2 py-0.5 rounded-full",children:e.badge}),r("svg",{className:n("w-4 h-4 transition-transform",I&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),I&&r("div",{className:n("bg-white shadow-lg rounded-lg overflow-hidden dark:bg-gray-800 dark:shadow-black/40",h?"mt-2 mb-2":"absolute top-full left-0 mt-1 min-w-[200px]"),children:e.children?.map(t=>r("a",{href:t.href,onClick:t.onClick,target:t.external?"_blank":void 0,rel:t.external?"noopener noreferrer":void 0,className:"block px-4 py-2 text-gray-700 hover:bg-gray-100 transition-colors dark:text-gray-200 dark:hover:bg-gray-700",children:o("div",{className:"flex items-center gap-2",children:[t.icon&&r("span",{className:"w-5 h-5",children:t.icon}),r("span",{children:t.label}),t.badge&&r("span",{className:"bg-red-600 text-white text-xs px-2 py-0.5 rounded-full ml-auto",children:t.badge}),t.external&&r("svg",{className:"w-4 h-4 ml-auto",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})},t.href??t.label))})]},e.href??e.label);let H=o(re,{children:[e.icon&&r("span",{className:"w-5 h-5",children:e.icon}),r("span",{children:e.label}),e.badge&&r("span",{className:"bg-red-600 text-white text-xs px-2 py-0.5 rounded-full",children:e.badge}),e.external&&r("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]});return e.onClick?r("button",{type:"button",onClick:e.onClick,className:m,children:H},e.href??e.label):r("a",{href:e.href,target:e.external?"_blank":void 0,rel:e.external?"noopener noreferrer":void 0,className:m,children:H},e.href??e.label)};return o("header",{className:Z,children:[o("nav",{className:n("container mx-auto flex items-center justify-between px-4",q),children:[p&&r("div",{className:"flex items-center",children:v?r("a",{href:v,onClick:S,className:"flex items-center hover:opacity-80 transition-opacity",children:p}):r("div",{className:"flex items-center",children:p})}),y&&r("form",{onSubmit:L,className:"hidden md:flex flex-1 max-w-md mx-8",children:r("input",{type:"search","aria-label":g,value:f,onChange:e=>C(e.target.value),placeholder:g,className:"w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-900 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100 dark:placeholder-gray-500"})}),r("div",{className:"hidden md:flex items-center gap-2",children:d.map((e,s)=>M(e,s,!1))}),(c||i)&&o("div",{className:"hidden md:flex items-center gap-2 ml-4",children:[c,i]}),d.length>0&&r("div",{className:"md:hidden",children:r("button",{type:"button",className:n("inline-flex rounded-lg border-2 p-2 w-10 h-10 justify-center transition-colors focus:outline-none",a==="default"||a==="transparent"?"text-gray-300 hover:text-white":"text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-gray-100"),onClick:F,"aria-label":Q??N.headerToggleMenu,"aria-expanded":b,children:r("svg",{className:"w-5 h-5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 14",children:r("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M1 1h15M1 7h15M1 13h15"})})})})]}),b&&d.length>0&&r("div",{className:n("md:hidden border-t animate-in slide-in-from-top duration-300",a==="default"||a==="transparent"?"border-gray-700":"border-gray-200 dark:border-gray-800"),children:o("div",{className:"flex flex-col py-2 px-4",children:[y&&r("form",{onSubmit:L,className:"mb-4",children:r("input",{type:"search","aria-label":g,value:f,onChange:e=>C(e.target.value),placeholder:g,className:"w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-900 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100 dark:placeholder-gray-500"})}),d.map((e,s)=>M(e,s,!0)),(c||i)&&o("div",{className:"flex flex-col gap-2 mt-4 pt-4 border-t border-gray-700",children:[c,i]})]})})]})}export{oe as Header};
@@ -19,4 +19,4 @@
19
19
  rounded-xl shadow-xl
20
20
  text-sm text-gray-700 dark:text-gray-300
21
21
  animate-in fade-in-0 zoom-in-95 duration-150
22
- `,role:"tooltip",children:[(p||f)&&(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:[(0,e.jsx)("div",{className:"flex items-center gap-2",children:p&&(0,e.jsx)("h3",{className:"text-sm font-semibold",children:p})}),f&&(0,e.jsx)("div",{className:"flex items-center gap-1",children:c?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",onClick:q,disabled:I,className:"p-1.5 rounded-md hover:bg-green-100 dark:hover:bg-green-900/30 text-green-600 dark:text-green-400 transition-colors disabled:opacity-50 cursor-pointer",title:r.helpButtonSave,children:I?ae:te}),(0,e.jsx)("button",{type:"button",onClick:K,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:r.helpButtonCancel,children:re}),u&&(0,e.jsx)("button",{type:"button",onClick:V,disabled:I,className:"p-1.5 rounded-md hover:bg-orange-100 dark:hover:bg-orange-900/30 text-orange-600 dark:text-orange-400 transition-colors disabled:opacity-50 cursor-pointer",title:r.helpButtonReset,children:oe})]}):(0,e.jsx)("button",{type:"button",onClick:G,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:r.helpButtonEdit,children:ee})})]}),S&&(0,e.jsx)("div",{className:`px-4 py-2 text-xs ${S.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400"}`,children:S.text}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:c?a?h?(0,e.jsx)(h,{value:v,onChange:x,placeholder:r.markdownEditorPlaceholder}):(0,e.jsx)("p",{role:"alert",className:"p-3 text-sm text-gray-500 dark:text-gray-400",children:R??r.markdownEditorUnavailable}):(0,e.jsx)("div",{className:"space-y-2",children:(0,e.jsx)("textarea",{ref:P,"aria-label":r.helpButtonContent,value:v,onChange:g=>x(g.target.value),className:"w-full h-64 p-3 text-sm bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg resize-none focus:outline-none focus:ring-2 focus:ring-blue-500/50 text-gray-700 dark:text-gray-300 font-mono",placeholder:r.helpButtonContentPlaceholder})}):typeof N=="string"?(0,e.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:a?(0,e.jsx)(U.default,{remarkPlugins:ie,components:de,children:N}):(0,e.jsx)("div",{dangerouslySetInnerHTML:{__html:_.default.sanitize(N)}})}):N})]})]}):null}function ce({children:t,content:a,markdown:s=!1,position:d="bottom",size:l="sm",visible:C=!0,editable:f=!1,onSave:m,onReset:u,width:B="md",title:p,className:h,markdownEditor:R,markdownEditorUnavailableLabel:M,labels:r}){return(0,e.jsxs)("div",{className:"inline-flex items-center gap-2.5",children:[t,(0,e.jsx)($,{content:a,markdown:s,position:d,size:l,visible:C,editable:f,onSave:m,onReset:u,width:B,title:p,className:h,markdownEditor:R,markdownEditorUnavailableLabel:M,labels:r})]})}0&&(module.exports={HelpButton,WithHelpButton});
22
+ `,role:"tooltip",children:[(p||f)&&(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:[(0,e.jsx)("div",{className:"flex items-center gap-2",children:p&&(0,e.jsx)("h3",{className:"text-sm font-semibold",children:p})}),f&&(0,e.jsx)("div",{className:"flex items-center gap-1",children:c?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",onClick:q,disabled:I,className:"p-1.5 rounded-md hover:bg-green-100 dark:hover:bg-green-900/30 text-green-700 dark:text-green-400 transition-colors disabled:opacity-50 cursor-pointer",title:r.helpButtonSave,children:I?ae:te}),(0,e.jsx)("button",{type:"button",onClick:K,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:r.helpButtonCancel,children:re}),u&&(0,e.jsx)("button",{type:"button",onClick:V,disabled:I,className:"p-1.5 rounded-md hover:bg-orange-100 dark:hover:bg-orange-900/30 text-orange-700 dark:text-orange-400 transition-colors disabled:opacity-50 cursor-pointer",title:r.helpButtonReset,children:oe})]}):(0,e.jsx)("button",{type:"button",onClick:G,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:r.helpButtonEdit,children:ee})})]}),S&&(0,e.jsx)("div",{className:`px-4 py-2 text-xs ${S.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400"}`,children:S.text}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:c?a?h?(0,e.jsx)(h,{value:v,onChange:x,placeholder:r.markdownEditorPlaceholder}):(0,e.jsx)("p",{role:"alert",className:"p-3 text-sm text-gray-500 dark:text-gray-400",children:R??r.markdownEditorUnavailable}):(0,e.jsx)("div",{className:"space-y-2",children:(0,e.jsx)("textarea",{ref:P,"aria-label":r.helpButtonContent,value:v,onChange:g=>x(g.target.value),className:"w-full h-64 p-3 text-sm bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg resize-none focus:outline-none focus:ring-2 focus:ring-blue-500/50 text-gray-700 dark:text-gray-300 font-mono",placeholder:r.helpButtonContentPlaceholder})}):typeof N=="string"?(0,e.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:a?(0,e.jsx)(U.default,{remarkPlugins:ie,components:de,children:N}):(0,e.jsx)("div",{dangerouslySetInnerHTML:{__html:_.default.sanitize(N)}})}):N})]})]}):null}function ce({children:t,content:a,markdown:s=!1,position:d="bottom",size:l="sm",visible:C=!0,editable:f=!1,onSave:m,onReset:u,width:B="md",title:p,className:h,markdownEditor:R,markdownEditorUnavailableLabel:M,labels:r}){return(0,e.jsxs)("div",{className:"inline-flex items-center gap-2.5",children:[t,(0,e.jsx)($,{content:a,markdown:s,position:d,size:l,visible:C,editable:f,onSave:m,onReset:u,width:B,title:p,className:h,markdownEditor:R,markdownEditorUnavailableLabel:M,labels:r})]})}0&&(module.exports={HelpButton,WithHelpButton});
@@ -19,4 +19,4 @@
19
19
  rounded-xl shadow-xl
20
20
  text-sm text-gray-700 dark:text-gray-300
21
21
  animate-in fade-in-0 zoom-in-95 duration-150
22
- `,role:"tooltip",children:[(g||f)&&a("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:[e("div",{className:"flex items-center gap-2",children:g&&e("h3",{className:"text-sm font-semibold",children:g})}),f&&e("div",{className:"flex items-center gap-1",children:l?a(ae,{children:[e("button",{type:"button",onClick:D,disabled:T,className:"p-1.5 rounded-md hover:bg-green-100 dark:hover:bg-green-900/30 text-green-600 dark:text-green-400 transition-colors disabled:opacity-50 cursor-pointer",title:r.helpButtonSave,children:T?X:F}),e("button",{type:"button",onClick:A,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:r.helpButtonCancel,children:J}),d&&e("button",{type:"button",onClick:$,disabled:T,className:"p-1.5 rounded-md hover:bg-orange-100 dark:hover:bg-orange-900/30 text-orange-600 dark:text-orange-400 transition-colors disabled:opacity-50 cursor-pointer",title:r.helpButtonReset,children:Q})]}):e("button",{type:"button",onClick:U,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:r.helpButtonEdit,children:j})})]}),O&&e("div",{className:`px-4 py-2 text-xs ${O.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400"}`,children:O.text}),e("div",{className:"flex-1 overflow-y-auto p-4",children:l?n?h?e(h,{value:v,onChange:y,placeholder:r.markdownEditorPlaceholder}):e("p",{role:"alert",className:"p-3 text-sm text-gray-500 dark:text-gray-400",children:L??r.markdownEditorUnavailable}):e("div",{className:"space-y-2",children:e("textarea",{ref:z,"aria-label":r.helpButtonContent,value:v,onChange:c=>y(c.target.value),className:"w-full h-64 p-3 text-sm bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg resize-none focus:outline-none focus:ring-2 focus:ring-blue-500/50 text-gray-700 dark:text-gray-300 font-mono",placeholder:r.helpButtonContentPlaceholder})}):typeof N=="string"?e("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:n?e(K,{remarkPlugins:te,components:re,children:N}):e("div",{dangerouslySetInnerHTML:{__html:G.sanitize(N)}})}):N})]})]}):null}function ce({children:t,content:n,markdown:i=!1,position:x="bottom",size:B="sm",visible:R=!0,editable:f=!1,onSave:u,onReset:d,width:M="md",title:g,className:h,markdownEditor:L,markdownEditorUnavailableLabel:I,labels:r}){return a("div",{className:"inline-flex items-center gap-2.5",children:[t,e(oe,{content:n,markdown:i,position:x,size:B,visible:R,editable:f,onSave:u,onReset:d,width:M,title:g,className:h,markdownEditor:L,markdownEditorUnavailableLabel:I,labels:r})]})}export{oe as HelpButton,ce as WithHelpButton};
22
+ `,role:"tooltip",children:[(g||f)&&a("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:[e("div",{className:"flex items-center gap-2",children:g&&e("h3",{className:"text-sm font-semibold",children:g})}),f&&e("div",{className:"flex items-center gap-1",children:l?a(ae,{children:[e("button",{type:"button",onClick:D,disabled:T,className:"p-1.5 rounded-md hover:bg-green-100 dark:hover:bg-green-900/30 text-green-700 dark:text-green-400 transition-colors disabled:opacity-50 cursor-pointer",title:r.helpButtonSave,children:T?X:F}),e("button",{type:"button",onClick:A,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:r.helpButtonCancel,children:J}),d&&e("button",{type:"button",onClick:$,disabled:T,className:"p-1.5 rounded-md hover:bg-orange-100 dark:hover:bg-orange-900/30 text-orange-700 dark:text-orange-400 transition-colors disabled:opacity-50 cursor-pointer",title:r.helpButtonReset,children:Q})]}):e("button",{type:"button",onClick:U,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:r.helpButtonEdit,children:j})})]}),O&&e("div",{className:`px-4 py-2 text-xs ${O.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400"}`,children:O.text}),e("div",{className:"flex-1 overflow-y-auto p-4",children:l?n?h?e(h,{value:v,onChange:y,placeholder:r.markdownEditorPlaceholder}):e("p",{role:"alert",className:"p-3 text-sm text-gray-500 dark:text-gray-400",children:L??r.markdownEditorUnavailable}):e("div",{className:"space-y-2",children:e("textarea",{ref:z,"aria-label":r.helpButtonContent,value:v,onChange:c=>y(c.target.value),className:"w-full h-64 p-3 text-sm bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg resize-none focus:outline-none focus:ring-2 focus:ring-blue-500/50 text-gray-700 dark:text-gray-300 font-mono",placeholder:r.helpButtonContentPlaceholder})}):typeof N=="string"?e("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:n?e(K,{remarkPlugins:te,components:re,children:N}):e("div",{dangerouslySetInnerHTML:{__html:G.sanitize(N)}})}):N})]})]}):null}function ce({children:t,content:n,markdown:i=!1,position:x="bottom",size:B="sm",visible:R=!0,editable:f=!1,onSave:u,onReset:d,width:M="md",title:g,className:h,markdownEditor:L,markdownEditorUnavailableLabel:I,labels:r}){return a("div",{className:"inline-flex items-center gap-2.5",children:[t,e(oe,{content:n,markdown:i,position:x,size:B,visible:R,editable:f,onSave:u,onReset:d,width:M,title:g,className:h,markdownEditor:L,markdownEditorUnavailableLabel:I,labels:r})]})}export{oe as HelpButton,ce as WithHelpButton};
@@ -1 +1 @@
1
- "use strict";"use client";var l=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var c=(n,r)=>{for(var d in r)l(n,d,{get:r[d],enumerable:!0})},k=(n,r,d,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of p(r))!u.call(n,t)&&t!==d&&l(n,t,{get:()=>r[t],enumerable:!(i=m(r,t))||i.enumerable});return n};var P=n=>k(l({},"__esModule",{value:!0}),n);var b={};c(b,{MarkdownEditor:()=>g});module.exports=P(b);var E=require("@mdxeditor/editor/style.css"),o=require("@mdxeditor/editor"),a=require("react"),s=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime"),h=()=>(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(o.UndoRedo,{}),(0,e.jsx)(o.BlockTypeSelect,{}),(0,e.jsx)(o.BoldItalicUnderlineToggles,{}),(0,e.jsx)(o.CodeToggle,{}),(0,e.jsx)(o.CreateLink,{}),(0,e.jsx)(o.ListsToggle,{}),(0,e.jsx)(o.InsertThematicBreak,{})]}),w=[(0,o.headingsPlugin)(),(0,o.listsPlugin)(),(0,o.quotePlugin)(),(0,o.linkPlugin)(),(0,o.linkDialogPlugin)(),(0,o.codeBlockPlugin)({defaultCodeBlockLanguage:""}),(0,o.thematicBreakPlugin)(),(0,o.markdownShortcutPlugin)(),(0,o.toolbarPlugin)({toolbarContents:h})],g=(0,a.forwardRef)(({value:n,onChange:r,placeholder:d},i)=>{let t=(0,s.useUILabels)();return(0,e.jsx)("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden bg-white dark:bg-gray-800",children:(0,e.jsx)(o.MDXEditor,{ref:i,markdown:n,onChange:r,placeholder:d??t.markdownEditorPlaceholder,contentEditableClassName:"prose prose-sm dark:prose-invert max-w-none p-3 min-h-[16rem] focus:outline-none",plugins:w})})});g.displayName="MarkdownEditor";0&&(module.exports={MarkdownEditor});
1
+ "use strict";"use client";var d=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var m=(t,r)=>{for(var n in r)d(t,n,{get:r[n],enumerable:!0})},p=(t,r,n,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of c(r))!k.call(t,a)&&a!==n&&d(t,a,{get:()=>r[a],enumerable:!(i=u(r,a))||i.enumerable});return t};var h=t=>p(d({},"__esModule",{value:!0}),t);var f={};m(f,{MarkdownEditor:()=>g});module.exports=h(f);var P=require("@mdxeditor/editor/style.css"),e=require("@mdxeditor/editor"),l=require("react"),s=require("../../lib/i18n.cjs"),o=require("react/jsx-runtime"),y=()=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(e.UndoRedo,{}),(0,o.jsx)(e.BlockTypeSelect,{}),(0,o.jsx)(e.BoldItalicUnderlineToggles,{}),(0,o.jsx)(e.CodeToggle,{}),(0,o.jsx)(e.CreateLink,{}),(0,o.jsx)(e.ListsToggle,{}),(0,o.jsx)(e.InsertThematicBreak,{})]}),b=[(0,e.headingsPlugin)(),(0,e.listsPlugin)(),(0,e.quotePlugin)(),(0,e.linkPlugin)(),(0,e.linkDialogPlugin)(),(0,e.codeBlockPlugin)({defaultCodeBlockLanguage:""}),(0,e.thematicBreakPlugin)(),(0,e.markdownShortcutPlugin)(),(0,e.toolbarPlugin)({toolbarContents:y})],g=(0,l.forwardRef)(({value:t,onChange:r,placeholder:n},i)=>{let a=(0,s.useUILabels)();return(0,o.jsx)("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden bg-white dark:bg-gray-800",children:(0,o.jsx)(e.MDXEditor,{ref:i,markdown:t,onChange:r,placeholder:n??a.markdownEditorPlaceholder,contentEditableClassName:"prose prose-sm dark:prose-invert dark:text-gray-300! max-w-none p-3 min-h-[16rem] focus:outline-none",plugins:b})})});g.displayName="MarkdownEditor";0&&(module.exports={MarkdownEditor});
@@ -1 +1 @@
1
- "use client";import"@mdxeditor/editor/style.css";import{MDXEditor as i,headingsPlugin as l,listsPlugin as a,quotePlugin as s,linkPlugin as g,linkDialogPlugin as m,codeBlockPlugin as p,thematicBreakPlugin as u,markdownShortcutPlugin as c,toolbarPlugin as k,BlockTypeSelect as P,BoldItalicUnderlineToggles as h,CodeToggle as w,ListsToggle as b,CreateLink as f,InsertThematicBreak as E,UndoRedo as M}from"@mdxeditor/editor";import{forwardRef as y}from"react";import{useUILabels as T}from"../../lib/i18n.js";import{Fragment as N,jsx as o,jsxs as v}from"react/jsx-runtime";var B=()=>v(N,{children:[o(M,{}),o(P,{}),o(h,{}),o(w,{}),o(f,{}),o(b,{}),o(E,{})]}),C=[l(),a(),s(),g(),m(),p({defaultCodeBlockLanguage:""}),u(),c(),k({toolbarContents:B})],L=y(({value:e,onChange:r,placeholder:n},t)=>{let d=T();return o("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden bg-white dark:bg-gray-800",children:o(i,{ref:t,markdown:e,onChange:r,placeholder:n??d.markdownEditorPlaceholder,contentEditableClassName:"prose prose-sm dark:prose-invert max-w-none p-3 min-h-[16rem] focus:outline-none",plugins:C})})});L.displayName="MarkdownEditor";export{L as MarkdownEditor};
1
+ "use client";import"@mdxeditor/editor/style.css";import{MDXEditor as i,headingsPlugin as d,listsPlugin as l,quotePlugin as s,linkPlugin as g,linkDialogPlugin as u,codeBlockPlugin as c,thematicBreakPlugin as k,markdownShortcutPlugin as m,toolbarPlugin as p,BlockTypeSelect as h,BoldItalicUnderlineToggles as y,CodeToggle as b,ListsToggle as f,CreateLink as w,InsertThematicBreak as P,UndoRedo as E}from"@mdxeditor/editor";import{forwardRef as M}from"react";import{useUILabels as T}from"../../lib/i18n.js";import{Fragment as N,jsx as e,jsxs as D}from"react/jsx-runtime";var B=()=>D(N,{children:[e(E,{}),e(h,{}),e(y,{}),e(b,{}),e(w,{}),e(f,{}),e(P,{})]}),C=[d(),l(),s(),g(),u(),c({defaultCodeBlockLanguage:""}),k(),m(),p({toolbarContents:B})],L=M(({value:o,onChange:r,placeholder:t},a)=>{let n=T();return e("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden bg-white dark:bg-gray-800",children:e(i,{ref:a,markdown:o,onChange:r,placeholder:t??n.markdownEditorPlaceholder,contentEditableClassName:"prose prose-sm dark:prose-invert dark:text-gray-300! max-w-none p-3 min-h-[16rem] focus:outline-none",plugins:C})})});L.displayName="MarkdownEditor";export{L as MarkdownEditor};
@@ -1 +1 @@
1
- "use strict";"use client";var U=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var S=(t,e)=>{for(var s in e)U(t,s,{get:e[s],enumerable:!0})},$=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of B(e))!G.call(t,l)&&l!==s&&U(t,l,{get:()=>e[l],enumerable:!(i=j(e,l))||i.enumerable});return t};var z=t=>$(U({},"__esModule",{value:!0}),t);var W={};S(W,{ImageUploader:()=>O});module.exports=z(W);var a=require("react"),p=require("../../lib/i18n.cjs"),r=require("react/jsx-runtime"),A={"16/9":"aspect-[16/9]","4/3":"aspect-[4/3]","1/1":"aspect-square",auto:""},D=(t,e)=>new Promise((s,i)=>{let l=new FileReader;l.onload=g=>{let f=g.target?.result;s(f)},l.onerror=()=>{i(new Error(e))},l.readAsDataURL(t)});function O({value:t,onChange:e,onUpload:s,label:i,maxSize:l=5*1024*1024,accept:g="image/*",helpText:f,disabled:b=!1,className:L="",showUrlInput:E=!0,urlPlaceholder:C="https://example.com/image.jpg",labels:P,aspectRatio:h="16/9"}){let o=(0,p.useUILabels)(P),v=i??o.imageUploaderLabel,[y,k]=(0,a.useState)(!1),[I,n]=(0,a.useState)(null),c=(0,a.useRef)(null),w=(0,a.useId)(),x=(0,a.useMemo)(()=>(l/(1024*1024)).toFixed(0),[l]),F=(0,p.formatUILabel)(o.imageUploaderHelp,{formats:g==="image/*"?"JPG, PNG, GIF, WebP":g,maxSize:x}),R=(0,a.useCallback)(async u=>{let m=u.target.files?.[0];if(m){if(!m.type.startsWith("image/")){n(o.imageUploaderNotImage);return}if(m.size>l){n((0,p.formatUILabel)(o.imageUploaderTooLarge,{maxSize:x}));return}k(!0),n(null);try{if(s){let d=await s(m);e(d)}else{let d=await D(m,o.imageUploaderReadError);e(d)}c.current&&(c.current.value="")}catch(d){console.error("Upload error:",d),n(d instanceof Error?d.message:o.imageUploaderUploadError)}finally{k(!1)}}},[l,x,e,s,o]),M=(0,a.useCallback)(()=>{e(""),c.current&&(c.current.value=""),n(null)},[e]),N=(0,a.useCallback)(u=>{e(u),n(null)},[e]),T=(0,a.useCallback)(()=>{c.current?.click()},[]),H=(0,a.useCallback)(u=>{N(u.target.value)},[N]);return(0,r.jsxs)("div",{className:`space-y-2 ${L}`,children:[v&&(0,r.jsx)("label",{className:"block text-sm font-semibold text-gray-700 dark:text-gray-300",children:v}),t&&(0,r.jsxs)("div",{className:"relative w-full overflow-hidden rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800/50",children:[(0,r.jsx)("div",{className:`relative ${A[h]} ${h==="auto"?"max-h-64":""} flex items-center justify-center`,children:(0,r.jsx)("img",{src:t,alt:o.imageUploaderPreview,className:"w-full h-full object-contain"})}),(0,r.jsx)("button",{type:"button",onClick:M,disabled:b,className:"absolute top-2 right-2 bg-red-500 text-white rounded-full w-6 h-6 flex items-center justify-center text-xs hover:bg-red-600 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",title:o.imageUploaderRemove,children:"\xD7"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("input",{ref:c,type:"file","aria-label":o.imageUploaderChoose,accept:g,onChange:R,className:"hidden",disabled:b||y}),(0,r.jsx)("button",{type:"button",onClick:T,disabled:b||y,className:"px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200",children:y?o.imageUploaderUploading:t?o.imageUploaderChangeButton:o.imageUploaderChooseButton})]}),E&&(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("label",{htmlFor:w,className:"block text-xs text-gray-500 dark:text-gray-400",children:o.imageUploaderUrlLabel}),(0,r.jsx)("input",{id:w,type:"url",value:t||"",onChange:H,placeholder:C,disabled:b,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-800 dark:text-gray-200 disabled:opacity-50 disabled:cursor-not-allowed"})]}),I&&(0,r.jsxs)("div",{className:"text-red-600 dark:text-red-400 text-sm bg-red-50 dark:bg-red-900/20 p-2 rounded border border-red-200 dark:border-red-800",children:["\u274C ",I]}),(0,r.jsx)("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:f||F})]})}0&&(module.exports={ImageUploader});
1
+ "use strict";"use client";var U=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var S=(t,e)=>{for(var s in e)U(t,s,{get:e[s],enumerable:!0})},$=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of B(e))!G.call(t,l)&&l!==s&&U(t,l,{get:()=>e[l],enumerable:!(i=j(e,l))||i.enumerable});return t};var z=t=>$(U({},"__esModule",{value:!0}),t);var W={};S(W,{ImageUploader:()=>O});module.exports=z(W);var a=require("react"),p=require("../../lib/i18n.cjs"),r=require("react/jsx-runtime"),A={"16/9":"aspect-[16/9]","4/3":"aspect-[4/3]","1/1":"aspect-square",auto:""},D=(t,e)=>new Promise((s,i)=>{let l=new FileReader;l.onload=g=>{let f=g.target?.result;s(f)},l.onerror=()=>{i(new Error(e))},l.readAsDataURL(t)});function O({value:t,onChange:e,onUpload:s,label:i,maxSize:l=5*1024*1024,accept:g="image/*",helpText:f,disabled:b=!1,className:L="",showUrlInput:E=!0,urlPlaceholder:C="https://example.com/image.jpg",labels:P,aspectRatio:h="16/9"}){let o=(0,p.useUILabels)(P),v=i??o.imageUploaderLabel,[y,k]=(0,a.useState)(!1),[I,n]=(0,a.useState)(null),c=(0,a.useRef)(null),w=(0,a.useId)(),x=(0,a.useMemo)(()=>(l/(1024*1024)).toFixed(0),[l]),F=(0,p.formatUILabel)(o.imageUploaderHelp,{formats:g==="image/*"?"JPG, PNG, GIF, WebP":g,maxSize:x}),R=(0,a.useCallback)(async u=>{let m=u.target.files?.[0];if(m){if(!m.type.startsWith("image/")){n(o.imageUploaderNotImage);return}if(m.size>l){n((0,p.formatUILabel)(o.imageUploaderTooLarge,{maxSize:x}));return}k(!0),n(null);try{if(s){let d=await s(m);e(d)}else{let d=await D(m,o.imageUploaderReadError);e(d)}c.current&&(c.current.value="")}catch(d){console.error("Upload error:",d),n(d instanceof Error?d.message:o.imageUploaderUploadError)}finally{k(!1)}}},[l,x,e,s,o]),M=(0,a.useCallback)(()=>{e(""),c.current&&(c.current.value=""),n(null)},[e]),N=(0,a.useCallback)(u=>{e(u),n(null)},[e]),T=(0,a.useCallback)(()=>{c.current?.click()},[]),H=(0,a.useCallback)(u=>{N(u.target.value)},[N]);return(0,r.jsxs)("div",{className:`space-y-2 ${L}`,children:[v&&(0,r.jsx)("label",{className:"block text-sm font-semibold text-gray-700 dark:text-gray-300",children:v}),t&&(0,r.jsxs)("div",{className:"relative w-full overflow-hidden rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800/50",children:[(0,r.jsx)("div",{className:`relative ${A[h]} ${h==="auto"?"max-h-64":""} flex items-center justify-center`,children:(0,r.jsx)("img",{src:t,alt:o.imageUploaderPreview,className:"w-full h-full object-contain"})}),(0,r.jsx)("button",{type:"button",onClick:M,disabled:b,className:"absolute top-2 right-2 bg-red-600 text-white rounded-full w-6 h-6 flex items-center justify-center text-xs hover:bg-red-700 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",title:o.imageUploaderRemove,children:"\xD7"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("input",{ref:c,type:"file","aria-label":o.imageUploaderChoose,accept:g,onChange:R,className:"hidden",disabled:b||y}),(0,r.jsx)("button",{type:"button",onClick:T,disabled:b||y,className:"px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200",children:y?o.imageUploaderUploading:t?o.imageUploaderChangeButton:o.imageUploaderChooseButton})]}),E&&(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("label",{htmlFor:w,className:"block text-xs text-gray-500 dark:text-gray-400",children:o.imageUploaderUrlLabel}),(0,r.jsx)("input",{id:w,type:"url",value:t||"",onChange:H,placeholder:C,disabled:b,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-800 dark:text-gray-200 disabled:opacity-50 disabled:cursor-not-allowed"})]}),I&&(0,r.jsxs)("div",{className:"text-red-700 dark:text-red-400 text-sm bg-red-50 dark:bg-red-900/20 p-2 rounded border border-red-200 dark:border-red-800",children:["\u274C ",I]}),(0,r.jsx)("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:f||F})]})}0&&(module.exports={ImageUploader});
@@ -1 +1 @@
1
- "use client";import{useState as N,useRef as B,useCallback as u,useMemo as G,useId as S}from"react";import{formatUILabel as L,useUILabels as $}from"../../lib/i18n.js";import{jsx as a,jsxs as m}from"react/jsx-runtime";var z={"16/9":"aspect-[16/9]","4/3":"aspect-[4/3]","1/1":"aspect-square",auto:""},A=(o,r)=>new Promise((i,b)=>{let t=new FileReader;t.onload=n=>{let f=n.target?.result;i(f)},t.onerror=()=>{b(new Error(r))},t.readAsDataURL(o)});function W({value:o,onChange:r,onUpload:i,label:b,maxSize:t=5*1024*1024,accept:n="image/*",helpText:f,disabled:p=!1,className:E="",showUrlInput:C=!0,urlPlaceholder:P="https://example.com/image.jpg",labels:F,aspectRatio:U="16/9"}){let e=$(F),h=b??e.imageUploaderLabel,[y,v]=N(!1),[k,s]=N(null),d=B(null),I=S(),x=G(()=>(t/(1024*1024)).toFixed(0),[t]),R=L(e.imageUploaderHelp,{formats:n==="image/*"?"JPG, PNG, GIF, WebP":n,maxSize:x}),M=u(async c=>{let g=c.target.files?.[0];if(g){if(!g.type.startsWith("image/")){s(e.imageUploaderNotImage);return}if(g.size>t){s(L(e.imageUploaderTooLarge,{maxSize:x}));return}v(!0),s(null);try{if(i){let l=await i(g);r(l)}else{let l=await A(g,e.imageUploaderReadError);r(l)}d.current&&(d.current.value="")}catch(l){console.error("Upload error:",l),s(l instanceof Error?l.message:e.imageUploaderUploadError)}finally{v(!1)}}},[t,x,r,i,e]),T=u(()=>{r(""),d.current&&(d.current.value=""),s(null)},[r]),w=u(c=>{r(c),s(null)},[r]),H=u(()=>{d.current?.click()},[]),j=u(c=>{w(c.target.value)},[w]);return m("div",{className:`space-y-2 ${E}`,children:[h&&a("label",{className:"block text-sm font-semibold text-gray-700 dark:text-gray-300",children:h}),o&&m("div",{className:"relative w-full overflow-hidden rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800/50",children:[a("div",{className:`relative ${z[U]} ${U==="auto"?"max-h-64":""} flex items-center justify-center`,children:a("img",{src:o,alt:e.imageUploaderPreview,className:"w-full h-full object-contain"})}),a("button",{type:"button",onClick:T,disabled:p,className:"absolute top-2 right-2 bg-red-500 text-white rounded-full w-6 h-6 flex items-center justify-center text-xs hover:bg-red-600 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",title:e.imageUploaderRemove,children:"\xD7"})]}),m("div",{className:"flex gap-2",children:[a("input",{ref:d,type:"file","aria-label":e.imageUploaderChoose,accept:n,onChange:M,className:"hidden",disabled:p||y}),a("button",{type:"button",onClick:H,disabled:p||y,className:"px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200",children:y?e.imageUploaderUploading:o?e.imageUploaderChangeButton:e.imageUploaderChooseButton})]}),C&&m("div",{className:"space-y-1",children:[a("label",{htmlFor:I,className:"block text-xs text-gray-500 dark:text-gray-400",children:e.imageUploaderUrlLabel}),a("input",{id:I,type:"url",value:o||"",onChange:j,placeholder:P,disabled:p,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-800 dark:text-gray-200 disabled:opacity-50 disabled:cursor-not-allowed"})]}),k&&m("div",{className:"text-red-600 dark:text-red-400 text-sm bg-red-50 dark:bg-red-900/20 p-2 rounded border border-red-200 dark:border-red-800",children:["\u274C ",k]}),a("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:f||R})]})}export{W as ImageUploader};
1
+ "use client";import{useState as N,useRef as B,useCallback as u,useMemo as G,useId as S}from"react";import{formatUILabel as L,useUILabels as $}from"../../lib/i18n.js";import{jsx as a,jsxs as m}from"react/jsx-runtime";var z={"16/9":"aspect-[16/9]","4/3":"aspect-[4/3]","1/1":"aspect-square",auto:""},A=(o,r)=>new Promise((i,b)=>{let t=new FileReader;t.onload=n=>{let f=n.target?.result;i(f)},t.onerror=()=>{b(new Error(r))},t.readAsDataURL(o)});function W({value:o,onChange:r,onUpload:i,label:b,maxSize:t=5*1024*1024,accept:n="image/*",helpText:f,disabled:p=!1,className:E="",showUrlInput:C=!0,urlPlaceholder:P="https://example.com/image.jpg",labels:F,aspectRatio:U="16/9"}){let e=$(F),h=b??e.imageUploaderLabel,[y,v]=N(!1),[k,s]=N(null),d=B(null),I=S(),x=G(()=>(t/(1024*1024)).toFixed(0),[t]),R=L(e.imageUploaderHelp,{formats:n==="image/*"?"JPG, PNG, GIF, WebP":n,maxSize:x}),M=u(async c=>{let g=c.target.files?.[0];if(g){if(!g.type.startsWith("image/")){s(e.imageUploaderNotImage);return}if(g.size>t){s(L(e.imageUploaderTooLarge,{maxSize:x}));return}v(!0),s(null);try{if(i){let l=await i(g);r(l)}else{let l=await A(g,e.imageUploaderReadError);r(l)}d.current&&(d.current.value="")}catch(l){console.error("Upload error:",l),s(l instanceof Error?l.message:e.imageUploaderUploadError)}finally{v(!1)}}},[t,x,r,i,e]),T=u(()=>{r(""),d.current&&(d.current.value=""),s(null)},[r]),w=u(c=>{r(c),s(null)},[r]),H=u(()=>{d.current?.click()},[]),j=u(c=>{w(c.target.value)},[w]);return m("div",{className:`space-y-2 ${E}`,children:[h&&a("label",{className:"block text-sm font-semibold text-gray-700 dark:text-gray-300",children:h}),o&&m("div",{className:"relative w-full overflow-hidden rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800/50",children:[a("div",{className:`relative ${z[U]} ${U==="auto"?"max-h-64":""} flex items-center justify-center`,children:a("img",{src:o,alt:e.imageUploaderPreview,className:"w-full h-full object-contain"})}),a("button",{type:"button",onClick:T,disabled:p,className:"absolute top-2 right-2 bg-red-600 text-white rounded-full w-6 h-6 flex items-center justify-center text-xs hover:bg-red-700 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",title:e.imageUploaderRemove,children:"\xD7"})]}),m("div",{className:"flex gap-2",children:[a("input",{ref:d,type:"file","aria-label":e.imageUploaderChoose,accept:n,onChange:M,className:"hidden",disabled:p||y}),a("button",{type:"button",onClick:H,disabled:p||y,className:"px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200",children:y?e.imageUploaderUploading:o?e.imageUploaderChangeButton:e.imageUploaderChooseButton})]}),C&&m("div",{className:"space-y-1",children:[a("label",{htmlFor:I,className:"block text-xs text-gray-500 dark:text-gray-400",children:e.imageUploaderUrlLabel}),a("input",{id:I,type:"url",value:o||"",onChange:j,placeholder:P,disabled:p,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-800 dark:text-gray-200 disabled:opacity-50 disabled:cursor-not-allowed"})]}),k&&m("div",{className:"text-red-700 dark:text-red-400 text-sm bg-red-50 dark:bg-red-900/20 p-2 rounded border border-red-200 dark:border-red-800",children:["\u274C ",k]}),a("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:f||R})]})}export{W as ImageUploader};
@@ -1 +1 @@
1
- "use strict";var p=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var r in t)p(e,r,{get:t[r],enumerable:!0})},P=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of I(t))!w.call(e,a)&&a!==r&&p(e,a,{get:()=>t[a],enumerable:!(n=y(t,a))||n.enumerable});return e};var z=e=>P(p({},"__esModule",{value:!0}),e);var V={};C(V,{Indicator:()=>x});module.exports=z(V);var i=require("../../lib/cn.cjs"),o=require("react/jsx-runtime"),m={default:"bg-gray-400",primary:"bg-blue-600",success:"bg-green-500",warning:"bg-yellow-400",error:"bg-red-500",info:"bg-cyan-500",dark:"bg-gray-900 dark:bg-gray-700",purple:"bg-purple-600",indigo:"bg-indigo-600",teal:"bg-teal-500"},g={xs:"w-2 h-2",sm:"w-2.5 h-2.5",md:"w-3 h-3",lg:"w-3.5 h-3.5",xl:"w-4 h-4"},N={xs:"min-w-4 h-4 text-[10px] px-1",sm:"min-w-5 h-5 text-xs px-1",md:"min-w-5 h-5 text-xs px-1.5",lg:"min-w-6 h-6 text-sm px-1.5",xl:"min-w-7 h-7 text-sm px-2"},u={"top-left":"top-0 left-0 -translate-x-1/2 -translate-y-1/2","top-center":"top-0 left-1/2 -translate-x-1/2 -translate-y-1/2","top-right":"top-0 right-0 translate-x-1/2 -translate-y-1/2","center-left":"top-1/2 left-0 -translate-x-1/2 -translate-y-1/2",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","center-right":"top-1/2 right-0 translate-x-1/2 -translate-y-1/2","bottom-left":"bottom-0 left-0 -translate-x-1/2 translate-y-1/2","bottom-center":"bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2","bottom-right":"bottom-0 right-0 translate-x-1/2 translate-y-1/2"},f={"top-left":"top-0 left-0","top-center":"top-0 left-1/2 -translate-x-1/2","top-right":"top-0 right-0","center-left":"top-1/2 left-0 -translate-y-1/2",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","center-right":"top-1/2 right-0 -translate-y-1/2","bottom-left":"bottom-0 left-0","bottom-center":"bottom-0 left-1/2 -translate-x-1/2","bottom-right":"bottom-0 right-0"};function R(e,t){return e>t?`${t}+`:`${e}`}function k({color:e="primary",size:t="md",placement:r="top-right",bordered:n=!1,borderColor:a,pulse:s=!1,offset:l=!1,className:c,...d}){return(0,o.jsx)("span",{"data-testid":"indicator",className:(0,i.cn)("absolute z-10 rounded-full",m[e],g[t],l?f[r]:u[r],n&&(0,i.cn)("ring-2 ring-white dark:ring-gray-900",a),s&&"animate-pulse",c),...d})}function v({color:e="error",size:t="md",placement:r="top-right",count:n=0,maxCount:a=99,bordered:s=!1,borderColor:l,pulse:c=!1,offset:d=!1,className:b,...h}){return(0,o.jsx)("span",{"data-testid":"indicator",className:(0,i.cn)("absolute z-10 inline-flex items-center justify-center rounded-full font-semibold text-white",m[e],N[t],d?f[r]:u[r],s&&(0,i.cn)("ring-2 ring-white dark:ring-gray-900",l),c&&"animate-pulse",b),...h,children:R(n,a)})}function S({color:e="success",size:t="md",placement:r="bottom-right",bordered:n=!0,borderColor:a,pulse:s=!1,offset:l=!1,className:c,...d}){return(0,o.jsx)("span",{"data-testid":"indicator",className:(0,i.cn)("absolute z-10 rounded-full",m[e],g[t],l?f[r]:u[r],n&&(0,i.cn)("ring-2 ring-white dark:ring-gray-900",a),s&&"animate-pulse",c),...d})}function O({color:e="primary",size:t="sm",label:r,className:n,...a}){return(0,o.jsxs)("span",{"data-testid":"indicator",className:(0,i.cn)("inline-flex items-center gap-2",n),...a,children:[(0,o.jsx)("span",{className:(0,i.cn)("rounded-full shrink-0",m[e],g[t])}),r?(0,o.jsx)("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:r}):null]})}function x({variant:e="dot",children:t,...r}){if(e==="legend")return(0,o.jsx)(O,{...r});let n=(()=>{switch(e){case"count":return(0,o.jsx)(v,{...r});case"status":return(0,o.jsx)(S,{...r});default:return(0,o.jsx)(k,{...r})}})();return t?(0,o.jsxs)("div",{className:"relative inline-flex",children:[t,n]}):n}x.displayName="Indicator";0&&(module.exports={Indicator});
1
+ "use strict";var g=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var r in t)g(e,r,{get:t[r],enumerable:!0})},P=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of w(t))!I.call(e,n)&&n!==r&&g(e,n,{get:()=>t[n],enumerable:!(a=y(t,n))||a.enumerable});return e};var k=e=>P(g({},"__esModule",{value:!0}),e);var W={};C(W,{Indicator:()=>b});module.exports=k(W);var i=require("../../lib/cn.cjs"),o=require("react/jsx-runtime"),m={default:"bg-gray-400",primary:"bg-blue-600",success:"bg-green-500",warning:"bg-yellow-400",error:"bg-red-500",info:"bg-cyan-500",dark:"bg-gray-900 dark:bg-gray-700",purple:"bg-purple-600",indigo:"bg-indigo-600",teal:"bg-teal-500"},z={default:"bg-gray-500 text-white",primary:"bg-blue-600 text-white",success:"bg-green-700 text-white",warning:"bg-yellow-400 text-gray-900",error:"bg-red-600 text-white",info:"bg-cyan-700 text-white",dark:"bg-gray-900 text-white dark:bg-gray-700",purple:"bg-purple-600 text-white",indigo:"bg-indigo-600 text-white",teal:"bg-teal-700 text-white"},p={xs:"w-2 h-2",sm:"w-2.5 h-2.5",md:"w-3 h-3",lg:"w-3.5 h-3.5",xl:"w-4 h-4"},N={xs:"min-w-4 h-4 text-[10px] px-1",sm:"min-w-5 h-5 text-xs px-1",md:"min-w-5 h-5 text-xs px-1.5",lg:"min-w-6 h-6 text-sm px-1.5",xl:"min-w-7 h-7 text-sm px-2"},u={"top-left":"top-0 left-0 -translate-x-1/2 -translate-y-1/2","top-center":"top-0 left-1/2 -translate-x-1/2 -translate-y-1/2","top-right":"top-0 right-0 translate-x-1/2 -translate-y-1/2","center-left":"top-1/2 left-0 -translate-x-1/2 -translate-y-1/2",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","center-right":"top-1/2 right-0 translate-x-1/2 -translate-y-1/2","bottom-left":"bottom-0 left-0 -translate-x-1/2 translate-y-1/2","bottom-center":"bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2","bottom-right":"bottom-0 right-0 translate-x-1/2 translate-y-1/2"},f={"top-left":"top-0 left-0","top-center":"top-0 left-1/2 -translate-x-1/2","top-right":"top-0 right-0","center-left":"top-1/2 left-0 -translate-y-1/2",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","center-right":"top-1/2 right-0 -translate-y-1/2","bottom-left":"bottom-0 left-0","bottom-center":"bottom-0 left-1/2 -translate-x-1/2","bottom-right":"bottom-0 right-0"};function R(e,t){return e>t?`${t}+`:`${e}`}function v({color:e="primary",size:t="md",placement:r="top-right",bordered:a=!1,borderColor:n,pulse:l=!1,offset:s=!1,className:c,...d}){return(0,o.jsx)("span",{"data-testid":"indicator",className:(0,i.cn)("absolute z-10 rounded-full",m[e],p[t],s?f[r]:u[r],a&&(0,i.cn)("ring-2 ring-white dark:ring-gray-900",n),l&&"animate-pulse",c),...d})}function S({color:e="error",size:t="md",placement:r="top-right",count:a=0,maxCount:n=99,bordered:l=!1,borderColor:s,pulse:c=!1,offset:d=!1,className:x,...h}){return(0,o.jsx)("span",{"data-testid":"indicator",className:(0,i.cn)("absolute z-10 inline-flex items-center justify-center rounded-full font-semibold",z[e],N[t],d?f[r]:u[r],l&&(0,i.cn)("ring-2 ring-white dark:ring-gray-900",s),c&&"animate-pulse",x),...h,children:R(a,n)})}function O({color:e="success",size:t="md",placement:r="bottom-right",bordered:a=!0,borderColor:n,pulse:l=!1,offset:s=!1,className:c,...d}){return(0,o.jsx)("span",{"data-testid":"indicator",className:(0,i.cn)("absolute z-10 rounded-full",m[e],p[t],s?f[r]:u[r],a&&(0,i.cn)("ring-2 ring-white dark:ring-gray-900",n),l&&"animate-pulse",c),...d})}function V({color:e="primary",size:t="sm",label:r,className:a,...n}){return(0,o.jsxs)("span",{"data-testid":"indicator",className:(0,i.cn)("inline-flex items-center gap-2",a),...n,children:[(0,o.jsx)("span",{className:(0,i.cn)("rounded-full shrink-0",m[e],p[t])}),r?(0,o.jsx)("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:r}):null]})}function b({variant:e="dot",children:t,...r}){if(e==="legend")return(0,o.jsx)(V,{...r});let a=(()=>{switch(e){case"count":return(0,o.jsx)(S,{...r});case"status":return(0,o.jsx)(O,{...r});default:return(0,o.jsx)(v,{...r})}})();return t?(0,o.jsxs)("div",{className:"relative inline-flex",children:[t,a]}):a}b.displayName="Indicator";0&&(module.exports={Indicator});
@@ -1 +1 @@
1
- import{cn as o}from"../../lib/cn.js";import{jsx as a,jsxs as f}from"react/jsx-runtime";var m={default:"bg-gray-400",primary:"bg-blue-600",success:"bg-green-500",warning:"bg-yellow-400",error:"bg-red-500",info:"bg-cyan-500",dark:"bg-gray-900 dark:bg-gray-700",purple:"bg-purple-600",indigo:"bg-indigo-600",teal:"bg-teal-500"},p={xs:"w-2 h-2",sm:"w-2.5 h-2.5",md:"w-3 h-3",lg:"w-3.5 h-3.5",xl:"w-4 h-4"},h={xs:"min-w-4 h-4 text-[10px] px-1",sm:"min-w-5 h-5 text-xs px-1",md:"min-w-5 h-5 text-xs px-1.5",lg:"min-w-6 h-6 text-sm px-1.5",xl:"min-w-7 h-7 text-sm px-2"},g={"top-left":"top-0 left-0 -translate-x-1/2 -translate-y-1/2","top-center":"top-0 left-1/2 -translate-x-1/2 -translate-y-1/2","top-right":"top-0 right-0 translate-x-1/2 -translate-y-1/2","center-left":"top-1/2 left-0 -translate-x-1/2 -translate-y-1/2",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","center-right":"top-1/2 right-0 translate-x-1/2 -translate-y-1/2","bottom-left":"bottom-0 left-0 -translate-x-1/2 translate-y-1/2","bottom-center":"bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2","bottom-right":"bottom-0 right-0 translate-x-1/2 translate-y-1/2"},u={"top-left":"top-0 left-0","top-center":"top-0 left-1/2 -translate-x-1/2","top-right":"top-0 right-0","center-left":"top-1/2 left-0 -translate-y-1/2",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","center-right":"top-1/2 right-0 -translate-y-1/2","bottom-left":"bottom-0 left-0","bottom-center":"bottom-0 left-1/2 -translate-x-1/2","bottom-right":"bottom-0 right-0"};function y(e,r){return e>r?`${r}+`:`${e}`}function I({color:e="primary",size:r="md",placement:t="top-right",bordered:n=!1,borderColor:i,pulse:s=!1,offset:l=!1,className:c,...d}){return a("span",{"data-testid":"indicator",className:o("absolute z-10 rounded-full",m[e],p[r],l?u[t]:g[t],n&&o("ring-2 ring-white dark:ring-gray-900",i),s&&"animate-pulse",c),...d})}function w({color:e="error",size:r="md",placement:t="top-right",count:n=0,maxCount:i=99,bordered:s=!1,borderColor:l,pulse:c=!1,offset:d=!1,className:x,...b}){return a("span",{"data-testid":"indicator",className:o("absolute z-10 inline-flex items-center justify-center rounded-full font-semibold text-white",m[e],h[r],d?u[t]:g[t],s&&o("ring-2 ring-white dark:ring-gray-900",l),c&&"animate-pulse",x),...b,children:y(n,i)})}function C({color:e="success",size:r="md",placement:t="bottom-right",bordered:n=!0,borderColor:i,pulse:s=!1,offset:l=!1,className:c,...d}){return a("span",{"data-testid":"indicator",className:o("absolute z-10 rounded-full",m[e],p[r],l?u[t]:g[t],n&&o("ring-2 ring-white dark:ring-gray-900",i),s&&"animate-pulse",c),...d})}function P({color:e="primary",size:r="sm",label:t,className:n,...i}){return f("span",{"data-testid":"indicator",className:o("inline-flex items-center gap-2",n),...i,children:[a("span",{className:o("rounded-full shrink-0",m[e],p[r])}),t?a("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:t}):null]})}function z({variant:e="dot",children:r,...t}){if(e==="legend")return a(P,{...t});let n=(()=>{switch(e){case"count":return a(w,{...t});case"status":return a(C,{...t});default:return a(I,{...t})}})();return r?f("div",{className:"relative inline-flex",children:[r,n]}):n}z.displayName="Indicator";export{z as Indicator};
1
+ import{cn as o}from"../../lib/cn.js";import{jsx as n,jsxs as f}from"react/jsx-runtime";var g={default:"bg-gray-400",primary:"bg-blue-600",success:"bg-green-500",warning:"bg-yellow-400",error:"bg-red-500",info:"bg-cyan-500",dark:"bg-gray-900 dark:bg-gray-700",purple:"bg-purple-600",indigo:"bg-indigo-600",teal:"bg-teal-500"},h={default:"bg-gray-500 text-white",primary:"bg-blue-600 text-white",success:"bg-green-700 text-white",warning:"bg-yellow-400 text-gray-900",error:"bg-red-600 text-white",info:"bg-cyan-700 text-white",dark:"bg-gray-900 text-white dark:bg-gray-700",purple:"bg-purple-600 text-white",indigo:"bg-indigo-600 text-white",teal:"bg-teal-700 text-white"},m={xs:"w-2 h-2",sm:"w-2.5 h-2.5",md:"w-3 h-3",lg:"w-3.5 h-3.5",xl:"w-4 h-4"},y={xs:"min-w-4 h-4 text-[10px] px-1",sm:"min-w-5 h-5 text-xs px-1",md:"min-w-5 h-5 text-xs px-1.5",lg:"min-w-6 h-6 text-sm px-1.5",xl:"min-w-7 h-7 text-sm px-2"},p={"top-left":"top-0 left-0 -translate-x-1/2 -translate-y-1/2","top-center":"top-0 left-1/2 -translate-x-1/2 -translate-y-1/2","top-right":"top-0 right-0 translate-x-1/2 -translate-y-1/2","center-left":"top-1/2 left-0 -translate-x-1/2 -translate-y-1/2",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","center-right":"top-1/2 right-0 translate-x-1/2 -translate-y-1/2","bottom-left":"bottom-0 left-0 -translate-x-1/2 translate-y-1/2","bottom-center":"bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2","bottom-right":"bottom-0 right-0 translate-x-1/2 translate-y-1/2"},u={"top-left":"top-0 left-0","top-center":"top-0 left-1/2 -translate-x-1/2","top-right":"top-0 right-0","center-left":"top-1/2 left-0 -translate-y-1/2",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","center-right":"top-1/2 right-0 -translate-y-1/2","bottom-left":"bottom-0 left-0","bottom-center":"bottom-0 left-1/2 -translate-x-1/2","bottom-right":"bottom-0 right-0"};function w(e,r){return e>r?`${r}+`:`${e}`}function I({color:e="primary",size:r="md",placement:t="top-right",bordered:a=!1,borderColor:i,pulse:l=!1,offset:s=!1,className:c,...d}){return n("span",{"data-testid":"indicator",className:o("absolute z-10 rounded-full",g[e],m[r],s?u[t]:p[t],a&&o("ring-2 ring-white dark:ring-gray-900",i),l&&"animate-pulse",c),...d})}function C({color:e="error",size:r="md",placement:t="top-right",count:a=0,maxCount:i=99,bordered:l=!1,borderColor:s,pulse:c=!1,offset:d=!1,className:b,...x}){return n("span",{"data-testid":"indicator",className:o("absolute z-10 inline-flex items-center justify-center rounded-full font-semibold",h[e],y[r],d?u[t]:p[t],l&&o("ring-2 ring-white dark:ring-gray-900",s),c&&"animate-pulse",b),...x,children:w(a,i)})}function P({color:e="success",size:r="md",placement:t="bottom-right",bordered:a=!0,borderColor:i,pulse:l=!1,offset:s=!1,className:c,...d}){return n("span",{"data-testid":"indicator",className:o("absolute z-10 rounded-full",g[e],m[r],s?u[t]:p[t],a&&o("ring-2 ring-white dark:ring-gray-900",i),l&&"animate-pulse",c),...d})}function k({color:e="primary",size:r="sm",label:t,className:a,...i}){return f("span",{"data-testid":"indicator",className:o("inline-flex items-center gap-2",a),...i,children:[n("span",{className:o("rounded-full shrink-0",g[e],m[r])}),t?n("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:t}):null]})}function z({variant:e="dot",children:r,...t}){if(e==="legend")return n(k,{...t});let a=(()=>{switch(e){case"count":return n(C,{...t});case"status":return n(P,{...t});default:return n(I,{...t})}})();return r?f("div",{className:"relative inline-flex",children:[r,a]}):a}z.displayName="Indicator";export{z as Indicator};
@@ -1 +1 @@
1
- "use strict";var d=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var V=(t,e)=>{for(var l in e)d(t,l,{get:e[l],enumerable:!0})},W=(t,e,l,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of H(e))!M.call(t,r)&&r!==l&&d(t,r,{get:()=>e[r],enumerable:!(o=T(e,r))||o.enumerable});return t};var q=t=>W(d({},"__esModule",{value:!0}),t);var P={};V(P,{Label:()=>m});module.exports=q(P);var s=require("../../lib/cn.cjs"),i=require("../../lib/server-labels.cjs"),a=require("react/jsx-runtime"),v={xs:"text-xs",sm:"text-sm",md:"text-sm",lg:"text-base",xl:"text-lg"},p={xs:"w-3 h-3",sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-4.5 h-4.5",xl:"w-5 h-5"},A={normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},I={default:{default:"text-gray-700 dark:text-gray-200",light:"text-gray-500 dark:text-gray-400",strong:"text-gray-900 dark:text-white"},primary:{default:"text-blue-600 dark:text-blue-400",light:"text-blue-400 dark:text-blue-300",strong:"text-blue-700 dark:text-blue-300"},secondary:{default:"text-purple-600 dark:text-purple-400",light:"text-purple-400 dark:text-purple-300",strong:"text-purple-700 dark:text-purple-300"},success:{default:"text-green-600 dark:text-green-400",light:"text-green-400 dark:text-green-300",strong:"text-green-700 dark:text-green-300"},warning:{default:"text-yellow-600 dark:text-yellow-400",light:"text-yellow-400 dark:text-yellow-300",strong:"text-yellow-700 dark:text-yellow-300"},error:{default:"text-red-600 dark:text-red-400",light:"text-red-400 dark:text-red-300",strong:"text-red-700 dark:text-red-300"},info:{default:"text-cyan-600 dark:text-cyan-400",light:"text-cyan-400 dark:text-cyan-300",strong:"text-cyan-700 dark:text-cyan-300"},muted:{default:"text-gray-500 dark:text-gray-400",light:"text-gray-400 dark:text-gray-500",strong:"text-gray-600 dark:text-gray-300"}};function m({children:t,size:e="md",color:l="default",variant:o="default",weight:r="medium",textColor:b,required:n=!1,requiredIndicator:u="*",requiredLabel:y=i.serverUILabels.labelRequired,optional:f=!1,optionalText:k=i.serverUILabels.labelOptional,tooltip:h,icon:x,endIcon:g,disabled:c=!1,truncate:L=!1,as:w="label",className:C,...N}){let R=w,S=(0,s.cn)("inline-flex items-center gap-1.5 transition-colors",v[e],A[r]),z=b||I[l][o];return(0,a.jsxs)(R,{className:(0,s.cn)(S,z,c?"opacity-50 cursor-not-allowed":"cursor-default",C),title:h,"aria-disabled":c,...N,children:[x&&(0,a.jsx)("span",{className:(0,s.cn)("shrink-0",p[e]),children:x}),(0,a.jsxs)("span",{className:(0,s.cn)(L&&"truncate"),children:[t,n&&(0,a.jsx)("span",{className:"text-red-500 ml-0.5","aria-hidden":"true",children:u}),n&&(0,a.jsx)("span",{className:"sr-only",children:y})]}),f&&!n&&(0,a.jsx)("span",{className:"text-gray-400 dark:text-gray-500 font-normal",children:k}),g&&(0,a.jsx)("span",{className:(0,s.cn)("shrink-0",p[e]),children:g})]})}m.displayName="Label";0&&(module.exports={Label});
1
+ "use strict";var d=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var V=(t,e)=>{for(var l in e)d(t,l,{get:e[l],enumerable:!0})},W=(t,e,l,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of H(e))!M.call(t,r)&&r!==l&&d(t,r,{get:()=>e[r],enumerable:!(o=T(e,r))||o.enumerable});return t};var q=t=>W(d({},"__esModule",{value:!0}),t);var P={};V(P,{Label:()=>m});module.exports=q(P);var s=require("../../lib/cn.cjs"),i=require("../../lib/server-labels.cjs"),a=require("react/jsx-runtime"),v={xs:"text-xs",sm:"text-sm",md:"text-sm",lg:"text-base",xl:"text-lg"},p={xs:"w-3 h-3",sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-4.5 h-4.5",xl:"w-5 h-5"},A={normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},I={default:{default:"text-gray-700 dark:text-gray-200",light:"text-gray-500 dark:text-gray-400",strong:"text-gray-900 dark:text-white"},primary:{default:"text-blue-600 dark:text-blue-400",light:"text-blue-600 dark:text-blue-300",strong:"text-blue-700 dark:text-blue-300"},secondary:{default:"text-purple-600 dark:text-purple-400",light:"text-purple-600 dark:text-purple-300",strong:"text-purple-700 dark:text-purple-300"},success:{default:"text-green-700 dark:text-green-400",light:"text-green-700 dark:text-green-300",strong:"text-green-800 dark:text-green-300"},warning:{default:"text-yellow-700 dark:text-yellow-400",light:"text-yellow-700 dark:text-yellow-300",strong:"text-yellow-800 dark:text-yellow-300"},error:{default:"text-red-600 dark:text-red-400",light:"text-red-600 dark:text-red-300",strong:"text-red-700 dark:text-red-300"},info:{default:"text-cyan-700 dark:text-cyan-400",light:"text-cyan-700 dark:text-cyan-300",strong:"text-cyan-800 dark:text-cyan-300"},muted:{default:"text-gray-500 dark:text-gray-400",light:"text-gray-400 dark:text-gray-500",strong:"text-gray-600 dark:text-gray-300"}};function m({children:t,size:e="md",color:l="default",variant:o="default",weight:r="medium",textColor:b,required:n=!1,requiredIndicator:u="*",requiredLabel:y=i.serverUILabels.labelRequired,optional:f=!1,optionalText:k=i.serverUILabels.labelOptional,tooltip:h,icon:x,endIcon:g,disabled:c=!1,truncate:L=!1,as:w="label",className:C,...N}){let R=w,S=(0,s.cn)("inline-flex items-center gap-1.5 transition-colors",v[e],A[r]),z=b||I[l][o];return(0,a.jsxs)(R,{className:(0,s.cn)(S,z,c?"opacity-50 cursor-not-allowed":"cursor-default",C),title:h,"aria-disabled":c,...N,children:[x&&(0,a.jsx)("span",{className:(0,s.cn)("shrink-0",p[e]),children:x}),(0,a.jsxs)("span",{className:(0,s.cn)(L&&"truncate"),children:[t,n&&(0,a.jsx)("span",{className:"text-red-600 dark:text-red-400 ml-0.5","aria-hidden":"true",children:u}),n&&(0,a.jsx)("span",{className:"sr-only",children:y})]}),f&&!n&&(0,a.jsx)("span",{className:"text-gray-400 dark:text-gray-500 font-normal",children:k}),g&&(0,a.jsx)("span",{className:(0,s.cn)("shrink-0",p[e]),children:g})]})}m.displayName="Label";0&&(module.exports={Label});