cortex-react-components 2.24.0 → 2.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/dist/{chunk-SDKKYDWS.mjs → chunk-24NYAA5I.mjs} +1 -1
  2. package/dist/chunk-2HKAJ4TZ.mjs +4 -0
  3. package/dist/{chunk-LBUC4M6L.mjs → chunk-3GDFYE6T.mjs} +1 -1
  4. package/dist/chunk-3V4WLGEY.mjs +4 -0
  5. package/dist/{chunk-PK3OBSCB.mjs → chunk-436WKDWG.mjs} +1 -1
  6. package/dist/{chunk-WYR2HJ75.mjs → chunk-4HXYNCOU.mjs} +1 -1
  7. package/dist/{chunk-I2GNNRFH.mjs → chunk-6T4OEOJH.mjs} +1 -1
  8. package/dist/chunk-6UDBIRMT.mjs +1 -0
  9. package/dist/{chunk-YKG4FNS4.mjs → chunk-DUEPJ3F4.mjs} +1 -1
  10. package/dist/{chunk-M7ZG6HLI.mjs → chunk-DY2G774J.mjs} +1 -1
  11. package/dist/{chunk-MXCW6SOT.mjs → chunk-EVZSRWUW.mjs} +1 -1
  12. package/dist/{chunk-LJQPLE4S.mjs → chunk-G6ED5Z4J.mjs} +1 -1
  13. package/dist/{chunk-255P6K5W.mjs → chunk-HH3AWPYB.mjs} +1 -1
  14. package/dist/{chunk-GPFPTU7U.mjs → chunk-INBT5E6T.mjs} +1 -1
  15. package/dist/{chunk-5SHZBJ5R.mjs → chunk-IQ3TUH7O.mjs} +1 -1
  16. package/dist/{chunk-N3B3XNV3.mjs → chunk-IUT6JJHY.mjs} +1 -1
  17. package/dist/{chunk-FKU4VQR6.mjs → chunk-KJMXSFJA.mjs} +1 -1
  18. package/dist/{chunk-HKGW6JI2.mjs → chunk-M4NJB4NN.mjs} +1 -1
  19. package/dist/{chunk-NWISIJFD.mjs → chunk-NIRR5B5C.mjs} +1 -1
  20. package/dist/chunk-P5LSKHQC.mjs +9 -0
  21. package/dist/{chunk-JOG27B7P.mjs → chunk-PDAMYUP7.mjs} +1 -1
  22. package/dist/{chunk-ERJXTG6X.mjs → chunk-PLTKMHUH.mjs} +1 -1
  23. package/dist/{chunk-XDW3TPGL.mjs → chunk-PZCH3GAL.mjs} +1 -1
  24. package/dist/{chunk-7GMAMIHM.mjs → chunk-QDAJ7QAD.mjs} +1 -1
  25. package/dist/{chunk-6DDMDQLX.mjs → chunk-RSYHYNWR.mjs} +1 -1
  26. package/dist/{chunk-H3CJOE6S.mjs → chunk-S562PA5P.mjs} +1 -1
  27. package/dist/{chunk-5WVFEIMC.mjs → chunk-V63JJVJX.mjs} +1 -1
  28. package/dist/{chunk-67QPOSVV.mjs → chunk-VKJ7E6OL.mjs} +1 -1
  29. package/dist/{chunk-GCIEF545.mjs → chunk-XDELWNND.mjs} +1 -1
  30. package/dist/{chunk-M7NV6EFH.mjs → chunk-XI5H6WLY.mjs} +1 -1
  31. package/dist/{chunk-IF3425JX.mjs → chunk-XREAMNVX.mjs} +1 -1
  32. package/dist/chunk-YSAWXOPE.mjs +1 -0
  33. package/dist/{chunk-2RQDJ5XT.mjs → chunk-Z3NOT3QB.mjs} +1 -1
  34. package/dist/{chunk-XKGBG5FX.mjs → chunk-ZJZ2UMK2.mjs} +1 -1
  35. package/dist/components/Blocks/Banner.mjs +1 -1
  36. package/dist/components/Blocks/CallToAction.mjs +1 -1
  37. package/dist/components/Blocks/CollapsibleArea.mjs +1 -1
  38. package/dist/components/Blocks/Content.mjs +1 -1
  39. package/dist/components/Blocks/FeaturesBlock.mjs +1 -1
  40. package/dist/components/Blocks/RelatedPosts.mjs +1 -1
  41. package/dist/components/Blocks/RenderBlocks.mjs +1 -1
  42. package/dist/components/Blocks/ReusableContentBlock.mjs +1 -1
  43. package/dist/components/Blocks/index.mjs +1 -1
  44. package/dist/components/Cards/ContentCard.mjs +1 -1
  45. package/dist/components/Cards/FeatureCard.mjs +1 -1
  46. package/dist/components/Cards/index.mjs +1 -1
  47. package/dist/components/DigitalColleagues/MainPage.mjs +1 -1
  48. package/dist/components/DigitalColleagues/Pages/dashboardpage.js +4 -4
  49. package/dist/components/DigitalColleagues/Pages/dashboardpage.mjs +1 -1
  50. package/dist/components/DigitalColleagues/Views/index.js +4 -4
  51. package/dist/components/DigitalColleagues/Views/index.mjs +1 -1
  52. package/dist/components/DigitalColleagues/index.js +4 -4
  53. package/dist/components/DigitalColleagues/index.mjs +1 -1
  54. package/dist/components/Foundary/MainPage.mjs +1 -1
  55. package/dist/components/Foundary/Pages/dashboardpage.js +5 -5
  56. package/dist/components/Foundary/Pages/dashboardpage.mjs +1 -1
  57. package/dist/components/Foundary/Views/ColleaguesView.mjs +1 -1
  58. package/dist/components/Foundary/Views/index.js +5 -5
  59. package/dist/components/Foundary/Views/index.mjs +1 -1
  60. package/dist/components/Foundary/file-edit.js +3 -3
  61. package/dist/components/Foundary/file-edit.mjs +1 -1
  62. package/dist/components/Foundary/index.js +4 -4
  63. package/dist/components/Foundary/index.mjs +1 -1
  64. package/dist/components/Foundary/types.d.ts +1 -0
  65. package/dist/components/HeaderFooter/SectionHeading.mjs +1 -1
  66. package/dist/components/HeaderFooter/VideoHeader.mjs +1 -1
  67. package/dist/components/HeaderFooter/index.mjs +1 -1
  68. package/dist/components/Heros/HighImpact/index.mjs +1 -1
  69. package/dist/components/Heros/LowImpact/index.mjs +1 -1
  70. package/dist/components/Heros/MediumImpact/index.mjs +1 -1
  71. package/dist/components/Heros/RenderHero.mjs +1 -1
  72. package/dist/components/Heros/SectionHero/index.mjs +1 -1
  73. package/dist/components/Heros/index.mjs +1 -1
  74. package/dist/components/Holidays/HolidayTracker.js +1 -1
  75. package/dist/components/Holidays/HolidayTracker.mjs +1 -1
  76. package/dist/components/Holidays/RequestLeave.js +1 -1
  77. package/dist/components/Holidays/RequestLeave.mjs +1 -1
  78. package/dist/components/Holidays/index.js +1 -1
  79. package/dist/components/Holidays/index.mjs +1 -1
  80. package/dist/components/Layouts/OutputHeaderFooter.mjs +1 -1
  81. package/dist/components/Layouts/Print.mjs +1 -1
  82. package/dist/components/Layouts/SlideShow.mjs +1 -1
  83. package/dist/components/Layouts/index.mjs +1 -1
  84. package/dist/components/Other/index.mjs +1 -1
  85. package/dist/components/Payload/RichText/index.mjs +1 -1
  86. package/dist/components/Payload/RichText/serialize.mjs +1 -1
  87. package/dist/components/Payload/index.mjs +1 -1
  88. package/dist/components/Projects/FileView.js +4 -4
  89. package/dist/components/Projects/FileView.mjs +1 -1
  90. package/dist/components/Projects/KanbanBoardView.d.ts +3 -0
  91. package/dist/components/Projects/KanbanBoardView.js +6 -1
  92. package/dist/components/Projects/KanbanBoardView.mjs +1 -1
  93. package/dist/components/Projects/ProjectPage.js +4 -4
  94. package/dist/components/Projects/ProjectPage.mjs +1 -1
  95. package/dist/components/Projects/ProjectView.js +4 -4
  96. package/dist/components/Projects/ProjectView.mjs +1 -1
  97. package/dist/components/Projects/ProjectsIndexView.mjs +1 -1
  98. package/dist/components/Projects/TaskDetailsModal.d.ts +3 -0
  99. package/dist/components/Projects/TaskDetailsModal.js +6 -1
  100. package/dist/components/Projects/TaskDetailsModal.mjs +1 -1
  101. package/dist/components/Projects/file-list.d.ts +3 -1
  102. package/dist/components/Projects/file-list.js +4 -4
  103. package/dist/components/Projects/file-list.mjs +1 -1
  104. package/dist/components/Projects/index.js +6 -1
  105. package/dist/components/Projects/index.mjs +1 -1
  106. package/dist/components/dc-temp/index.js +5 -5
  107. package/dist/components/dc-temp/index.mjs +1 -1
  108. package/dist/components/index.js +23 -23
  109. package/dist/components/index.mjs +1 -1
  110. package/dist/globals.css +1 -1
  111. package/dist/index.js +33 -33
  112. package/dist/index.mjs +1 -1
  113. package/dist/metafile-cjs.json +1 -1
  114. package/dist/metafile-esm.json +1 -1
  115. package/dist/pages/Blog.mjs +1 -1
  116. package/dist/pages/Documentation.mjs +1 -1
  117. package/dist/pages/IndexPage.mjs +1 -1
  118. package/dist/pages/Intranet.mjs +1 -1
  119. package/dist/pages/LandingPage.mjs +1 -1
  120. package/dist/pages/Page.mjs +1 -1
  121. package/dist/pages/Publish.mjs +1 -1
  122. package/dist/pages/Website.mjs +1 -1
  123. package/dist/sections/AboutSection.mjs +1 -1
  124. package/dist/sections/BlogDetail.mjs +1 -1
  125. package/dist/sections/BlogList.mjs +1 -1
  126. package/dist/sections/ContactSection.mjs +1 -1
  127. package/dist/sections/PageSections.mjs +1 -1
  128. package/dist/sections/PricingSection.mjs +1 -1
  129. package/dist/sections/ServiceDetail.mjs +1 -1
  130. package/dist/sections/ServiceDetailSection.mjs +1 -1
  131. package/dist/sections/ServiceSection.mjs +1 -1
  132. package/dist/sections/index.mjs +1 -1
  133. package/package.json +1 -1
  134. package/dist/chunk-ICFBQXVC.mjs +0 -4
  135. package/dist/chunk-M7KIL6AS.mjs +0 -9
  136. package/dist/chunk-MAAKU7PN.mjs +0 -4
  137. package/dist/chunk-RQLUMNJE.mjs +0 -1
  138. package/dist/chunk-UM57PWI7.mjs +0 -1
@@ -1,9 +0,0 @@
1
- "use client";
2
- "use strict";
3
-
4
- import{a as S}from"./chunk-VTFO5GXK.mjs";import{a as F}from"./chunk-DFIXTV2M.mjs";import{a as k}from"./chunk-B4H6T2GP.mjs";import{b}from"./chunk-ZUA4KNIR.mjs";import{motion as E}from"motion/react";import{File as $,FileText as I,Type as L,Loader2 as D,X as K,Save as M}from"lucide-react";import{useEffect as _,useRef as B,useState as w}from"react";import{Fragment as j,jsx as c,jsxs as y}from"react/jsx-runtime";var T=n=>"mimeType"in n&&"url"in n&&!("format"in n),P=n=>{if(!n?.root?.children)return"";let l=[],i=t=>{if(!t)return"";switch(t.type){case"heading":{let e=t.tag?parseInt(t.tag.replace("h","")):1,r=s(t.children||[]);return"#".repeat(e)+" "+r}case"paragraph":return s(t.children||[]);case"list":{let e=[],r=t.listType==="number"?"1.":"-";return t.children?.forEach((d,a)=>{if(d.type==="listitem"){let m=s(d.children||[]),p=t.listType==="number"?`${a+1}.`:r;e.push(`${p} ${m}`)}}),e.join(`
5
- `)}case"listitem":return s(t.children||[]);case"text":{let e=t.text||"";if(t.format){let r=(t.format&1)!==0,d=(t.format&2)!==0,a=(t.format&4)!==0,m=(t.format&8)!==0;(t.format&16)!==0?e=`\`${e}\``:(r&&(e=`**${e}**`),d&&(e=`*${e}*`),a&&(e=`~~${e}~~`),m&&(e=`<u>${e}</u>`))}return e}default:return t.children?s(t.children):""}},s=t=>t.map(e=>{if(e.type==="text"){let r=e.text||"";if(e.format){let d=(e.format&1)!==0,a=(e.format&2)!==0,m=(e.format&4)!==0,p=(e.format&8)!==0;(e.format&16)!==0?r=`\`${r}\``:(d&&(r=`**${r}**`),a&&(r=`*${r}*`),m&&(r=`~~${r}~~`),p&&(r=`<u>${r}</u>`))}return r}else{if(e.type==="paragraph")return s(e.children||[]);if(e.type==="listitem")return s(e.children||[]);if(e.type==="linebreak")return`
6
- `}return i(e)}).filter(Boolean).join("");return n.root.children.forEach(t=>{let e=i(t);e&&l.push(e)}),l.join(`
7
-
8
- `)},v=n=>{let l=[],i=0;for(;i<n.length;){let t=n.slice(i).match(/^<u\s*[^>]*>([\s\S]*?)<\/u>/i);if(t&&t[0]){let o=t[1]||"",f=o?v(o):[];f.length>0?(f.forEach(h=>{h.type==="text"&&(h.format=(h.format||0)|8)}),l.push(...f)):o===""&&l.push({type:"text",text:"",format:8}),i+=t[0].length;continue}if(n.slice(i).startsWith("</u>")){i+=4;continue}let e=n.slice(i).match(/^(`+)([^`]+)\1/);if(e){let o=e[2];o&&l.push({type:"text",text:o,format:16}),i+=e[0].length;continue}let r=n.slice(i).match(/^(~~)(.+?)\1/);if(r){let o=r[2],f=v(o);f.forEach(h=>{h.type==="text"&&(h.format=(h.format||0)|4)}),l.push(...f),i+=r[0].length;continue}let d=n.slice(i).match(/^(\*\*|__)(.+?)\1/);if(d){let o=d[2],f=v(o);f.forEach(h=>{h.type==="text"&&(h.format=(h.format||0)|1)}),l.push(...f),i+=d[0].length;continue}let a=n.slice(i).match(/^(\*|_)([^*_\n]+?)\1(?!\*|_)/);if(a&&a[0].length>2){let o=a[2],f=v(o);f.forEach(h=>{h.type==="text"&&(h.format=(h.format||0)|2)}),l.push(...f),i+=a[0].length;continue}let m=n.length,p=[{pattern:/<u>/i,offset:0},{pattern:/\*\*/,offset:0},{pattern:/__/,offset:0},{pattern:/~~/,offset:0},{pattern:/`+/,offset:0},{pattern:/\*[^*\n]/,offset:0},{pattern:/_[^_\n]/,offset:0}];for(let{pattern:o}of p){let f=n.slice(i+1).search(o);f!==-1&&f+1<m-i&&(m=i+f+1)}let g=n.slice(i,m);g&&l.push({type:"text",text:g,format:0}),i=m}let s=[];for(let t of l)s.length>0&&s[s.length-1].type==="text"&&s[s.length-1].format===t.format?s[s.length-1].text+=t.text:s.push(t);return s.length>0?s:[{type:"text",text:"",format:0}]},U=n=>{let l=n.split(`
9
- `),i=[],s=[],t=[],e=()=>{if(s.length>0){let d=s.join(" "),a=v(d);i.push({type:"paragraph",children:a.length>0?a:[{type:"text",text:"",format:0}]}),s=[]}},r=()=>{t.length>0&&(i.push({type:"list",listType:"bullet",children:t}),t=[])};for(let d of l){let a=d.trim();if(!a){e(),r();continue}let m=a.match(/^(#{1,6})\s+(.+)$/);if(m){e(),r();let g=m[1].length,o=m[2],f=v(o);i.push({type:"heading",tag:`h${g}`,children:f.length>0?f:[{type:"text",text:"",format:0}]});continue}let p=a.match(/^[-*+]\s+(.+)$/);if(p){e();let g=p[1],o=v(g);t.push({type:"listitem",children:[{type:"paragraph",children:o.length>0?o:[{type:"text",text:"",format:0}]}]});continue}t.length>0&&r(),s.push(a)}return e(),r(),i.length===0&&i.push({type:"paragraph",children:[{type:"text",text:"",format:0}]}),{root:{type:"root",children:i,direction:"ltr",format:"",indent:0,version:1}}},R=async n=>{let l="",i,s="text";if(n.url)try{let t=n.url;!t.startsWith("http://")&&!t.startsWith("https://")&&!t.startsWith("/")&&(t="/"+t),console.log("Fetching file content from URL:",t);let e=await fetch(t);e.ok?(l=await e.text(),console.log("Successfully loaded content, length:",l.length)):console.error("Failed to fetch file content:",e.status,e.statusText)}catch(t){throw console.error("Failed to fetch file content:",t),t}else console.warn("No URL provided for file:",n.name);return n.mimeType==="text/markdown"?(s="richText",console.log("Converting markdown to Lexical, content length:",l.length),i=U(l),console.log("Converted Lexical JSON:",JSON.stringify(i,null,2))):n.mimeType?.startsWith("text/")&&(s="text"),{id:n.id.toString(),title:n.name,description:void 0,content:s==="richText"?void 0:l,richTextContent:s==="richText"?i:void 0,format:s,metadata:{},createdAt:typeof n.createdAt=="string"?new Date(n.createdAt):n.createdAt,updatedAt:new Date}};function G({document:n,onCancel:l,onSave:i,onFileUpdate:s}){let[t,e]=w(T(n)),[r,d]=w(T(n)?{id:n.id.toString(),title:n.name,description:void 0,content:"",format:"text",metadata:{},createdAt:typeof n.createdAt=="string"?new Date(n.createdAt):n.createdAt,updatedAt:new Date}:{...n,updatedAt:new Date}),[a,m]=w(T(n)?void 0:r.richTextContent),[p,g]=w(!1),o=B(T(n)?n:null);_(()=>{T(n)?(e(!0),R(n).then(u=>{console.log("Loaded content:",u),d(u),m(u.richTextContent),e(!1)}).catch(u=>{console.error("Failed to convert file:",u),e(!1)})):(d({...n,updatedAt:new Date}),m(n.richTextContent))},[n]);let f=u=>{switch(u){case"markdown":case"mdx":return c(I,{className:"h-6 w-6 text-primary"});case"richText":return c($,{className:"h-6 w-6 text-success"});case"text":return c(L,{className:"h-6 w-6 text-muted-foreground"});default:return c($,{className:"h-6 w-6 text-muted-foreground"})}},h=u=>{switch(u){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},A=async()=>{g(!0);try{let u,x;if(o.current&&o.current.mimeType==="text/markdown"){let C=a?P(a):"";u={...r,format:"markdown",content:C,richTextContent:void 0},x=C}else u={...r,richTextContent:a},x=r.content||"";let N=o.current?o.current.id.toString():r.id;await Promise.resolve(i()),s?.(N,x)}finally{g(!1)}};return y(E.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-screen flex flex-col",children:[c("div",{className:"border-b border-border bg-card p-8 pb-6",children:y("div",{className:"flex items-start justify-between gap-4 mb-4",children:[c("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:c("div",{className:"flex-1 min-w-0",children:y("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[c("div",{className:"flex-1 min-w-0",children:c(F,{fieldName:"title",value:r.title,label:"",onSave:(u,x)=>d(N=>({...N,title:x})),className:"[&>div:last-child]:text-2xl [&>div:last-child]:font-bold [&>div:last-child]:leading-tight [&>div:last-child]:text-foreground [&>div:last-child]:p-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})}),c("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${h(r.format)} flex-shrink-0 mt-1`,children:r.format.toUpperCase()})]})})}),y("div",{className:"flex items-center gap-2 flex-shrink-0",children:[y(b,{variant:"outline",size:"sm",onClick:l,className:"gap-2",children:[c(K,{className:"h-4 w-4"}),"Close"]}),y(b,{size:"sm",onClick:A,className:"gap-2",disabled:p,children:[p?c(D,{className:"h-4 w-4 animate-spin"}):c(M,{className:"h-4 w-4"}),p?"Saving...":"Save"]})]})]})}),c("div",{className:"flex-1 overflow-hidden",children:c("div",{className:"p-8 pt-0 h-full max-h-full overflow-auto",children:t?c("div",{className:"flex items-center justify-center h-full",children:y("div",{className:"flex flex-col items-center gap-4",children:[c(D,{className:"h-8 w-8 animate-spin text-primary"}),c("p",{className:"text-sm text-muted-foreground",children:"Loading file content..."})]})}):c(j,{children:r.format==="richText"?c(S,{setValue:m,value:a,name:"richTextContent"},`richtext-${r.id}-${t?"loading":"loaded"}`):c(k,{value:r.content||"",onChange:u=>d(x=>({...x,content:u.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})})})})]})}export{G as a};
@@ -1,4 +0,0 @@
1
- "use client";
2
- "use strict";
3
-
4
- import{b as F,c as L}from"./chunk-PC6TVU7J.mjs";import{a as b,b as h,d as P}from"./chunk-JHNVX4UB.mjs";import{a as x}from"./chunk-7BXIU4ZM.mjs";import{a as f}from"./chunk-TVZOULLL.mjs";import{b as c}from"./chunk-ZUA4KNIR.mjs";import{a as D}from"./chunk-MDJREBVI.mjs";import{useState as m,useEffect as w}from"react";import{format as C}from"date-fns";import{CalendarIcon as T}from"lucide-react";import{useRouter as E}from"next/navigation";import{Toaster as k,toast as v}from"sonner";import{jsx as e,jsxs as o}from"react/jsx-runtime";var I=({options:r,value:l,onChange:a,disabled:n=[]})=>e("div",{className:"flex space-x-2",children:r.map((t,i)=>e(c,{type:"button",variant:l===t?"default":"outline",onClick:()=>a(t),disabled:n[i],className:"flex-1 hover:bg-accent hover:text-accent-foreground",children:t},t))});function V({remainingDays:r,submitLeaveRequest:l}){let[a,n]=m(new Date),[t,i]=m(new Date),[d,g]=m("Full Day"),[N,R]=m(!1),[p,S]=m(1),B=E();w(()=>{let s=L(a,t);R(s),s&&g("Full Day")},[a,t]),w(()=>{if(!a||!t){S(0);return}let s=F(a,t,d!=="Full Day");S(s)},[a,t,d]);let q=s=>{g(s)};return o("div",{className:"max-w-2xl",children:[e("h2",{className:"text-lg font-semibold mb-4",children:"Request Leave"}),o("p",{className:"text-sm text-gray-500 mb-4",children:["Remaining leave days: ",r]}),o("form",{onSubmit:async s=>{if(s.preventDefault(),!a||!t){v.error("Please select both start and end dates");return}if(p>r){v.error("You do not have enough leave days remaining");return}let u=new FormData;u.append("startDate",a.toISOString()),u.append("endDate",t.toISOString()),u.append("leaveType",d),u.append("duration",p.toString());let y=await(l||M)(u);y.success?(v.success(y.message),n(void 0),i(void 0),g("Full Day"),B.refresh()):v.error(`Error: ${y.message}`)},className:"space-y-4",children:[o("div",{className:"grid grid-cols-2 gap-4",children:[o("div",{className:"flex flex-col space-y-2",children:[e(f,{htmlFor:"startDate",children:"Start Date"}),o(b,{children:[e(h,{asChild:!0,children:o(c,{variant:"outline",className:D("w-full justify-start text-left font-normal",!a&&"text-muted-foreground"),children:[e(T,{className:"mr-2 h-4 w-4"}),a?C(a,"PPP"):e("span",{children:"Pick a date"})]})}),e(P,{className:"w-auto p-0",align:"start",children:e(x,{mode:"single",selected:a,onSelect:s=>{n(s),s&&(!t||s>t)&&i(s)},initialFocus:!0})})]})]}),o("div",{className:"flex flex-col space-y-2",children:[e(f,{htmlFor:"endDate",children:"End Date"}),o(b,{children:[e(h,{asChild:!0,children:o(c,{variant:"outline",className:D("w-full justify-start text-left font-normal",!t&&"text-muted-foreground"),children:[e(T,{className:"mr-2 h-4 w-4"}),t?C(t,"PPP"):e("span",{children:"Pick a date"})]})}),e(P,{className:"w-auto p-0",align:"start",children:e(x,{mode:"single",selected:t,onSelect:i,disabled:s=>a?s<a:!1,initialFocus:!0})})]})]})]}),o("div",{className:"space-y-2",children:[e(f,{children:"Leave Type"}),e(I,{options:["Full Day","Morning","Afternoon"],value:d,onChange:q,disabled:[!1,N,N]})]}),o("p",{className:"text-sm text-gray-500",children:["Total days: ",p]}),e(c,{disabled:p<=0,type:"submit",className:"w-full hover:bg-accent hover:text-accent-foreground",children:"Submit Request"})]}),e(k,{richColors:!0,position:"top-right",closeButton:!0,visibleToasts:9,className:"z-50"})]})}var M=async r=>{let l={};return r.forEach((a,n)=>{l[n]=a}),{success:!0,message:`Leave request submitted successfully for ${r.get("duration")}`}};export{V as a};
@@ -1 +0,0 @@
1
- import{a as J}from"./chunk-UM57PWI7.mjs";import{a as b}from"./chunk-KG7HG2VO.mjs";import{a as q}from"./chunk-KZCIHFTM.mjs";import{a as Q}from"./chunk-L3V5YDPH.mjs";import{a as G}from"./chunk-QC2UWZWL.mjs";import{a as V}from"./chunk-Z22NSJMF.mjs";import{a as w}from"./chunk-UVHMI3PU.mjs";import{b as F}from"./chunk-CSBGSBEU.mjs";import fe,{useEffect as c,useState as i,useRef as l}from"react";import{jsx as n,jsxs as T}from"react/jsx-runtime";var ye=({initialTasks:m=[],initialEpics:v=[],initialSprints:h=[],initialUsers:ke=[],initialColleagues:A=[],initialProjects:Te=[],onAddTask:W,onUpdateTask:C,onDeleteTask:x,onTaskClick:X,onAddEpic:Y,onAddComment:Z})=>{let[_,p]=i([]),[d,y]=i([]),[O,ee]=i([]),[H,N]=i(!1),[P,M]=i(!1),[r,u]=i(null),[E,B]=i(null),[te,ve]=i([]),[I,se]=i([]),[g,R]=i(0),o=l(null),ae=l(null),ne=fe.useMemo(()=>[...d.map(e=>e.id),0],[d]),U=l(""),j=l(""),$=l(""),K=l(""),f=e=>e.map(t=>`${t.id}-${new Date(t.createdAt).getTime()}-${new Date(t.updatedAt).getTime()}`).join("-");c(()=>{let e=f(m);e!==U.current&&(p(m),r&&u(m.find(t=>t.id===r.id)||null),U.current=e)},[m]),c(()=>{let e=f(v);e!==j.current&&(y(v),j.current=e)},[v]),c(()=>{let e=f(h);e!==$.current&&(ee(h),$.current=e)},[h]),c(()=>{let e=f(A.map(t=>({id:t.id,updatedAt:t.updatedAt,createdAt:t.createdAt})));e!==K.current&&(se(A),K.current=e)},[A]),c(()=>{let e=()=>{if(o.current){let a=o.current.offsetHeight;R(a)}};e();let t=new ResizeObserver(e);o.current&&t.observe(o.current);let s=()=>{setTimeout(e,100)};return window.addEventListener("storage",s),()=>{t.disconnect(),window.removeEventListener("storage",s)}},[]),c(()=>{let e=setTimeout(()=>{o.current&&R(o.current.offsetHeight)},300);return()=>clearTimeout(e)},[H,P]);let ie=_.filter(e=>!0),re=e=>ie.filter(t=>t.status===e),oe=e=>{let t={};return d.forEach(s=>{t[s.id]=e.filter(a=>w(a.epic)===s.id)}),t["no-epic"]=e.filter(s=>!w(s.epic)),t},L=e=>{B(e)},de=e=>{E&&(p(t=>t.map(s=>s.id===E.id?{...s,status:e}:s)),C?.(E.id.toString(),{status:e}),B(null))},ce=e=>{let t={...e,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};p(s=>[...s,t]),W?.(e)},le=async(e,t)=>{p(s=>s.map(a=>a.id===Number(e)?{...a,...t}:a)),C&&await C(e,t),r?.id===Number(e)&&u(s=>({...s,...t}))},pe=async e=>{p(t=>t.filter(s=>s.id!==Number(e))),r?.id===Number(e)&&u(null),x&&await x(e)},ue=e=>{let t={...e,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};y(s=>[...s,t]),Y?.(e)},z=e=>{u(e),X?.(e)},me=[{id:"todo",title:"To Do",status:"todo"},{id:"in-progress",title:"In Progress",status:"in-progress"},{id:"review",title:"Review",status:"review"},{id:"done",title:"Done",status:"done"}],ge=g>0?`calc(100vh - ${g+120}px)`:"calc(100vh - 12rem)";return T("div",{ref:ae,className:"h-full flex flex-col px-2 md:px-4 py-4",children:[n("div",{ref:o,className:"flex-shrink-0",children:n(V,{title:"Project Board",description:"Manage tasks and track progress across your project sprints.",gradient:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600",primaryAction:{label:"Add task",onClick:()=>N(!0)},secondaryAction:{label:"Add epic",onClick:()=>M(!0)}})}),n("div",{className:"flex-1 min-h-0 mt-8",children:n("div",{className:"h-full",style:{height:g>0?`calc(100vh - ${g+120}px)`:"calc(100vh - 12rem)"},children:n("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 h-full",children:me.map(e=>{let t=re(e.status),s=oe(t);return T(q,{title:e.title,status:e.status,taskCount:t.length,onDrop:de,isCompact:e.status==="done",height:ge,children:[s["no-epic"].map(a=>n(b,{epic:null,task:a,onDragStart:L,onTaskClick:z,isCompact:e.status==="done"},a.id)),ne.map(a=>{let D=d.find(k=>k.id===a),S=s[a]||[];return S.length===0?null:T("div",{className:"mb-6",children:[T("div",{className:"flex items-center gap-2 mb-3",children:[n("div",{className:`w-3 h-3 rounded-full ${D?.color}`}),n("span",{className:"text-sm font-medium text-muted-foreground select-none-important",children:D?.name||"No Epic"}),n(F,{variant:"secondary",className:"text-xs",children:S.length})]})," ",n("div",{className:"space-y-3",children:S.map(k=>n(b,{task:k,epic:D,onDragStart:L,onTaskClick:z,isCompact:e.status==="done"},k.id))})]},a)})]},e.id)})})})}),n(G,{isOpen:H,onClose:()=>N(!1),onAddTask:ce,assignees:[...I,...te],epics:d,sprints:O}),n(Q,{isOpen:P,onClose:()=>M(!1),onAddEpic:ue}),r&&n(J,{isOpen:!!r,onClose:()=>u(null),initialTask:r,epics:d,sprints:O,onUpdateTask:le,onDeleteTask:pe,colleagues:I,onAddComment:Z})]})};export{ye as a};
@@ -1 +0,0 @@
1
- import{a as C}from"./chunk-ZHBYZ4HE.mjs";import{a as y}from"./chunk-6SWKEZN6.mjs";import{a as p}from"./chunk-DFIXTV2M.mjs";import{a as T,f as x,g as h,i as b}from"./chunk-3UMMMQEH.mjs";import{useEffect as R,useState as r}from"react";import{Loader2 as X,Check as j,X as q}from"lucide-react";import{jsx as t,jsxs as i}from"react/jsx-runtime";var $=({isOpen:w,onClose:u,initialTask:l,epics:U,sprints:N,onUpdateTask:f,onDeleteTask:I,onAddComment:v,colleagues:M})=>{let[s,P]=r(l),[A,c]=r(new Date),[o,e]=r("idle"),[m,d]=r("idle"),[z,B]=r([]),[E,G]=r(M);R(()=>{P(l)},[l]);let D=async(a,n)=>{if(n!==s[a]){e("loading");try{await f(s.id.toString(),{[a]:n}),c(new Date),e("success"),setTimeout(()=>e("idle"),1500)}catch(g){console.log("error",g),e("error"),setTimeout(()=>e("idle"),3e3)}}},F=async(a,n)=>{if(n!==s[a]){e("loading");try{await f(s.id.toString(),{[a]:n}),c(new Date),e("success"),setTimeout(()=>e("idle"),1500)}catch(g){console.log("error",g),e("error"),setTimeout(()=>e("idle"),3e3)}}},H=async a=>{if(v){e("loading");try{await v?.({content:a,taskId:s.id.toString()}),c(new Date),e("success"),setTimeout(()=>e("idle"),1500)}catch{e("error"),setTimeout(()=>e("idle"),3e3)}}},L=async()=>{d("loading");try{await I(s.id.toString()),d("success"),setTimeout(()=>{u(),d("idle")},1e3)}catch{d("error"),setTimeout(()=>d("idle"),3e3)}},k=o!=="loading"&&m!=="loading",S=()=>{k&&u()},O=()=>o==="loading"?i("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[t(X,{className:"h-4 w-4 animate-spin"}),t("span",{children:"Updating..."})]}):o==="success"?i("div",{className:"flex items-center gap-2 text-sm text-success",children:[t(j,{className:"h-4 w-4"}),t("span",{children:"Updated successfully"})]}):o==="error"?i("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[t(q,{className:"h-4 w-4"}),t("span",{children:"Update failed"})]}):null;return t(T,{open:w,onOpenChange:S,children:i(x,{className:"max-w-3xl max-h-[80vh] overflow-y-auto p-4",children:[i(h,{children:[t(b,{className:"sr-only",children:s?.name}),i("div",{className:"flex items-center justify-between",children:[t("div",{className:"flex-1",children:O()}),!k&&t("div",{className:"text-xs text-muted-foreground",children:"Please wait..."})]})]}),i("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[i("div",{className:"lg:col-span-2 space-y-4",children:[t(p,{fieldName:"name",value:s.name||"",label:"",onSave:D,className:"border-b border-border pb-3",disabled:o==="loading"}),t(p,{fieldName:"description",value:s.description||"",label:"Description",multiline:!0,onSave:D,disabled:o==="loading"}),t(y,{comments:(s?.comments||[]).map(a=>({author:a.author.value.name||"",createdAt:new Date(a.timestamp),text:a.text,id:a.id||""})),onAddComment:H})]}),t(C,{task:s,epics:U,sprints:N,lastUpdated:A,onUpdateTask:F,onClose:S,onDelete:L,isUpdating:o==="loading",isDeleting:m==="loading",deleteState:m,teamMembers:E})]})]})})};export{$ as a};