cortex-react-components 2.26.1 → 2.26.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-P7S6XFU4.mjs → chunk-23XORW7A.mjs} +1 -1
- package/dist/{chunk-XI5H6WLY.mjs → chunk-2GZQYAN3.mjs} +1 -1
- package/dist/{chunk-XREAMNVX.mjs → chunk-4NHQXOKZ.mjs} +1 -1
- package/dist/{chunk-4HXYNCOU.mjs → chunk-5EKGFFJD.mjs} +1 -1
- package/dist/{chunk-HH3AWPYB.mjs → chunk-5KS3DITB.mjs} +1 -1
- package/dist/{chunk-G6ED5Z4J.mjs → chunk-66ODXUVL.mjs} +1 -1
- package/dist/{chunk-RS4VD3ML.mjs → chunk-67PJ7D4O.mjs} +1 -1
- package/dist/{chunk-JCWFPKF3.mjs → chunk-6LY5CH7J.mjs} +1 -1
- package/dist/{chunk-AQQCH7Z2.mjs → chunk-AGWQ5S2Z.mjs} +1 -1
- package/dist/chunk-AN744MXS.mjs +9 -0
- package/dist/{chunk-PLTKMHUH.mjs → chunk-BDNY6OKE.mjs} +1 -1
- package/dist/{chunk-IUT6JJHY.mjs → chunk-BGADMIWV.mjs} +1 -1
- package/dist/{chunk-DUEPJ3F4.mjs → chunk-BN747TQM.mjs} +1 -1
- package/dist/{chunk-PZCH3GAL.mjs → chunk-CJ2ZX7QN.mjs} +1 -1
- package/dist/{chunk-LAQ3QAUW.mjs → chunk-CLGBBNRB.mjs} +1 -1
- package/dist/{chunk-5NIEZE7A.mjs → chunk-CNCT3JZV.mjs} +1 -1
- package/dist/{chunk-PDAMYUP7.mjs → chunk-DJ2KA3MS.mjs} +1 -1
- package/dist/{chunk-24NYAA5I.mjs → chunk-DVE2KPLR.mjs} +1 -1
- package/dist/{chunk-LHO4WFYP.mjs → chunk-ERHNVIOZ.mjs} +1 -1
- package/dist/{chunk-6T4OEOJH.mjs → chunk-GIL2SMPM.mjs} +1 -1
- package/dist/{chunk-INBT5E6T.mjs → chunk-GPFPTU7U.mjs} +1 -1
- package/dist/{chunk-2HKAJ4TZ.mjs → chunk-HTS3KCJL.mjs} +1 -1
- package/dist/{chunk-DY2G774J.mjs → chunk-I6OBIS4J.mjs} +1 -1
- package/dist/{chunk-6UDBIRMT.mjs → chunk-IO5ZSALG.mjs} +1 -1
- package/dist/chunk-IXLFVFIK.mjs +4 -0
- package/dist/{chunk-VKJ7E6OL.mjs → chunk-JLUX7EHB.mjs} +1 -1
- package/dist/{chunk-436WKDWG.mjs → chunk-JT65KF7C.mjs} +1 -1
- package/dist/{chunk-V63JJVJX.mjs → chunk-JUFFNFV6.mjs} +1 -1
- package/dist/{chunk-NIRR5B5C.mjs → chunk-KRLNPNMZ.mjs} +1 -1
- package/dist/{chunk-KJMXSFJA.mjs → chunk-M74BIPBM.mjs} +1 -1
- package/dist/{chunk-EVZSRWUW.mjs → chunk-NXG2Y4N4.mjs} +1 -1
- package/dist/{chunk-XDELWNND.mjs → chunk-OP6ZWZIM.mjs} +1 -1
- package/dist/{chunk-QDAJ7QAD.mjs → chunk-PRK2XFAZ.mjs} +1 -1
- package/dist/{chunk-ZFUP5NVF.mjs → chunk-PXLSH6S2.mjs} +1 -1
- package/dist/{chunk-Z3NOT3QB.mjs → chunk-PZZTGPEO.mjs} +1 -1
- package/dist/{chunk-YSAWXOPE.mjs → chunk-R3SDBXF2.mjs} +1 -1
- package/dist/{chunk-RSYHYNWR.mjs → chunk-RIFUOB7A.mjs} +1 -1
- package/dist/{chunk-P55W6AFU.mjs → chunk-RIRZRO6U.mjs} +1 -1
- package/dist/{chunk-ZJZ2UMK2.mjs → chunk-S3P6OGB7.mjs} +1 -1
- package/dist/{chunk-S562PA5P.mjs → chunk-T36QUKC6.mjs} +1 -1
- package/dist/{chunk-RSDUFAIB.mjs → chunk-T5HJS6OF.mjs} +1 -1
- package/dist/{chunk-HSQAHQNP.mjs → chunk-TKCFCYEQ.mjs} +1 -1
- package/dist/{chunk-3GDFYE6T.mjs → chunk-UX5OJ3WS.mjs} +1 -1
- package/dist/{chunk-X3JZSN3W.mjs → chunk-UZSBX5GO.mjs} +1 -1
- package/dist/{chunk-XGIYNUGC.mjs → chunk-VNYUNZ3M.mjs} +1 -1
- package/dist/{chunk-2BR55L74.mjs → chunk-VRE6VCHX.mjs} +1 -1
- package/dist/{chunk-IQ3TUH7O.mjs → chunk-WDZOGIT2.mjs} +1 -1
- package/dist/{chunk-L3BLBPSR.mjs → chunk-WUA65ZZB.mjs} +1 -1
- package/dist/{chunk-M4NJB4NN.mjs → chunk-Y62OBV2E.mjs} +1 -1
- package/dist/components/Blocks/Banner.mjs +1 -1
- package/dist/components/Blocks/CallToAction.mjs +1 -1
- package/dist/components/Blocks/CollapsibleArea.mjs +1 -1
- package/dist/components/Blocks/Content.mjs +1 -1
- package/dist/components/Blocks/FeaturesBlock.mjs +1 -1
- package/dist/components/Blocks/ImageBlock.mjs +1 -1
- package/dist/components/Blocks/MediaBlock.mjs +1 -1
- package/dist/components/Blocks/RelatedPosts.mjs +1 -1
- package/dist/components/Blocks/RenderBlocks.mjs +1 -1
- package/dist/components/Blocks/ReusableContentBlock.mjs +1 -1
- package/dist/components/Blocks/index.mjs +1 -1
- package/dist/components/Cards/ContentCard.mjs +1 -1
- package/dist/components/Cards/FeatureCard.mjs +1 -1
- package/dist/components/Cards/index.mjs +1 -1
- package/dist/components/DigitalColleagues/AppSidebarLeft.mjs +1 -1
- package/dist/components/DigitalColleagues/MainPage.mjs +1 -1
- package/dist/components/DigitalColleagues/Pages/dashboardpage.js +6 -6
- package/dist/components/DigitalColleagues/Pages/dashboardpage.mjs +1 -1
- package/dist/components/DigitalColleagues/Views/index.js +6 -6
- package/dist/components/DigitalColleagues/Views/index.mjs +1 -1
- package/dist/components/DigitalColleagues/index.js +6 -6
- package/dist/components/DigitalColleagues/index.mjs +1 -1
- package/dist/components/Foundary/AppSidebarLeft.mjs +1 -1
- package/dist/components/Foundary/Knowledge/add-knowledge-modal.mjs +1 -1
- package/dist/components/Foundary/Knowledge/add-team-context.mjs +1 -1
- package/dist/components/Foundary/MainPage.mjs +1 -1
- package/dist/components/Foundary/Pages/dashboardpage.js +6 -6
- package/dist/components/Foundary/Pages/dashboardpage.mjs +1 -1
- package/dist/components/Foundary/Views/ColleaguesView.mjs +1 -1
- package/dist/components/Foundary/Views/KnowledgeView.mjs +1 -1
- package/dist/components/Foundary/Views/index.js +6 -6
- package/dist/components/Foundary/Views/index.mjs +1 -1
- package/dist/components/Foundary/file-edit.js +6 -6
- package/dist/components/Foundary/file-edit.mjs +1 -1
- package/dist/components/Foundary/index.js +6 -6
- package/dist/components/Foundary/index.mjs +1 -1
- package/dist/components/HeaderFooter/Header.mjs +1 -1
- package/dist/components/HeaderFooter/HeaderDesktop.mjs +1 -1
- package/dist/components/HeaderFooter/SectionHeading.mjs +1 -1
- package/dist/components/HeaderFooter/index.mjs +1 -1
- package/dist/components/Heros/HighImpact/index.mjs +1 -1
- package/dist/components/Heros/LowImpact/index.mjs +1 -1
- package/dist/components/Heros/MediumImpact/index.mjs +1 -1
- package/dist/components/Heros/PostHero/index.mjs +1 -1
- package/dist/components/Heros/RenderHero.mjs +1 -1
- package/dist/components/Heros/index.mjs +1 -1
- package/dist/components/Holidays/HolidayTracker.js +1 -1
- package/dist/components/Holidays/HolidayTracker.mjs +1 -1
- package/dist/components/Holidays/RequestLeave.js +1 -1
- package/dist/components/Holidays/RequestLeave.mjs +1 -1
- package/dist/components/Holidays/index.js +1 -1
- package/dist/components/Holidays/index.mjs +1 -1
- package/dist/components/Layouts/OutputHeaderFooter.mjs +1 -1
- package/dist/components/Layouts/Print.mjs +1 -1
- package/dist/components/Layouts/SlideShow.mjs +1 -1
- package/dist/components/Layouts/index.mjs +1 -1
- package/dist/components/Menus/SidebarLeft.mjs +1 -1
- package/dist/components/Menus/SidebarRight.mjs +1 -1
- package/dist/components/Menus/index.mjs +1 -1
- package/dist/components/Payload/CollectionArchive/index.mjs +1 -1
- package/dist/components/Payload/Media/index.mjs +1 -1
- package/dist/components/Payload/PayloadCard/index.mjs +1 -1
- package/dist/components/Payload/RichText/index.mjs +1 -1
- package/dist/components/Payload/RichText/serialize.mjs +1 -1
- package/dist/components/Payload/index.mjs +1 -1
- package/dist/components/Projects/FileView.js +6 -6
- package/dist/components/Projects/FileView.mjs +1 -1
- package/dist/components/Projects/KanbanBoardView.js +6 -6
- package/dist/components/Projects/KanbanBoardView.mjs +1 -1
- package/dist/components/Projects/ProjectPage.js +6 -6
- package/dist/components/Projects/ProjectPage.mjs +1 -1
- package/dist/components/Projects/ProjectView.js +6 -6
- package/dist/components/Projects/ProjectView.mjs +1 -1
- package/dist/components/Projects/ProjectsIndexView.mjs +1 -1
- package/dist/components/Projects/TaskDetailsModal.js +6 -6
- package/dist/components/Projects/TaskDetailsModal.mjs +1 -1
- package/dist/components/Projects/file-list.js +6 -6
- package/dist/components/Projects/file-list.mjs +1 -1
- package/dist/components/Projects/index.js +6 -6
- package/dist/components/Projects/index.mjs +1 -1
- package/dist/components/dc-temp/index.js +6 -6
- package/dist/components/dc-temp/index.mjs +1 -1
- package/dist/components/index.js +19 -19
- package/dist/components/index.mjs +1 -1
- package/dist/components/ui/index.mjs +1 -1
- package/dist/components/ui/sidebar.mjs +1 -1
- package/dist/index.js +21 -21
- package/dist/index.mjs +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/pages/Blog.mjs +1 -1
- package/dist/pages/Documentation.mjs +1 -1
- package/dist/pages/IndexPage.mjs +1 -1
- package/dist/pages/Intranet.mjs +1 -1
- package/dist/pages/LandingPage.mjs +1 -1
- package/dist/pages/Page.mjs +1 -1
- package/dist/pages/Publish.mjs +1 -1
- package/dist/pages/Website.mjs +1 -1
- package/dist/sections/AboutSection.mjs +1 -1
- package/dist/sections/BlogDetail.mjs +1 -1
- package/dist/sections/BlogList.mjs +1 -1
- package/dist/sections/BlogListSection.mjs +1 -1
- package/dist/sections/ContactSection.mjs +1 -1
- package/dist/sections/PageSections.mjs +1 -1
- package/dist/sections/PricingSection.mjs +1 -1
- package/dist/sections/ServiceDetail.mjs +1 -1
- package/dist/sections/ServiceDetailSection.mjs +1 -1
- package/dist/sections/ServiceSection.mjs +1 -1
- package/dist/sections/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-3V4WLGEY.mjs +0 -4
- package/dist/chunk-P5LSKHQC.mjs +0 -9
package/dist/chunk-3V4WLGEY.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
import{b as C,c as S}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 T}from"react";import{format as L}from"date-fns";import{CalendarIcon as w}from"lucide-react";import{useRouter as I}from"next/navigation";import{Toaster as M,toast as v}from"sonner";import{jsx as t,jsxs as o}from"react/jsx-runtime";var Y=({options:r,value:l,onChange:a,disabled:n=[]})=>t("div",{className:"flex space-x-2",children:r.map((e,i)=>t(c,{type:"button",variant:l===e?"default":"outline",onClick:()=>a(e),disabled:n[i],className:"flex-1 hover:bg-accent hover:text-accent-foreground",children:e},e))});function X({remainingDays:r,submitLeaveRequest:l}){let[a,n]=m(new Date),[e,i]=m(new Date),[d,g]=m("Full Day"),[N,R]=m(!1),[p,F]=m(1),B=I();T(()=>{let s=S(a,e);R(s),s&&g("Full Day")},[a,e]),T(()=>{if(!a||!e){F(0);return}let s=C(a,e,d!=="Full Day");F(s)},[a,e,d]);let q=s=>{g(s)};return o("div",{className:"max-w-2xl",children:[t("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=>{s.preventDefault();let E=a?.getUTCFullYear(),k=e?.getUTCFullYear();if(!a||!e){v.error("Please select both start and end dates");return}if(E==k&&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",e.toISOString()),u.append("leaveType",d),u.append("duration",p.toString());let y=await(l||G)(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:[t(f,{htmlFor:"startDate",children:"Start Date"}),o(b,{children:[t(h,{asChild:!0,children:o(c,{variant:"outline",className:D("w-full justify-start text-left font-normal",!a&&"text-muted-foreground"),children:[t(w,{className:"mr-2 h-4 w-4"}),a?L(a,"PPP"):t("span",{children:"Pick a date"})]})}),t(P,{className:"w-auto p-0",align:"start",children:t(x,{mode:"single",selected:a,onSelect:s=>{n(s),s&&(!e||s>e)&&i(s)},initialFocus:!0})})]})]}),o("div",{className:"flex flex-col space-y-2",children:[t(f,{htmlFor:"endDate",children:"End Date"}),o(b,{children:[t(h,{asChild:!0,children:o(c,{variant:"outline",className:D("w-full justify-start text-left font-normal",!e&&"text-muted-foreground"),children:[t(w,{className:"mr-2 h-4 w-4"}),e?L(e,"PPP"):t("span",{children:"Pick a date"})]})}),t(P,{className:"w-auto p-0",align:"start",children:t(x,{mode:"single",selected:e,onSelect:i,disabled:s=>a?s<a:!1,initialFocus:!0})})]})]})]}),o("div",{className:"space-y-2",children:[t(f,{children:"Leave Type"}),t(Y,{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]}),t(c,{disabled:p<=0,type:"submit",className:"w-full hover:bg-accent hover:text-accent-foreground",children:"Submit Request"})]}),t(M,{richColors:!0,position:"top-right",closeButton:!0,visibleToasts:9,className:"z-50"})]})}var G=async r=>{let l={};return r.forEach((a,n)=>{l[n]=a}),{success:!0,message:`Leave request submitted successfully for ${r.get("duration")}`}};export{X as a};
|
package/dist/chunk-P5LSKHQC.mjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
import{a as $}from"./chunk-VTFO5GXK.mjs";import{a as F}from"./chunk-DFIXTV2M.mjs";import{a as C}from"./chunk-B4H6T2GP.mjs";import{b}from"./chunk-ZUA4KNIR.mjs";import{motion as A}from"motion/react";import{File as D,FileText as I,Type as K,Loader2 as S,X as M,Save as _}from"lucide-react";import{useEffect as L,useRef as B,useState as w}from"react";import{Fragment as R,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=e=>{if(!e)return"";switch(e.type){case"heading":{let t=e.tag?parseInt(e.tag.replace("h","")):1,r=s(e.children||[]);return"#".repeat(t)+" "+r}case"paragraph":return s(e.children||[]);case"list":{let t=[],r=e.listType==="number"?"1.":"-";return e.children?.forEach((d,o)=>{if(d.type==="listitem"){let m=s(d.children||[]),u=e.listType==="number"?`${o+1}.`:r;t.push(`${u} ${m}`)}}),t.join(`
|
|
5
|
-
`)}case"listitem":return s(e.children||[]);case"text":{let t=e.text||"";if(e.format){let r=(e.format&1)!==0,d=(e.format&2)!==0,o=(e.format&4)!==0,m=(e.format&8)!==0;(e.format&16)!==0?t=`\`${t}\``:(r&&(t=`**${t}**`),d&&(t=`*${t}*`),o&&(t=`~~${t}~~`),m&&(t=`<u>${t}</u>`))}return t}default:return e.children?s(e.children):""}},s=e=>e.map(t=>{if(t.type==="text"){let r=t.text||"";if(t.format){let d=(t.format&1)!==0,o=(t.format&2)!==0,m=(t.format&4)!==0,u=(t.format&8)!==0;(t.format&16)!==0?r=`\`${r}\``:(d&&(r=`**${r}**`),o&&(r=`*${r}*`),m&&(r=`~~${r}~~`),u&&(r=`<u>${r}</u>`))}return r}else{if(t.type==="paragraph")return s(t.children||[]);if(t.type==="listitem")return s(t.children||[]);if(t.type==="linebreak")return`
|
|
6
|
-
`}return i(t)}).filter(Boolean).join("");return n.root.children.forEach(e=>{let t=i(e);t&&l.push(t)}),l.join(`
|
|
7
|
-
|
|
8
|
-
`)},v=n=>{let l=[],i=0;for(;i<n.length;){let e=n.slice(i).match(/^<u\s*[^>]*>([\s\S]*?)<\/u>/i);if(e&&e[0]){let a=e[1]||"",f=a?v(a):[];f.length>0?(f.forEach(h=>{h.type==="text"&&(h.format=(h.format||0)|8)}),l.push(...f)):a===""&&l.push({type:"text",text:"",format:8}),i+=e[0].length;continue}if(n.slice(i).startsWith("</u>")){i+=4;continue}let t=n.slice(i).match(/^(`+)([^`]+)\1/);if(t){let a=t[2];a&&l.push({type:"text",text:a,format:16}),i+=t[0].length;continue}let r=n.slice(i).match(/^(~~)(.+?)\1/);if(r){let a=r[2],f=v(a);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 a=d[2],f=v(a);f.forEach(h=>{h.type==="text"&&(h.format=(h.format||0)|1)}),l.push(...f),i+=d[0].length;continue}let o=n.slice(i).match(/^(\*|_)([^*_\n]+?)\1(?!\*|_)/);if(o&&o[0].length>2){let a=o[2],f=v(a);f.forEach(h=>{h.type==="text"&&(h.format=(h.format||0)|2)}),l.push(...f),i+=o[0].length;continue}let m=n.length,u=[{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:a}of u){let f=n.slice(i+1).search(a);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 e of l)s.length>0&&s[s.length-1].type==="text"&&s[s.length-1].format===e.format?s[s.length-1].text+=e.text:s.push(e);return s.length>0?s:[{type:"text",text:"",format:0}]},U=n=>{let l=n.split(`
|
|
9
|
-
`),i=[],s=[],e=[],t=()=>{if(s.length>0){let d=s.join(" "),o=v(d);i.push({type:"paragraph",children:o.length>0?o:[{type:"text",text:"",format:0}]}),s=[]}},r=()=>{e.length>0&&(i.push({type:"list",listType:"bullet",children:e}),e=[])};for(let d of l){let o=d.trim();if(!o){t(),r();continue}let m=o.match(/^(#{1,6})\s+(.+)$/);if(m){t(),r();let g=m[1].length,a=m[2],f=v(a);i.push({type:"heading",tag:`h${g}`,children:f.length>0?f:[{type:"text",text:"",format:0}]});continue}let u=o.match(/^[-*+]\s+(.+)$/);if(u){t();let g=u[1],a=v(g);e.push({type:"listitem",children:[{type:"paragraph",children:a.length>0?a:[{type:"text",text:"",format:0}]}]});continue}e.length>0&&r(),s.push(o)}return t(),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}}},j=async n=>{let l="",i,s="text";if(n.url)try{let e=n.url;!e.startsWith("http://")&&!e.startsWith("https://")&&!e.startsWith("/")&&(e="/"+e);let t=await fetch(e);t.ok?(l=await t.text(),console.log("Successfully loaded content, length:",l.length)):console.error("Failed to fetch file content:",t.status,t.statusText)}catch(e){console.error("Failed to fetch file content:",e)}else console.warn("No URL provided for file:",n.name);return n.mimeType==="text/markdown"?(s="richText",i=U(l)):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 O({document:n,onCancel:l,onSave:i,onFileUpdate:s}){let[e,t]=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}),[o,m]=w(T(n)?void 0:r.richTextContent),[u,g]=w(!1),a=B(T(n)?n:null);L(()=>{T(n)?(t(!0),j(n).then(p=>{d(p),m(p.richTextContent),t(!1)}).catch(p=>{p instanceof Error&&p.name!=="AbortError"&&(console.error("Failed to convert file:",p),t(!1))})):(d({...n,updatedAt:new Date}),m(n.richTextContent))},[n]);let f=p=>{switch(p){case"markdown":case"mdx":return c(I,{className:"h-6 w-6 text-primary"});case"richText":return c(D,{className:"h-6 w-6 text-success"});case"text":return c(K,{className:"h-6 w-6 text-muted-foreground"});default:return c(D,{className:"h-6 w-6 text-muted-foreground"})}},h=p=>{switch(p){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"}},E=async()=>{g(!0);try{let p,x;if(a.current&&a.current.mimeType==="text/markdown"){let k=o?P(o):"";p={...r,format:"markdown",content:k,richTextContent:void 0},x=k}else p={...r,richTextContent:o},x=r.content||"";let N=a.current?a.current.id.toString():r.id;await Promise.resolve(i()),s?.(N,x)}finally{g(!1)}};return y(A.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:(p,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(M,{className:"h-4 w-4"}),"Close"]}),y(b,{size:"sm",onClick:E,className:"gap-2",disabled:u,children:[u?c(S,{className:"h-4 w-4 animate-spin"}):c(_,{className:"h-4 w-4"}),u?"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:e?c("div",{className:"flex items-center justify-center h-full",children:y("div",{className:"flex flex-col items-center gap-4",children:[c(S,{className:"h-8 w-8 animate-spin text-primary"}),c("p",{className:"text-sm text-muted-foreground",children:"Loading file content..."})]})}):c(R,{children:r.format==="richText"?c($,{setValue:m,value:o,name:"richTextContent"},`richtext-${r.id}-${e?"loading":"loaded"}`):c(C,{value:r.content||"",onChange:p=>d(x=>({...x,content:p.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})})})})]})}export{O as a};
|