@isardsat/editorial-admin 6.4.3 → 6.4.4

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.
@@ -1 +1 @@
1
- import{w as c,p as e}from"./chunk-EF7DTUVF-MlADC7xe.js";import{I as p}from"./itemForm-GgzEy97l.js";import{m as n,p as d}from"./utils-DN8wQ0jG.js";import"./button-D_tNOZW3.js";import"./index-b67bZzAe.js";import"./types-DI1nugUt.js";import"./index-BKOWzfnu.js";import"./index-xBXWoUIa.js";import"./createLucideIcon-BJQzFwzJ.js";import"./index-BCIQh_1v.js";import"./authSlice-Ck6mjgyY.js";import"./upload-CopmcV94.js";import"./calendar-6ih_JEvR.js";import"./files-JeyUc7x_.js";import"./trash-CN5HT_ZJ.js";import"./external-link-D1If5twJ.js";const N=c(function({params:r}){const{collectionId:t,documentId:i}=r,{data:o,isFetching:s}=n(t),{data:m,isFetching:a}=d({itemType:t,id:i});return!o||!m||(s||a)?null:e.jsx("div",{className:"overflow-auto",children:e.jsx("div",{className:"flex p-4 gap-4",children:e.jsx(p,{itemType:t,fields:o.fields,data:m},`${t}-${i}`)})})});export{N as default};
1
+ import{w as c,p as e}from"./chunk-EF7DTUVF-MlADC7xe.js";import{I as p}from"./itemForm-DeCuor51.js";import{m as n,p as l}from"./utils-DN8wQ0jG.js";import"./button-D_tNOZW3.js";import"./index-b67bZzAe.js";import"./types-DI1nugUt.js";import"./index-BKOWzfnu.js";import"./index-xBXWoUIa.js";import"./createLucideIcon-BJQzFwzJ.js";import"./index-BCIQh_1v.js";import"./authSlice-Ck6mjgyY.js";import"./upload-CopmcV94.js";import"./calendar-6ih_JEvR.js";import"./files-BkbeSoaZ.js";import"./trash-CN5HT_ZJ.js";import"./external-link-D1If5twJ.js";const N=c(function({params:r}){const{collectionId:t,documentId:i}=r,{data:o,isFetching:s}=n(t),{data:m,isFetching:a}=l({itemType:t,id:i});return!o||!m||(s||a)?null:e.jsx("div",{className:"overflow-auto scrollbar-stable",children:e.jsx("div",{className:"flex p-4 gap-4",children:e.jsx(p,{itemType:t,fields:o.fields,data:m},`${t}-${i}`)})})});export{N as default};
@@ -1 +1 @@
1
- import{w as e,p as o}from"./chunk-EF7DTUVF-MlADC7xe.js";import{I as m}from"./itemForm-GgzEy97l.js";import{m as p}from"./utils-DN8wQ0jG.js";import"./button-D_tNOZW3.js";import"./index-b67bZzAe.js";import"./types-DI1nugUt.js";import"./index-BKOWzfnu.js";import"./index-xBXWoUIa.js";import"./createLucideIcon-BJQzFwzJ.js";import"./index-BCIQh_1v.js";import"./authSlice-Ck6mjgyY.js";import"./upload-CopmcV94.js";import"./calendar-6ih_JEvR.js";import"./files-JeyUc7x_.js";import"./trash-CN5HT_ZJ.js";import"./external-link-D1If5twJ.js";const P=e(function({params:i}){const{collectionId:t}=i,{data:r}=p(t);return r?o.jsx("div",{className:"overflow-auto",children:o.jsx("div",{className:"flex p-4 gap-4",children:o.jsx(m,{itemType:t,fields:r.fields,isNew:!0})})}):null});export{P as default};
1
+ import{w as e,p as o}from"./chunk-EF7DTUVF-MlADC7xe.js";import{I as m}from"./itemForm-DeCuor51.js";import{m as p}from"./utils-DN8wQ0jG.js";import"./button-D_tNOZW3.js";import"./index-b67bZzAe.js";import"./types-DI1nugUt.js";import"./index-BKOWzfnu.js";import"./index-xBXWoUIa.js";import"./createLucideIcon-BJQzFwzJ.js";import"./index-BCIQh_1v.js";import"./authSlice-Ck6mjgyY.js";import"./upload-CopmcV94.js";import"./calendar-6ih_JEvR.js";import"./files-BkbeSoaZ.js";import"./trash-CN5HT_ZJ.js";import"./external-link-D1If5twJ.js";const P=e(function({params:i}){const{collectionId:t}=i,{data:r}=p(t);return r?o.jsx("div",{className:"overflow-auto",children:o.jsx("div",{className:"flex p-4 gap-4",children:o.jsx(m,{itemType:t,fields:r.fields,isNew:!0})})}):null});export{P as default};
@@ -1 +1 @@
1
- import{w as e,p as o}from"./chunk-EF7DTUVF-MlADC7xe.js";import{F as r}from"./files-JeyUc7x_.js";import"./authSlice-Ck6mjgyY.js";import"./utils-DN8wQ0jG.js";import"./index-b67bZzAe.js";import"./upload-CopmcV94.js";import"./createLucideIcon-BJQzFwzJ.js";import"./trash-CN5HT_ZJ.js";const n=e(function(){return o.jsx("div",{className:"overflow-auto flex flex-1 p-4 gap-4",children:o.jsx("div",{className:"flex flex-col flex-1 gap-8",children:o.jsx(r,{})})})});export{n as default};
1
+ import{w as e,p as o}from"./chunk-EF7DTUVF-MlADC7xe.js";import{F as r}from"./files-BkbeSoaZ.js";import"./authSlice-Ck6mjgyY.js";import"./utils-DN8wQ0jG.js";import"./index-b67bZzAe.js";import"./upload-CopmcV94.js";import"./createLucideIcon-BJQzFwzJ.js";import"./trash-CN5HT_ZJ.js";const n=e(function(){return o.jsx("div",{className:"overflow-auto flex flex-1 p-4 gap-4",children:o.jsx("div",{className:"flex flex-col flex-1 gap-8",children:o.jsx(r,{})})})});export{n as default};
@@ -0,0 +1,26 @@
1
+ import{p as e,a as v,x as z}from"./chunk-EF7DTUVF-MlADC7xe.js";import{e as y,m as j}from"./authSlice-Ck6mjgyY.js";import{a as b,q as C,v as $,w as M,x as D,u as U,y as _,o as H}from"./utils-DN8wQ0jG.js";import{S as L,c as S}from"./index-b67bZzAe.js";import{U as N,C as T}from"./upload-CopmcV94.js";import{F as I,T as V}from"./trash-CN5HT_ZJ.js";import{c as m}from"./createLucideIcon-BJQzFwzJ.js";/**
2
+ * @license lucide-react v0.487.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const P=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],q=m("copy",P);/**
7
+ * @license lucide-react v0.487.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const E=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],R=m("file-text",E);/**
12
+ * @license lucide-react v0.487.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const Z=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],G=m("file",Z);/**
17
+ * @license lucide-react v0.487.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const Q=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],W=m("folder-open",Q);/**
22
+ * @license lucide-react v0.487.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const B=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],O=m("folder",B),A=S("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function J({className:s,variant:i,asChild:l=!1,...o}){const n=l?L:"span";return e.jsx(n,{"data-slot":"badge",className:b(A({variant:i}),s),...o})}const K=["txt","md","html","pdf"],X=["svg","webp","png","jpeg","jpg"],Y=[{Icon:I,test:s=>X.some(i=>s.name.endsWith(i))},{Icon:R,test:s=>K.some(i=>s.name.endsWith(i))}],ee={Icon:G},w=({node:s,level:i=0,onDelete:l,onChange:o,disableActions:n,onUpload:p,onCreateFolder:u})=>{const[d,f]=v.useState(!1),{data:h}=U(),g=y(j),a=Y.find(r=>r.test(s))??ee,t=s.type==="directory",c=t||o?"div":z,k=()=>{t&&f(!d)},F=r=>{const x=r.target.files;x&&p&&p(s.path,x)};return e.jsxs("div",{className:"select-none",children:[e.jsxs(c,{to:`/${s.relativePath}`,target:"_blank",className:"flex items-center gap-2 h-10 p-2 group hover:bg-muted/50 cursor-pointer",style:{paddingLeft:`calc(0.5rem + ${i*20}px)`},onClick:t?k:o?()=>o(s.isLarge?`${h?.largeFilesUrl}/${s.relativePath}`:s.relativePath):void 0,children:[t?e.jsx(T,{size:16,className:b("transition-transform",{"rotate-180":d})}):e.jsx("div",{className:"w-4"}),e.jsxs("div",{className:"flex flex-grow w-24 items-center gap-2 ml-2",children:[t?d?e.jsx(W,{size:16,className:"text-yellow-500"}):e.jsx(O,{size:16,className:"text-yellow-500"}):e.jsx(a.Icon,{size:16,className:" text-gray-500"}),e.jsxs("span",{className:"flex gap-2 items-center text-sm whitespace-nowrap text-ellipsis overflow-hidden w-full",children:[!t&&s.isLarge&&e.jsx(J,{variant:"outline",children:"Large"}),s.name]})]}),e.jsx("div",{className:"flex w-24 justify-end gap-2",children:e.jsx("span",{className:"text-sm text-gray-500",children:t?"--":_(s.size)})}),g==="developer"&&!n&&e.jsxs("div",{className:"flex items-center gap-1 ml-4 group-hover:visible invisible z-50",children:[t&&e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"file",multiple:!0,onChange:F,className:"hidden",id:`dir-upload-${s.name}-${i}`}),e.jsxs("label",{htmlFor:`dir-upload-${s.name}-${i}`,className:"hover:text-blue-500 p-1 hover:bg-muted rounded-sm cursor-pointer",onClick:r=>{r.stopPropagation()},children:[e.jsx(N,{size:16}),e.jsx("span",{className:"sr-only",children:"Upload files to this folder"})]})]}),e.jsxs("button",{className:H("hover:text-yellow-500 p-1 hover:bg-muted rounded-sm",t&&"hidden"),onClick:r=>{r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(s.path)},children:[e.jsx(q,{size:16}),e.jsx("span",{className:"sr-only",children:"Copy file URL"})]}),e.jsxs("button",{className:"hover:text-red-500 p-1 hover:bg-muted rounded-sm",onClick:r=>{r.preventDefault(),r.stopPropagation(),l(s.path)},children:[e.jsx(V,{size:16}),e.jsxs("span",{className:"sr-only",children:["Delete this ",t?"folder":"file"]})]})]})]}),t&&d&&s.children&&e.jsx("div",{children:s.children.map((r,x)=>e.jsx(w,{node:r,level:i+1,onDelete:l,onChange:o,disableActions:n,onUpload:p,onCreateFolder:u},`${r.name}-${x}`))})]})};function ne({disableActions:s,onChange:i}){const{data:l}=C(),[o]=$(),[n]=M(),[p]=D(),u=y(j),d=async a=>{const t=a.target.files;if(t)try{await n({files:t}).unwrap()}catch(c){console.error("Upload failed:",c)}},f=async(a,t)=>{try{await n({files:t,path:a}).unwrap()}catch(c){console.error("Upload failed:",c)}},h=async(a,t)=>{try{await p({name:t,path:a}).unwrap()}catch(c){console.error("Create folder failed:",c)}},g=v.useMemo(()=>l?.toSorted((a,t)=>a.type==="directory"&&t.type!=="directory"?-1:a.type!=="directory"&&t.type==="directory"?1:a.name.localeCompare(t.name)).map(a=>e.jsx(w,{node:a,onDelete:o,onChange:i,disableActions:s,onUpload:f,onCreateFolder:h},a.name)),[l,s,i]);return e.jsxs("div",{className:"overflow-auto h-full max-w-[800px] rounded-xl border",children:[e.jsxs("div",{className:"sticky top-0 bg-white flex items-center gap-2 py-1 px-2 border-b group",children:[e.jsx("div",{className:"w-4"}),e.jsx("div",{className:"flex flex-grow items-center gap-2 ml-2",children:e.jsx("span",{className:"text-sm font-semibold",children:"Name"})}),e.jsx("div",{className:"flex w-24 items-center gap-2 ml-2",children:e.jsx("span",{className:"text-sm font-semibold",children:"Size"})}),u==="developer"&&!s&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("input",{type:"file",multiple:!0,onChange:d,className:"hidden",id:"file-upload"}),e.jsxs("label",{htmlFor:"file-upload",className:"hover:text-blue-500 p-1 hover:bg-muted rounded-sm cursor-pointer",children:[e.jsx(N,{size:16}),e.jsx("span",{className:"sr-only",children:"Upload files"})]})]})]}),g]})}export{ne as F};