ode-explorer 1.0.0-dev.202306301017 → 1.0.0-dev.202307041543

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/README.md CHANGED
@@ -79,7 +79,7 @@ pnpm lighthouse
79
79
 
80
80
  ### Pre-commit
81
81
 
82
- When committing your work, `pre-commit` will start `yarn lint-staged`:
82
+ When committing your work, `pre-commit` will start `pnpm lint-staged`:
83
83
 
84
84
  > lint-staged starts lint + prettier
85
85
 
package/dist/AppAction.js CHANGED
@@ -1 +1 @@
1
- import{u as o,b as r,j as t,B as n,S as a}from"./index.js";function i(){const{i18n:e}=o(),{createResource:s}=r();return t.jsx(n,{type:"button",color:"primary",variant:"filled",leftIcon:t.jsx(a,{}),className:"ms-auto",onClick:s,children:e("explorer.create.title")})}export{i as default};
1
+ import{u as a,a as n,c as r,j as t,B as c,S as i}from"./index.js";function u(){const{appCode:e}=a(),{t:s}=n(e),{createResource:o}=r();return t.jsx(c,{type:"button",color:"primary",variant:"filled",leftIcon:t.jsx(i,{}),className:"ms-auto",onClick:o,children:s("explorer.create.title")})}export{u as default};
package/dist/Card.js CHANGED
@@ -1 +1 @@
1
- import{r as R,d as a,j as s,s as B,ac as E,ad as F,I as G,a7 as U,p as q,ae as D,af as H,ag as J,ah as K}from"./index.js";import{T as d}from"./Tooltip.js";const n=R.forwardRef(({app:l,className:h,creatorName:r="tom.mate",isAnimated:x=!1,isFolder:t=!1,isLoading:e=!1,isSelected:m=!1,isShared:p=!1,isPublic:j=!1,name:g="Resource",resourceSrc:i="",updatedAt:v="2 days ago",userSrc:o="",onOpen:u,onSelect:c,messagePublic:N,messageShared:f,...$},b)=>{const{getIconCode:w}=K(),C=a("card",{"placeholder-glow":e,"is-selected":m,"is-animated":x},h),y=a("card-title body text-break text-truncate text-truncate--2 pe-32",{placeholder:e}),I=a("card-text small",{placeholder:e}),O=a("small text-truncate",{placeholder:e}),z=a("d-inline-flex align-items-center gap-8 text-truncate",{placeholder:e}),T=l?w(l):"placeholder",k=a(`color-app-${T}`,{placeholder:e});function A(P){P.stopPropagation(),c==null||c()}return s.jsxs("div",{ref:b,className:C,...$,children:[!e&&s.jsx(B,{"aria-label":"Open Action Bar",className:"z-3",color:"secondary",icon:s.jsx(E,{}),onClick:A,variant:"ghost"}),s.jsx("button",{onClick:u,className:"position-absolute bottom-0 end-0 top-0 start-0 opacity-0 z-1 w-100","aria-label":"Open resource"}),s.jsxs("div",{className:"card-body",children:[t?s.jsx(F,{width:"48",height:"48",className:k}):i?s.jsx("div",{className:"card-image",children:s.jsx(G,{alt:"",src:i,width:"80",height:"80",objectFit:"cover",className:"h-full"})}):s.jsx(U,{app:l,iconFit:"ratio",size:"80",variant:"rounded"}),s.jsxs("div",{children:[s.jsx("h3",{className:y,children:s.jsx("strong",{children:g})}),t?null:s.jsx("p",{className:"card-text small",children:s.jsx("em",{className:I,children:v})})]})]}),t?null:s.jsxs("div",{className:"card-footer gap-16",children:[s.jsxs("div",{className:z,children:[o?s.jsx(q,{alt:r,size:"xs",src:o,variant:"circle",width:"24",height:"24"}):s.jsx(D,{}),s.jsx("p",{className:O,children:r})]}),s.jsxs("div",{className:"d-inline-flex align-items-center gap-8",children:[j&&s.jsx(d,{message:N,placement:"top",children:s.jsx(H,{width:16,height:16})}),p&&s.jsx(d,{message:f,placement:"top",children:s.jsx(J,{width:16,height:16})})]})]})]})});n.displayName="Card";const S=n;export{S as C};
1
+ import{r as R,f as a,j as s,t as B,ad as E,ae as F,I as q,a8 as G,q as U,af as D,ag as H,ah as J,ai as K}from"./index.js";import{T as n}from"./Tooltip.js";const d=R.forwardRef(({app:l,className:h,creatorName:r="tom.mate",isAnimated:x=!1,isFolder:t=!1,isLoading:e=!1,isSelected:m=!1,isShared:p=!1,isPublic:j=!1,name:g="Resource",resourceSrc:i="",updatedAt:v="2 days ago",userSrc:o="",onOpen:u,onSelect:c,messagePublic:N,messageShared:f,...$},b)=>{const{getIconCode:w}=K(),C=a("card",{"placeholder-glow":e,"is-selected":m,"is-animated":x},h),y=a("card-title body text-break text-truncate text-truncate--2 pe-32",{placeholder:e}),I=a("card-text small",{placeholder:e}),O=a("small text-truncate",{placeholder:e}),z=a("d-inline-flex align-items-center gap-8 text-truncate",{placeholder:e}),T=l?w(l):"placeholder",k=a(`color-app-${T}`,{placeholder:e});function A(P){P.stopPropagation(),c==null||c()}return s.jsxs("div",{ref:b,className:C,...$,children:[!e&&s.jsx(B,{"aria-label":"Open Action Bar",className:"z-3",color:"secondary",icon:s.jsx(E,{}),onClick:A,variant:"ghost"}),s.jsx("button",{onClick:u,className:"position-absolute bottom-0 end-0 top-0 start-0 opacity-0 z-1 w-100","aria-label":"Open resource"}),s.jsxs("div",{className:"card-body",children:[t?s.jsx(F,{width:"48",height:"48",className:k}):i?s.jsx("div",{className:"card-image",children:s.jsx(q,{alt:"",src:i,width:"80",height:"80",objectFit:"cover",className:"h-full"})}):s.jsx(G,{app:l,iconFit:"ratio",size:"80",variant:"rounded"}),s.jsxs("div",{children:[s.jsx("h3",{className:y,children:s.jsx("strong",{children:g})}),t?null:s.jsx("p",{className:"card-text small",children:s.jsx("em",{className:I,children:v})})]})]}),t?null:s.jsxs("div",{className:"card-footer gap-16",children:[s.jsxs("div",{className:z,children:[o?s.jsx(U,{alt:r,size:"xs",src:o,variant:"circle",width:"24",height:"24"}):s.jsx(D,{}),s.jsx("p",{className:O,children:r})]}),s.jsxs("div",{className:"d-inline-flex align-items-center gap-8",children:[j&&s.jsx(n,{message:N,placement:"top",children:s.jsx(H,{width:16,height:16})}),p&&s.jsx(n,{message:f,placement:"top",children:s.jsx(J,{width:16,height:16})})]})]})]})});d.displayName="Card";const S=d;export{S as C};
@@ -1 +1 @@
1
- import{e as u,y as h,z as x,C as p,l as m,n as y,u as j,a as f,j as e,M as n,B as i}from"./index.js";function M({onSuccess:s}){const{i18n:l}=u(),o=h(),t=x(),r=p(),{hotToast:a}=m(y);async function d(){try{r?(await o.mutate(),a.success(l("explorer.removed.from.trash"))):(await t.mutate(),a.success(l("explorer.trash.title"))),s==null||s()}catch(c){console.error(c)}}return{isTrashFolder:r,onDelete:d}}function T({isOpen:s,onSuccess:l=()=>({}),onCancel:o=()=>({})}){const{i18n:t}=j(),{isTrashFolder:r,onDelete:a}=M({onSuccess:l});return f.createPortal(e.jsxs(n,{isOpen:s,onModalClose:o,id:"deleteModal",children:[e.jsx(n.Header,{onModalClose:o,children:t(r?"explorer.delete.title":"explorer.trash.title")}),e.jsx(n.Body,{children:e.jsx("p",{className:"body",children:t(r?"explorer.delete.subtitle":"explorer.trash.subtitle")})}),e.jsxs(n.Footer,{children:[e.jsx(i,{color:"tertiary",onClick:o,type:"button",variant:"ghost",children:t("explorer.cancel")}),e.jsx(i,{color:"primary",onClick:a,type:"button",variant:"filled",children:t(r?"explorer.delete":"explorer.trash")})]})]}),document.getElementById("portal"))}export{T as default};
1
+ import{a as d,z as x,C as p,D as u,m,p as j,b as y,j as e,M as n,B as i}from"./index.js";function f({onSuccess:o}){const{t:l}=d(),s=x(),t=p(),r=u(),{hotToast:a}=m(j);async function c(){try{r?(await s.mutate(),a.success(l("explorer.removed.from.trash"))):(await t.mutate(),a.success(l("explorer.trash.title"))),o==null||o()}catch(h){console.error(h)}}return{isTrashFolder:r,onDelete:c}}function M({isOpen:o,onSuccess:l=()=>({}),onCancel:s=()=>({})}){const{t}=d(),{isTrashFolder:r,onDelete:a}=f({onSuccess:l});return y.createPortal(e.jsxs(n,{isOpen:o,onModalClose:s,id:"deleteModal",children:[e.jsx(n.Header,{onModalClose:s,children:t(r?"explorer.delete.title":"explorer.trash.title")}),e.jsx(n.Body,{children:e.jsx("p",{className:"body",children:t(r?"explorer.delete.subtitle":"explorer.trash.subtitle")})}),e.jsxs(n.Footer,{children:[e.jsx(i,{color:"tertiary",onClick:s,type:"button",variant:"ghost",children:t("explorer.cancel")}),e.jsx(i,{color:"primary",onClick:a,type:"button",variant:"filled",children:t(r?"explorer.delete":"explorer.trash")})]})]}),document.getElementById("portal"))}export{M as default};
@@ -1 +1 @@
1
- import{E as v,K as B,N as q,O as L,r as I,P as R,e as w,a as P,j as r,M as s,F as U,Q as V,x as _,B as y}from"./index.js";import{u as k}from"./index.esm.js";function z({edit:a,onSuccess:e,onClose:i}){var F;const n=v(),t=B(),m=q(),c=L(),u=a?(F=n[0])==null?void 0:F.name:void 0,{reset:o,register:f,handleSubmit:d,setFocus:x,formState:{errors:p,isSubmitting:h,isDirty:C,isValid:E}}=k({mode:"onChange",values:{name:u||""}}),g=I.useId(),M=async function({name:j}){var b;try{if(a){const l=(b=n[0])==null?void 0:b.parentId,D=n[0].id;await c.mutate({folderId:D,parentId:l,name:j}),o(),e==null||e()}else{const l=(t==null?void 0:t.id)||R.DEFAULT;await m.mutate({name:j,parentId:l}),o(),e==null||e()}}catch(l){console.error(l)}};function $(){o(),i()}return{formId:`createModal_${g}`,errors:p,isSubmitting:h,isDirty:C,isValid:E,register:f,setFocus:x,handleSubmit:d,onCancel:$,onSubmit:M}}function Q({isOpen:a,edit:e,onSuccess:i,onCancel:n}){const{i18n:t}=w(),{isDirty:m,isValid:c,isSubmitting:u,formId:o,onSubmit:f,onCancel:d,handleSubmit:x,register:p,setFocus:h}=z({edit:e,onSuccess:i,onClose:n});return I.useEffect(()=>{a&&h("name")},[a]),P.createPortal(r.jsxs(s,{isOpen:a,onModalClose:d,id:"modal_"+o,children:[r.jsx(s.Header,{onModalClose:d,children:t(e?"explorer.rename.folder":"explorer.create.folder")}),r.jsx(s.Body,{children:r.jsx("form",{id:o,onSubmit:x(f),children:r.jsxs(U,{id:"nameFolder",isRequired:!0,children:[r.jsx(V,{children:t("explorer.create.folder.name")}),r.jsx(_,{type:"text",...p("name",{required:!0}),placeholder:t("explorer.create.folder.name"),size:"md","aria-required":!0})]})})}),r.jsxs(s.Footer,{children:[r.jsx(y,{color:"tertiary",onClick:d,type:"button",variant:"ghost",children:t("explorer.cancel")}),r.jsx(y,{form:o,type:"submit",color:"primary",variant:"filled",disabled:!m||!c||u,children:t(e?"explorer.rename":"explorer.create")})]})]}),document.getElementById("portal"))}export{Q as default};
1
+ import{G as D,N as B,O as q,P as L,r as C,Q as R,a as U,b as w,j as r,M as s,F as P,U as T,y as V,B as y}from"./index.js";import{u as _}from"./index.esm.js";function k({edit:a,onSuccess:e,onClose:i}){var F;const l=D(),t=B(),m=q(),c=L(),u=a?(F=l[0])==null?void 0:F.name:void 0,{reset:o,register:f,handleSubmit:n,setFocus:p,formState:{errors:x,isSubmitting:h,isDirty:I,isValid:E}}=_({mode:"onChange",values:{name:u||""}}),g=C.useId(),M=async function({name:b}){var j;try{if(a){const d=(j=l[0])==null?void 0:j.parentId,$=l[0].id;await c.mutate({folderId:$,parentId:d,name:b}),o(),e==null||e()}else{const d=(t==null?void 0:t.id)||R.DEFAULT;await m.mutate({name:b,parentId:d}),o(),e==null||e()}}catch(d){console.error(d)}};function v(){o(),i()}return{formId:`createModal_${g}`,errors:x,isSubmitting:h,isDirty:I,isValid:E,register:f,setFocus:p,handleSubmit:n,onCancel:v,onSubmit:M}}function N({isOpen:a,edit:e,onSuccess:i,onCancel:l}){const{t}=U(),{isDirty:m,isValid:c,isSubmitting:u,formId:o,onSubmit:f,onCancel:n,handleSubmit:p,register:x,setFocus:h}=k({edit:e,onSuccess:i,onClose:l});return C.useEffect(()=>{a&&h("name")},[a]),w.createPortal(r.jsxs(s,{isOpen:a,onModalClose:n,id:"modal_"+o,children:[r.jsx(s.Header,{onModalClose:n,children:t(e?"explorer.rename.folder":"explorer.create.folder")}),r.jsx(s.Body,{children:r.jsx("form",{id:o,onSubmit:p(f),children:r.jsxs(P,{id:"nameFolder",isRequired:!0,children:[r.jsx(T,{children:t("explorer.create.folder.name")}),r.jsx(V,{type:"text",...x("name",{required:!0,pattern:{value:/^\S/,message:"invalid title"}}),placeholder:t("explorer.create.folder.name"),size:"md","aria-required":!0})]})})}),r.jsxs(s.Footer,{children:[r.jsx(y,{color:"tertiary",onClick:n,type:"button",variant:"ghost",children:t("explorer.cancel")}),r.jsx(y,{form:o,type:"submit",color:"primary",variant:"filled",disabled:!m||!c||u,children:t(e?"explorer.rename":"explorer.create")})]})]}),document.getElementById("portal"))}export{N as default};
@@ -1 +1 @@
1
- import{u as T,j as e,H as A,n as E,F as m,x as P,U as G,B,W as J,e as K,i as Z,h as z,r as p,l as ee,X as se,a as te,M as C,Q as F,Y as le}from"./index.js";import{I as re}from"./ImagePicker.js";import{u as ae}from"./index.esm.js";const oe=({appCode:d,correctSlug:r,disableSlug:n,onPublicChange:a,onSlugChange:s,refPublic:c,refSlug:x,register:h,resource:t,slug:g,onCopyToClipBoard:u})=>{const{i18n:o}=T();return e.jsxs(e.Fragment,{children:[e.jsxs(A,{headingStyle:"h4",level:"h3",className:"mb-16",children:[o("explorer.resource.editModal.heading.access"),d]}),e.jsx(E,{type:"info",children:o("explorer.resource.editModal.access.alert")}),e.jsxs(m,{id:"flexSwitchCheckDefault",className:"form-switch d-flex gap-8 mt-16 mb-8",children:[e.jsx(m.Input,{type:"checkbox",role:"switch",...h("enablePublic",{value:t.public,onChange:i=>a(i.target.checked)}),className:"form-check-input mt-0",size:"md"},c),e.jsx(m.Label,{className:"form-check-label mb-0",children:o("explorer.resource.editModal.access.flexSwitchCheckDefault.label")})]}),e.jsx(m,{id:"slug",status:r?"invalid":void 0,children:e.jsxs("div",{className:"d-flex flex-wrap align-items-center gap-4",children:[e.jsxs("div",{children:[window.location.origin,window.location.pathname,"/pub/"]}),e.jsxs("div",{className:"flex-fill",children:[e.jsx(P,{type:"text",...h("safeSlug",{validate:{required:i=>!i&&!n?o("explorer.slug.name.mandatory"):!0},disabled:n,value:g,onChange:i=>s(i.target.value)}),size:"md",placeholder:o("explorer.resource.editModal.access.url.extension")},x),r&&e.jsx("div",{className:"position-absolute",children:e.jsx(G,{children:o("explorer.slug.name.error")})})]}),e.jsx(B,{color:"primary",disabled:n,onClick:()=>{u()},type:"button",leftIcon:e.jsx(J,{}),variant:"ghost",className:"text-nowrap",children:o("explorer.resource.editModal.access.url.button")})]})})]})};function ie({resource:d,onSuccess:r,onCancel:n}){const{i18n:a}=K(),s=Z(),c=z(),{reset:x,register:h,handleSubmit:t,setFocus:g,formState:{errors:u,isSubmitting:o,isValid:i}}=ae({mode:"onChange"}),I=p.useId(),[M,$]=p.useState(new Date().getTime()),[b,k]=p.useState(!d.public),[j,f]=p.useState(d.slug||""),[N,S]=p.useState(!1),{hotToast:v}=ee(E),[R,w]=p.useState({name:"",image:c[0].thumbnail}),_=l=>{w(l)},L=()=>{w({name:"",image:""})};function U(l){k(!l),l||(f(""),$(new Date().getTime()))}function V(l){if(!l)return"";const y="àáäâãåăæçèéëêǵḧìíïîḿńǹñòóöôœøṕŕßśșțùúüûǘẃẍÿź·/_,:;",Q="aaaaaaaaceeeeghiiiimnnnooooooprssstuuuuuwxyz------",W=new RegExp(y.split("").join("|"),"g"),X=l.toString().toLowerCase().replace(/\s+/g,"-").replace(W,Y=>Q.charAt(y.indexOf(Y))).replace(/&/g,"-and-").replace(/[^\w\\-]+/g,"").replace(/\\-\\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"");f(X)}const q=async function(l){try{await s.mutateAsync({description:l.description,entId:c[0].assetId,name:l.title,public:l.enablePublic,slug:l.safeSlug,trashed:c[0].trashed,thumbnail:R.image}),S(!1),v.success(e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:a("explorer.resource.updated")}),e.jsxs("p",{children:["Titre: ",l.title]}),e.jsxs("p",{children:["Description: ",l.description]}),e.jsxs("p",{children:["Public:"," ",l.enablePublic?a("explorer.enable.public.yes"):a("explorer.enable.public.no")]})]})),r==null||r()}catch(y){S(!0),console.error(y)}};function D(){navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}/pub/${j}`),v.success(a("explorer.copy.clipboard"))}function H(){x(),n()}const O=`resource_edit_modal_${I}`;return{slug:j,disableSlug:b,formId:O,errors:u,isSubmitting:o,isValid:i,versionSlug:M,correctSlug:N,onPublicChange:U,onSlugChange:V,register:h,setFocus:g,handleSubmit:t,onFormCancel:H,onSubmit:q,handleUploadImage:_,handleDeleteImage:L,onCopyToClipBoard:D}}function ue({isOpen:d,edit:r,onSuccess:n,onCancel:a}){const{i18n:s,appCode:c,currentApp:x}=T(),t=z()[0],{slug:g,formId:u,isValid:o,isSubmitting:i,disableSlug:I,versionSlug:M,correctSlug:$,register:b,handleSubmit:k,onSubmit:j,handleUploadImage:f,handleDeleteImage:N,onCopyToClipBoard:S,onSlugChange:v,onPublicChange:R}=ie({resource:t,onSuccess:n,onCancel:a}),{data:w}=se();return te.createPortal(e.jsxs(C,{id:"resource_edit_modal",size:"lg",isOpen:d,onModalClose:a,children:[e.jsx(C.Header,{onModalClose:a,children:s(r?"explorer.resource.editModal.header.edit":"explorer.resource.editModal.header.create")}),e.jsxs(C.Body,{children:[e.jsx(A,{headingStyle:"h4",level:"h3",className:"mb-16",children:s("explorer.resource.editModal.heading.general")}),e.jsxs("form",{id:u,onSubmit:k(j),children:[e.jsxs("div",{className:"d-flex flex-column flex-md-row gap-16 mb-24",children:[e.jsx(re,{app:x,src:t==null?void 0:t.thumbnail,label:s("explorer.imagepicker.label"),addButtonLabel:s("explorer.imagepicker.button.add"),deleteButtonLabel:s("explorer.imagepicker.button.delete"),onUploadImage:f,onDeleteImage:N,className:"align-self-center"}),e.jsxs("div",{className:"col",children:[e.jsxs(m,{id:"title",className:"mb-16",isRequired:!0,children:[e.jsx(F,{children:s("title")}),e.jsx(P,{type:"text",defaultValue:r?t==null?void 0:t.name:"",...b("title",{required:!0}),placeholder:s("explorer.resource.editModal.title.placeholder"),size:"md","aria-required":!0})]}),e.jsxs(m,{id:"description",isOptional:!0,children:[e.jsx(F,{children:s("description")}),e.jsx(P,{type:"text",defaultValue:r?t==null?void 0:t.description:"",...b("description"),placeholder:s("explorer.resource.editModal.description.placeholder"),size:"md"})]})]})]}),le({workflow:"createPublic",actions:w})&&e.jsx(oe,{appCode:c,correctSlug:$,disableSlug:I,onCopyToClipBoard:S,onPublicChange:R,onSlugChange:v,resource:t,slug:g,versionSlug:M,register:b})]})]}),e.jsxs(C.Footer,{children:[e.jsx(B,{color:"tertiary",onClick:a,type:"button",variant:"ghost",children:s("explorer.cancel")}),e.jsx(B,{form:u,type:"submit",color:"primary",variant:"filled",disabled:!o||i,children:s(r?"save":"explorer.create")})]})]}),document.getElementById("portal"))}export{ue as default};
1
+ import{a as B,j as e,H as A,p as E,F as x,y as P,W as G,B as T,X as J,k as K,i as z,r as m,m as Q,u as ee,Y as se,b as te,M as C,U as F,Z as le}from"./index.js";import{I as ae}from"./ImagePicker.js";import{u as re}from"./index.esm.js";const oe=({appCode:d,correctSlug:a,disableSlug:n,onPublicChange:r,onSlugChange:u,refPublic:c,refSlug:j,register:s,resource:h,slug:p,onCopyToClipBoard:g})=>{const{t:o}=B();return e.jsxs(e.Fragment,{children:[e.jsxs(A,{headingStyle:"h4",level:"h3",className:"mb-16",children:[o("explorer.resource.editModal.heading.access"),d]}),e.jsx(E,{type:"info",children:o("explorer.resource.editModal.access.alert")}),e.jsxs(x,{id:"flexSwitchCheckDefault",className:"form-switch d-flex gap-8 mt-16 mb-8",children:[e.jsx(x.Input,{type:"checkbox",role:"switch",...s("enablePublic",{value:h.public,onChange:i=>r(i.target.checked)}),className:"form-check-input mt-0",size:"md"},c),e.jsx(x.Label,{className:"form-check-label mb-0",children:o("explorer.resource.editModal.access.flexSwitchCheckDefault.label")})]}),e.jsx(x,{id:"slug",status:a?"invalid":void 0,children:e.jsxs("div",{className:"d-flex flex-wrap align-items-center gap-4",children:[e.jsxs("div",{children:[window.location.origin,window.location.pathname,"/pub/"]}),e.jsxs("div",{className:"flex-fill",children:[e.jsx(P,{type:"text",...s("safeSlug",{validate:{required:i=>!i&&!n?o("explorer.slug.name.mandatory"):!0},disabled:n,value:p,onChange:i=>u(i.target.value)}),size:"md",placeholder:o("explorer.resource.editModal.access.url.extension")},j),a&&e.jsx("div",{className:"position-absolute",children:e.jsx(G,{children:o("explorer.slug.name.error")})})]}),e.jsx(T,{color:"primary",disabled:n,onClick:()=>{g()},type:"button",leftIcon:e.jsx(J,{}),variant:"ghost",className:"text-nowrap",children:o("explorer.resource.editModal.access.url.button")})]})})]})};function ie({resource:d,onSuccess:a,onCancel:n}){const{t:r}=B(),u=K(),c=z(),{reset:j,register:s,handleSubmit:h,setFocus:p,formState:{errors:g,isSubmitting:o,isValid:i}}=re({mode:"onChange"}),I=m.useId(),[M,b]=m.useState(new Date().getTime()),[$,k]=m.useState(!d.public),[f,S]=m.useState(d.slug||""),[N,v]=m.useState(!1),{hotToast:y}=Q(E),[R,l]=m.useState({name:"",image:c[0].thumbnail}),_=t=>{l(t)},L=()=>{l({name:"",image:""})};function U(t){k(!t),t||(S(""),b(new Date().getTime()))}function V(t){if(!t)return"";const w="àáäâãåăæçèéëêǵḧìíïîḿńǹñòóöôœøṕŕßśșțùúüûǘẃẍÿź·/_,:;",W="aaaaaaaaceeeeghiiiimnnnooooooprssstuuuuuwxyz------",X=new RegExp(w.split("").join("|"),"g"),Y=t.toString().toLowerCase().replace(/\s+/g,"-").replace(X,Z=>W.charAt(w.indexOf(Z))).replace(/&/g,"-and-").replace(/[^\w\\-]+/g,"").replace(/\\-\\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"");S(Y)}const q=async function(t){try{await u.mutateAsync({description:t.description,entId:c[0].assetId,name:t.title,public:t.enablePublic,slug:t.safeSlug,trashed:c[0].trashed,thumbnail:R.image}),v(!1),y.success(e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:r("explorer.resource.updated")}),e.jsxs("p",{children:["Titre: ",t.title]}),e.jsxs("p",{children:["Description: ",t.description]}),e.jsxs("p",{children:["Public:"," ",t.enablePublic?r("explorer.enable.public.yes"):r("explorer.enable.public.no")]})]})),a==null||a()}catch(w){v(!0),console.error(w)}};function D(){navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}/pub/${f}`),y.success(r("explorer.copy.clipboard"))}function H(){j(),n()}const O=`resource_edit_modal_${I}`;return{slug:f,disableSlug:$,formId:O,errors:g,isSubmitting:o,isValid:i,versionSlug:M,correctSlug:N,onPublicChange:U,onSlugChange:V,register:s,setFocus:p,handleSubmit:h,onFormCancel:H,onSubmit:q,handleUploadImage:_,handleDeleteImage:L,onCopyToClipBoard:D}}function ue({isOpen:d,edit:a,onSuccess:n,onCancel:r}){const{appCode:u,currentApp:c}=ee(),s=z()[0],{slug:h,formId:p,isValid:g,isSubmitting:o,disableSlug:i,versionSlug:I,correctSlug:M,register:b,handleSubmit:$,onSubmit:k,handleUploadImage:f,handleDeleteImage:S,onCopyToClipBoard:N,onSlugChange:v,onPublicChange:y}=ie({resource:s,onSuccess:n,onCancel:r}),{data:R}=se(),{t:l}=B();return te.createPortal(e.jsxs(C,{id:"resource_edit_modal",size:"lg",isOpen:d,onModalClose:r,children:[e.jsx(C.Header,{onModalClose:r,children:l(a?"explorer.resource.editModal.header.edit":"explorer.resource.editModal.header.create")}),e.jsxs(C.Body,{children:[e.jsx(A,{headingStyle:"h4",level:"h3",className:"mb-16",children:l("explorer.resource.editModal.heading.general")}),e.jsxs("form",{id:p,onSubmit:$(k),children:[e.jsxs("div",{className:"d-flex flex-column flex-md-row gap-16 mb-24",children:[e.jsx(ae,{app:c,src:s==null?void 0:s.thumbnail,label:l("explorer.imagepicker.label"),addButtonLabel:l("explorer.imagepicker.button.add"),deleteButtonLabel:l("explorer.imagepicker.button.delete"),onUploadImage:f,onDeleteImage:S,className:"align-self-center"}),e.jsxs("div",{className:"col",children:[e.jsxs(x,{id:"title",className:"mb-16",isRequired:!0,children:[e.jsx(F,{children:l("title")}),e.jsx(P,{type:"text",defaultValue:a?s==null?void 0:s.name:"",...b("title",{required:!0,pattern:{value:/^\S/,message:"invalid title"}}),placeholder:l("explorer.resource.editModal.title.placeholder"),size:"md","aria-required":!0})]}),u!=="blog"?e.jsxs(x,{id:"description",isOptional:!0,children:[e.jsx(F,{children:l("description")}),e.jsx(P,{type:"text",defaultValue:a?s==null?void 0:s.description:"",...b("description"),placeholder:l("explorer.resource.editModal.description.placeholder"),size:"md"})]}):null]})]}),le({workflow:"createPublic",actions:R})&&e.jsx(oe,{appCode:u,correctSlug:M,disableSlug:i,onCopyToClipBoard:N,onPublicChange:y,onSlugChange:v,resource:s,slug:h,versionSlug:I,register:b})]})]}),e.jsxs(C.Footer,{children:[e.jsx(T,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:l("explorer.cancel")}),e.jsx(T,{form:p,type:"submit",color:"primary",variant:"filled",disabled:!g||o,children:l(a?"save":"explorer.create")})]})]}),document.getElementById("portal"))}export{ue as default};
@@ -1 +1 @@
1
- import{u as s,X as n,j as a}from"./index.js";import{E as c}from"./EmptyScreen.js";function d(){const{i18n:r,appCode:o,theme:e}=s(),{data:l}=n(),t=l==null?void 0:l.find(i=>i.id==="create"),p=()=>t!=null&&t.available&&(e!=null&&e.is1d)?r("explorer.emptyScreen.blog.txt1d.create"):t!=null&&t.available&&!(e!=null&&e.is1d)?r("explorer.emptyScreen.blog.txt2d.create"):!(t!=null&&t.available)&&(e!=null&&e.is1d)?r("explorer.emptyScreen.blog.txt1d.consultation"):r("explorer.emptyScreen.blog.txt2d.consultation");return a.jsx(c,{imageSrc:`${e==null?void 0:e.bootstrapPath}/images/emptyscreen/illu-${o}.svg`,imageAlt:r("explorer.emptyScreen.app.alt"),title:`${t!=null&&t.available?r("explorer.emptyScreen.blog.title.create"):r("explorer.emptyScreen.blog.title.consultation")}`,text:p()})}export{d as default};
1
+ import{u as i,a as n,Y as a,j as c}from"./index.js";import{E as u}from"./EmptyScreen.js";function b(){const{appCode:o,theme:e}=i(),{t:r}=n(),{data:l}=a(),t=l==null?void 0:l.find(s=>s.id==="create"),p=()=>t!=null&&t.available&&(e!=null&&e.is1d)?r("explorer.emptyScreen.blog.txt1d.create"):t!=null&&t.available&&!(e!=null&&e.is1d)?r("explorer.emptyScreen.blog.txt2d.create"):!(t!=null&&t.available)&&(e!=null&&e.is1d)?r("explorer.emptyScreen.blog.txt1d.consultation"):r("explorer.emptyScreen.blog.txt2d.consultation");return c.jsx(u,{imageSrc:`${e==null?void 0:e.bootstrapPath}/images/emptyscreen/illu-${o}.svg`,imageAlt:r("explorer.emptyScreen.app.alt"),title:`${t!=null&&t.available?r("explorer.emptyScreen.blog.title.create"):r("explorer.emptyScreen.blog.title.consultation")}`,text:p()})}export{b as default};
@@ -1 +1 @@
1
- import{u as r,j as n}from"./index.js";import{E as o}from"./EmptyScreen.js";function p(){const{i18n:t,theme:e}=r();return n.jsx(o,{imageSrc:`${e==null?void 0:e.bootstrapPath}/images/emptyscreen/illu-noContentInFolder.svg`,imageAlt:t("explorer.emptyScreen.folder.empty.alt"),text:t("explorer.emptyScreen.label")})}export{p as default};
1
+ import{u as r,a as n,j as o}from"./index.js";import{E as s}from"./EmptyScreen.js";function m(){const{theme:e}=r(),{t}=n();return o.jsx(s,{imageSrc:`${e==null?void 0:e.bootstrapPath}/images/emptyscreen/illu-no-content-in-folder.svg`,imageAlt:t("explorer.emptyScreen.folder.empty.alt"),text:t("explorer.emptyScreen.label")})}export{m as default};
@@ -1 +1 @@
1
- import{u as r,j as s}from"./index.js";import{E as a}from"./EmptyScreen.js";function n(){const{i18n:e,theme:t}=r();return s.jsx(a,{imageSrc:`${t==null?void 0:t.bootstrapPath}/images/emptyscreen/illu-trash.svg`,imageAlt:e("explorer.emptyScreen.trash.alt"),title:e("explorer.emptyScreen.trash.title"),text:e("explorer.emptyScreen.trash.empty")})}export{n as default};
1
+ import{u as r,a,j as n}from"./index.js";import{E as o}from"./EmptyScreen.js";function i(){const{appCode:s}=r(),{theme:e}=r(),{t}=a();return n.jsx(o,{imageSrc:`${e==null?void 0:e.bootstrapPath}/images/emptyscreen/illu-trash.svg`,imageAlt:t("explorer.emptyScreen.trash.alt"),title:t("explorer.emptyScreen.trash.title"),text:t("explorer.emptyScreen.trash.empty",{ns:s})})}export{i as default};
@@ -1 +1 @@
1
- import{u as x,a8 as h,E as j,a9 as f,b as y,aa as C,j as o,_ as a}from"./index.js";import{C as I}from"./Card.js";import"./Tooltip.js";import"./usePopper.js";const N=()=>{var c,d;const{currentApp:p}=x(),{data:e,isFetching:u}=h(),n=j(),i=f(),{setSelectedFolders:l,setFolderIds:r,openFolder:m}=y();function g(s){i.includes(s.id)?(r(i.filter(t=>t!==s.id)),l(n.filter(t=>t.id!==s.id))):(r([...i,s.id]),l([...n,s]))}const F=C({from:{opacity:0},to:{opacity:1}});return(c=e==null?void 0:e.pages[0])!=null&&c.folders.length?o.jsx(a.ul,{className:"grid ps-0 list-unstyled mb-24",children:(d=e==null?void 0:e.pages[0])==null?void 0:d.folders.map(s=>{const{id:t,name:S}=s;return o.jsx(a.li,{className:"g-col-4",style:{...F},children:o.jsx(I,{app:p,name:S,isFolder:!0,isLoading:u,isSelected:i.includes(s.id),onOpen:()=>m({folder:s,folderId:s.id}),onSelect:()=>g(s)})},t)})}):null};export{N as default};
1
+ import{u as x,a9 as h,G as j,aa as f,c as y,ab as C,j as o,$ as a}from"./index.js";import{C as I}from"./Card.js";import"./Tooltip.js";import"./usePopper.js";const O=()=>{var c,d;const{currentApp:p}=x(),{data:e,isFetching:u}=h(),n=j(),i=f(),{setSelectedFolders:l,setFolderIds:r,openFolder:m}=y();function g(s){i.includes(s.id)?(r(i.filter(t=>t!==s.id)),l(n.filter(t=>t.id!==s.id))):(r([...i,s.id]),l([...n,s]))}const F=C({from:{opacity:0},to:{opacity:1}});return(c=e==null?void 0:e.pages[0])!=null&&c.folders.length?o.jsx(a.ul,{className:"grid ps-0 list-unstyled mb-24",children:(d=e==null?void 0:e.pages[0])==null?void 0:d.folders.map(s=>{const{id:t,name:S}=s;return o.jsx(a.li,{className:"g-col-4",style:{...F},children:o.jsx(I,{app:p,name:S,isFolder:!0,isLoading:u,isSelected:i.includes(s.id),onOpen:()=>m({folder:s,folderId:s.id}),onSelect:()=>g(s)})},t)})}):null};export{O as default};
@@ -1 +1 @@
1
- import{r as s,d as R,j as a,F as d,s as p,a5 as L,a6 as E,x as N,p as S,a7 as z}from"./index.js";const u=s.forwardRef(({label:h,addButtonLabel:x="Add image",deleteButtonLabel:v="Delete image",src:j,className:f,app:D,onUploadImage:C,onDeleteImage:I},P)=>{const r=s.useRef(null),[n,o]=s.useState({name:"",image:j||""}),[,l]=s.useState(!1),c=e=>{o({...n,name:"",image:""});const t=e==null?void 0:e[0];if(!t)return;const i={...n,name:t.name,image:URL.createObjectURL(t)};o(i),C(i)},$=()=>{var e;(e=r.current)==null||e.click()},b=()=>{r.current&&(r.current.value="");const e={...n,name:"",image:""};o(e),I()},k=e=>{c(e.target.files)},g=e=>{e.preventDefault(),e.stopPropagation(),l(!0)},m=e=>{e.preventDefault(),e.stopPropagation(),l(!1)},w=e=>{var i;m(e);const t=(i=e.dataTransfer)==null?void 0:i.files;c(t),r.current&&t&&(r.current.files=t)},y=R("image-input",f);return a.jsxs(d,{id:"image-input",className:y,onDragEnter:g,onDragOver:g,onDragLeave:m,onDrop:w,ref:P,children:[a.jsxs("div",{className:"image-input-actions gap-8",children:[a.jsx(p,{"aria-label":x,color:"tertiary",icon:a.jsx(L,{}),onClick:$,type:"button",variant:"ghost"}),a.jsx(p,{"aria-label":v,color:"danger",disabled:!n.image,icon:a.jsx(E,{width:"20",height:"20"}),onClick:b,type:"button",variant:"ghost"})]}),a.jsxs(d.Label,{children:[a.jsx("span",{className:"visually-hidden",children:h}),a.jsx(N,{accept:"image/*",hidden:!0,onChange:k,ref:r,size:"sm",type:"file"}),n.image?a.jsx(S,{alt:n.name,src:n.image,size:"xl"}):a.jsx(z,{app:D,iconFit:"ratio",size:"160",variant:"rounded"})]})]})});u.displayName="ImagePicker";const F=u;export{F as I};
1
+ import{r as s,f as R,j as a,F as d,t as p,a6 as L,a7 as E,y as N,q as S,a8 as z}from"./index.js";const u=s.forwardRef(({label:h,addButtonLabel:x="Add image",deleteButtonLabel:v="Delete image",src:j,className:f,app:D,onUploadImage:C,onDeleteImage:I},P)=>{const r=s.useRef(null),[n,o]=s.useState({name:"",image:j||""}),[,l]=s.useState(!1),c=e=>{o({...n,name:"",image:""});const t=e==null?void 0:e[0];if(!t)return;const i={...n,name:t.name,image:URL.createObjectURL(t)};o(i),C(i)},$=()=>{var e;(e=r.current)==null||e.click()},b=()=>{r.current&&(r.current.value="");const e={...n,name:"",image:""};o(e),I()},k=e=>{c(e.target.files)},g=e=>{e.preventDefault(),e.stopPropagation(),l(!0)},m=e=>{e.preventDefault(),e.stopPropagation(),l(!1)},w=e=>{var i;m(e);const t=(i=e.dataTransfer)==null?void 0:i.files;c(t),r.current&&t&&(r.current.files=t)},y=R("image-input",f);return a.jsxs(d,{id:"image-input",className:y,onDragEnter:g,onDragOver:g,onDragLeave:m,onDrop:w,ref:P,children:[a.jsxs("div",{className:"image-input-actions gap-8",children:[a.jsx(p,{"aria-label":x,color:"tertiary",icon:a.jsx(L,{}),onClick:$,type:"button",variant:"ghost"}),a.jsx(p,{"aria-label":v,color:"danger",disabled:!n.image,icon:a.jsx(E,{width:"20",height:"20"}),onClick:b,type:"button",variant:"ghost"})]}),a.jsxs(d.Label,{children:[a.jsx("span",{className:"visually-hidden",children:h}),a.jsx(N,{accept:"image/*",hidden:!0,onChange:k,ref:r,size:"sm",type:"file"}),n.image?a.jsx(S,{alt:n.name,src:n.image,size:"xl"}):a.jsx(z,{app:D,iconFit:"ratio",size:"160",variant:"rounded"})]})]})});u.displayName="ImagePicker";const F=u;export{F as I};
package/dist/Library.js CHANGED
@@ -1 +1 @@
1
- import{r as n,j as r,I as c,B as x,c as d,u as m}from"./index.js";const t=n.forwardRef(({text:s,textButton:a,src:e,alt:i,url:l},o)=>r.jsx(r.Fragment,{children:r.jsxs("div",{ref:o,className:"p-16",children:[r.jsx(c,{width:"270",height:"140",loading:"lazy",className:"rounded",src:e,alt:i}),r.jsx("p",{className:"m-8",children:s}),r.jsx("a",{href:l,target:"_blank",rel:"noreferrer",children:r.jsx(x,{rightIcon:r.jsx(d,{}),className:"py-0 px-8",variant:"ghost",color:"primary",children:a})})]})}));t.displayName="Library";const p=t,h=({url:s})=>{const{i18n:a,theme:e}=m();return r.jsx(p,{src:`${e==null?void 0:e.bootstrapPath}/images/image-library.svg`,url:s,alt:a("explorer.libray.img.alt"),text:a("explorer.libray.title"),textButton:a("explorer.libray.btn")})};export{h as default};
1
+ import{r as n,j as r,I as c,B as x,d as m,a as d,e as p}from"./index.js";const t=n.forwardRef(({text:e,textButton:a,src:s,alt:i,url:l},o)=>r.jsx(r.Fragment,{children:r.jsxs("div",{ref:o,className:"p-16",children:[r.jsx(c,{width:"270",height:"140",loading:"lazy",className:"rounded",src:s,alt:i}),r.jsx("p",{className:"m-8",children:e}),r.jsx("a",{href:l,target:"_blank",rel:"noreferrer",children:r.jsx(x,{rightIcon:r.jsx(m,{}),className:"py-0 px-8",variant:"ghost",color:"primary",children:a})})]})}));t.displayName="Library";const g=t,y=({url:e})=>{const{t:a}=d(),{theme:s}=p();return r.jsx(g,{src:`${s==null?void 0:s.bootstrapPath}/images/image-library.svg`,url:e,alt:a("explorer.libray.img.alt"),text:a("explorer.libray.title"),textButton:a("explorer.libray.btn")})};export{y as default};
package/dist/MoveModal.js CHANGED
@@ -1 +1 @@
1
- import{r as p,D as v,E as M,h as T,b as y,G as b,u as j,J as F,a as S,j as o,M as n,T as w,B as x}from"./index.js";function E({onSuccess:a}){const[s,r]=p.useState(),l=v(),d=M(),i=T(),{foldTreeItem:c,unfoldTreeItem:m}=y(),u=b();async function f(){try{if(!s)throw new Error("explorer.move.selection.empty");await l.mutate(s),await(a==null?void 0:a())}catch(e){console.error(e)}}const I=e=>{var h;for(const t of d)if(e===t.id||e===t.parentId)return!1;for(const t of i)if(e===((t==null?void 0:t.folderIds)&&t.folderIds[0])||((h=t==null?void 0:t.folderIds)==null?void 0:h.length)===0&&e==="default")return!1;return!0};return{disableSubmit:!s,handleTreeItemSelect:e=>{I(e)?r(e):r(void 0)},handleTreeItemFold:c,handleTreeItemUnfold:async e=>await m(e,u),onMove:()=>{f()}}}function C({isOpen:a,onSuccess:s,onCancel:r}){const{i18n:l}=j(),{handleTreeItemFold:d,handleTreeItemSelect:i,handleTreeItemUnfold:c,onMove:m,disableSubmit:u}=E({onSuccess:s}),f=F();return S.createPortal(o.jsxs(n,{isOpen:a,onModalClose:r,id:"moveModal",children:[o.jsx(n.Header,{onModalClose:r,children:l("explorer.move.title")}),o.jsx(n.Subtitle,{children:l("explorer.move.subtitle")}),o.jsx(n.Body,{children:o.jsx(w,{data:f,onTreeItemSelect:i,onTreeItemFold:d,onTreeItemUnfold:c})}),o.jsxs(n.Footer,{children:[o.jsx(x,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:l("explorer.cancel")}),o.jsx(x,{color:"primary",onClick:m,type:"button",variant:"filled",disabled:u,children:l("explorer.move")})]})]}),document.getElementById("portal"))}export{C as default};
1
+ import{r as p,E as v,G as T,i as M,c as y,J as b,a as j,K as F,b as S,j as o,M as n,T as w,B as h}from"./index.js";function E({onSuccess:a}){const[s,r]=p.useState(),l=v(),d=T(),c=M(),{foldTreeItem:i,unfoldTreeItem:m}=y(),u=b();async function f(){try{if(!s)throw new Error("explorer.move.selection.empty");await l.mutate(s),await(a==null?void 0:a())}catch(e){console.error(e)}}const I=e=>{var x;for(const t of d)if(e===t.id||e===t.parentId)return!1;for(const t of c)if(e===((t==null?void 0:t.folderIds)&&t.folderIds[0])||((x=t==null?void 0:t.folderIds)==null?void 0:x.length)===0&&e==="default")return!1;return!0};return{disableSubmit:!s,handleTreeItemSelect:e=>{I(e)?r(e):r(void 0)},handleTreeItemFold:i,handleTreeItemUnfold:async e=>await m(e,u),onMove:()=>{f()}}}function g({isOpen:a,onSuccess:s,onCancel:r}){const{t:l}=j(),{handleTreeItemFold:d,handleTreeItemSelect:c,handleTreeItemUnfold:i,onMove:m,disableSubmit:u}=E({onSuccess:s}),f=F();return S.createPortal(o.jsxs(n,{isOpen:a,onModalClose:r,id:"moveModal",children:[o.jsx(n.Header,{onModalClose:r,children:l("explorer.move.title")}),o.jsx(n.Subtitle,{children:l("explorer.move.subtitle")}),o.jsx(n.Body,{children:o.jsx(w,{data:f,onTreeItemSelect:c,onTreeItemFold:d,onTreeItemUnfold:i})}),o.jsxs(n.Footer,{children:[o.jsx(h,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:l("explorer.cancel")}),o.jsx(h,{color:"primary",onClick:m,type:"button",variant:"filled",disabled:u,children:l("explorer.move")})]})]}),document.getElementById("portal"))}export{g as default};