ode-explorer 1.0.0-develop-b2school.202306201556 → 1.0.0-develop-pedago.202307262104

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
@@ -9,7 +9,7 @@ Explorer App
9
9
  Without Docker, you need to generate a `package.json`
10
10
 
11
11
  ```bash
12
- node scripts/package.js
12
+ node scripts/package.cjs
13
13
  ```
14
14
 
15
15
  Install all dependencies.
@@ -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/Card.js CHANGED
@@ -1 +1 @@
1
- import{r as E,e as a,c as e,t as F,ab as U,ac as q,ad as G,ae as D,af as H,I as J,a5 as K,q as M,ag as Q}from"./index.js";import{T as n}from"./Tooltip.js";const d=E.forwardRef(({app:t,className:h,creatorName:r="tom.mate",isAnimated:x=!1,isFolder:l=!1,isLoading:s=!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:b,...f},$)=>{const{getIconCode:w}=D(),C=a("card",{"placeholder-glow":s,"is-selected":m,"is-animated":x},h),y=a("card-title body text-break text-truncate text-truncate--2 pe-16",{placeholder:s}),I=a("card-text small",{placeholder:s}),O=a("small text-truncate",{placeholder:s}),T=a("d-inline-flex align-items-center gap-8 text-truncate",{placeholder:s}),z=t?w(t):"placeholder",P=a(`color-app-${z}`,{placeholder:s});function k(B){B.stopPropagation(),c==null||c()}const A=l?e.jsx(H,{width:"48",height:"48",className:P}):i?e.jsx("div",{className:"card-image",children:e.jsx(J,{alt:"",src:i,width:"80",height:"80",objectFit:"cover",className:"h-full"})}):e.jsx(K,{app:t,iconFit:"ratio",size:"80",variant:"rounded"}),R=o?e.jsx(M,{alt:r,size:"xs",src:o,variant:"circle",width:"24",height:"24"}):e.jsx(Q,{});return e.jsxs("div",{ref:$,className:C,...f,children:[!s&&e.jsx(F,{"aria-label":"Open Action Bar",className:"z-3",color:"secondary",icon:e.jsx(U,{}),onClick:k,variant:"ghost"}),e.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"}),e.jsxs("div",{className:"card-body",children:[A,e.jsxs("div",{children:[e.jsx("h3",{className:y,children:e.jsx("strong",{children:g})}),l?null:e.jsx("p",{className:"card-text small",children:e.jsx("em",{className:I,children:v})})]})]}),l?null:e.jsxs("div",{className:"card-footer gap-16",children:[e.jsxs("div",{className:T,children:[R,e.jsx("p",{className:O,children:r})]}),e.jsxs("div",{className:"d-inline-flex align-items-center gap-8",children:[j&&e.jsx(n,{message:N,placement:"top",children:e.jsx(q,{width:16,height:16})}),p&&e.jsx(n,{message:b,placement:"top",children:e.jsx(G,{width:16,height:16})})]})]})]})});d.displayName="Card";const W=d;export{W as C};
1
+ import{r as R,d as a,j as s,q as B,ac as E,ad as F,I as q,a6 as G,n as U,ae as D,af as H,ag as J,ah 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{f as u,z as h,C as x,D as p,m,p as f,u as j,a as y,j as e,M as n,B as i}from"./index.js";function D({onSuccess:s}){const{i18n:l}=u(),o=h(),t=x(),r=p(),{hotToast:a}=m(f);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}=D({onSuccess:l});return y.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,x as h,y as u,z as p,k as m,m as y,b as j,j as e,M as n,B as i}from"./index.js";function f({onSuccess:o}){const{t:l}=d(),s=h(),t=u(),r=p(),{hotToast:a}=m(y);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(x){console.error(x)}}return{isTrashFolder:r,onDelete:c}}function T({isOpen:o,onSuccess:l=()=>({}),onCancel:s=()=>({})}){const{t}=d(),{isTrashFolder:r,onDelete:a}=f({onSuccess:l});return j.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{T as default};
@@ -1 +1 @@
1
- import{G as v,N as B,O as q,P as L,r as I,Q as R,f as U,a as w,j as r,M as s,F as P,U as V,y as _,B as b}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:p,formState:{errors:x,isSubmitting:h,isDirty:C,isValid:E}}=k({mode:"onChange",values:{name:u||""}}),g=I.useId(),M=async function({name:j}){var y;try{if(a){const l=(y=n[0])==null?void 0:y.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:x,isSubmitting:h,isDirty:C,isValid:E,register:f,setFocus:p,handleSubmit:d,onCancel:$,onSubmit:M}}function Q({isOpen:a,edit:e,onSuccess:i,onCancel:n}){const{i18n:t}=U(),{isDirty:m,isValid:c,isSubmitting:u,formId:o,onSubmit:f,onCancel:d,handleSubmit:p,register:x,setFocus:h}=z({edit:e,onSuccess:i,onClose:n});return I.useEffect(()=>{a&&h("name")},[a]),w.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:p(f),children:r.jsxs(P,{id:"nameFolder",isRequired:!0,children:[r.jsx(V,{children:t("explorer.create.folder.name")}),r.jsx(_,{type:"text",...x("name",{required:!0}),placeholder:t("explorer.create.folder.name"),size:"md","aria-required":!0})]})})}),r.jsxs(s.Footer,{children:[r.jsx(b,{color:"tertiary",onClick:d,type:"button",variant:"ghost",children:t("explorer.cancel")}),r.jsx(b,{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{D as $,J as B,K as q,N as w,r as C,O as L,a as R,b as P,j as r,M as s,F as T,P as U,w 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=$(),t=B(),m=q(),c=w(),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,D=l[0].id;await c.mutate({folderId:D,parentId:d,name:b}),o(),e==null||e()}else{const d=(t==null?void 0:t.id)||L.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 K({isOpen:a,edit:e,onSuccess:i,onCancel:l}){const{t}=R(),{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]),P.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(T,{id:"nameFolder",isRequired:!0,children:[r.jsx(U,{children:t("explorer.create.folder.name")}),r.jsx(V,{type:"text",...x("name",{required:!0,pattern:{value:/[^ ]/,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{K as default};
@@ -1 +1 @@
1
- import{f as J,k as K,i as z,r as c,m as Q,j as e,p as D,u as Y,a as Z,M as y,H as _,F as d,U as E,y as P,W as ee,B,X as se}from"./index.js";import{I as le}from"./ImagePicker.js";import{u as te}from"./index.esm.js";function re({resource:p,onSuccess:a,onCancel:v}){const{i18n:r}=J(),s=K(),u=z(),{reset:C,register:F,handleSubmit:t,setFocus:w,formState:{errors:m,isSubmitting:I,isValid:$}}=te({mode:"onChange"}),i=c.useId(),[M,x]=c.useState(new Date().getTime()),[n,k]=c.useState(!p.public),[g,h]=c.useState(p.slug||""),[N,b]=c.useState(!1),{hotToast:f}=Q(D),[R,j]=c.useState({name:"",image:u[0].thumbnail}),T=l=>{j(l)},o=()=>{j({name:"",image:""})};function L(l){k(!l),l||(h(""),x(new Date().getTime()))}function U(l){if(!l)return"";const S="àáäâãåăæçèéëêǵḧìíïîḿńǹñòóöôœøṕŕßśșțùúüûǘẃẍÿź·/_,:;",O="aaaaaaaaceeeeghiiiimnnnooooooprssstuuuuuwxyz------",W=new RegExp(S.split("").join("|"),"g"),X=l.toString().toLowerCase().replace(/\s+/g,"-").replace(W,G=>O.charAt(S.indexOf(G))).replace(/&/g,"-and-").replace(/[^\w\\-]+/g,"").replace(/\\-\\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"");h(X)}const V=async function(l){try{await s.mutateAsync({description:l.description,entId:u[0].assetId,name:l.title,public:l.enablePublic,slug:l.safeSlug,trashed:u[0].trashed,thumbnail:R.image}),b(!1),f.success(e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:r("explorer.resource.updated")}),e.jsxs("p",{children:["Titre: ",l.title]}),e.jsxs("p",{children:["Description: ",l.description]}),e.jsxs("p",{children:["Public:"," ",l.enablePublic?r("explorer.enable.public.yes"):r("explorer.enable.public.no")]})]})),a==null||a()}catch(S){b(!0),console.error(S)}};function q(){navigator.clipboard.writeText(`${window.location.origin}/${g}`),f.success(r("explorer.copy.clipboard"))}function A(){C(),v()}const H=`resource_edit_modal_${i}`;return{slug:g,disableSlug:n,formId:H,errors:m,isSubmitting:I,isValid:$,versionSlug:M,correctSlug:N,onPublicChange:L,onSlugChange:U,register:F,setFocus:w,handleSubmit:t,onFormCancel:A,onSubmit:V,handleUploadImage:T,handleDeleteImage:o,onCopyToClipBoard:q}}function ne({isOpen:p,edit:a,onSuccess:v,onCancel:r}){const{i18n:s,appCode:u,currentApp:C}=Y(),t=z()[0],{slug:w,formId:m,isValid:I,isSubmitting:$,disableSlug:i,versionSlug:M,correctSlug:x,register:n,handleSubmit:k,onSubmit:g,handleUploadImage:h,handleDeleteImage:N,onCopyToClipBoard:b,onSlugChange:f,onPublicChange:R}=re({resource:t,onSuccess:v,onCancel:r}),j=`${new Date().getTime()}_${i}`,T=`${M}_slug`;return Z.createPortal(e.jsxs(y,{id:"resource_edit_modal",size:"lg",isOpen:p,onModalClose:r,children:[e.jsx(y.Header,{onModalClose:r,children:s(a?"explorer.resource.editModal.header.edit":"explorer.resource.editModal.header.create")}),e.jsxs(y.Body,{children:[e.jsx(_,{headingStyle:"h4",level:"h3",className:"mb-16",children:s("explorer.resource.editModal.heading.general")}),e.jsxs("form",{id:m,onSubmit:k(g),children:[e.jsxs("div",{className:"d-flex flex-column flex-md-row gap-16 mb-24",children:[e.jsx(le,{app:C,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:h,onDeleteImage:N,className:"align-self-center"}),e.jsxs("div",{className:"col",children:[e.jsxs(d,{id:"title",className:"mb-16",isRequired:!0,children:[e.jsx(E,{children:s("title")}),e.jsx(P,{type:"text",defaultValue:a?t==null?void 0:t.name:"",...n("title",{required:!0}),placeholder:s("explorer.resource.editModal.title.placeholder"),size:"md","aria-required":!0})]}),e.jsxs(d,{id:"description",isOptional:!0,children:[e.jsx(E,{children:s("description")}),e.jsx(P,{type:"text",defaultValue:a?t==null?void 0:t.description:"",...n("description"),placeholder:s("explorer.resource.editModal.description.placeholder"),size:"md"})]})]})]}),e.jsxs(_,{headingStyle:"h4",level:"h3",className:"mb-16",children:[s("explorer.resource.editModal.heading.access"),u]}),e.jsx(D,{type:"info",children:s("explorer.resource.editModal.access.alert")}),e.jsxs(d,{id:"flexSwitchCheckDefault",className:"form-switch d-flex gap-8 mt-16 mb-8",children:[e.jsx(d.Input,{type:"checkbox",role:"switch",...n("enablePublic",{value:t.public,onChange:o=>R(o.target.checked)}),className:"form-check-input mt-0",size:"md"},j),e.jsx(d.Label,{className:"form-check-label mb-0",children:s("explorer.resource.editModal.access.flexSwitchCheckDefault.label")})]}),e.jsx(d,{id:"slug",status:x?"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,"/"]}),e.jsxs("div",{className:"flex-fill",children:[e.jsx(P,{type:"text",...n("safeSlug",{validate:{required:o=>!o&&!i?s("explorer.slug.name.mandatory"):!0},disabled:i,value:w,onChange:o=>f(o.target.value)}),size:"md",placeholder:s("explorer.resource.editModal.access.url.extension")},T),x&&e.jsx("div",{className:"position-absolute",children:e.jsx(ee,{children:s("explorer.slug.name.error")})})]}),e.jsx(B,{color:"primary",disabled:i,onClick:()=>{b(t.slug)},type:"button",leftIcon:e.jsx(se,{}),variant:"ghost",className:"text-nowrap",children:s("explorer.resource.editModal.access.url.button")})]})})]})]}),e.jsxs(y.Footer,{children:[e.jsx(B,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:s("explorer.cancel")}),e.jsx(B,{form:m,type:"submit",color:"primary",variant:"filled",disabled:!I||$,children:s(a?"save":"explorer.create")})]})]}),document.getElementById("portal"))}export{ne as default};
1
+ import{a as B,j as e,m as A,F as m,w as R,Q as J,B as T,U as K,h as Y,g as E,r as p,k as Z,u as ee,W as se,b as te,M as C,P as F,X as le}from"./index.js";import{H as z}from"./Heading.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:x,refPublic:c,refSlug:f,register:s,resource:h,slug:u,onCopyToClipBoard:g})=>{const{t:o}=B();return e.jsxs(e.Fragment,{children:[e.jsxs(z,{headingStyle:"h4",level:"h3",className:"mb-16",children:[o("explorer.resource.editModal.heading.access"),d]}),e.jsx(A,{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",...s("enablePublic",{value:h.public,onChange:i=>r(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: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(R,{type:"text",...s("safeSlug",{validate:{required:i=>!i&&!n?o("explorer.slug.name.mandatory"):!0},disabled:n,value:u,onChange:i=>x(i.target.value)}),size:"md",placeholder:o("explorer.resource.editModal.access.url.extension")},f),a&&e.jsx("div",{className:"position-absolute",children:e.jsx(J,{children:o("explorer.slug.name.error")})})]}),e.jsx(T,{color:"primary",disabled:n,onClick:()=>{g()},type:"button",leftIcon:e.jsx(K,{}),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(),x=Y(),c=E(),{reset:f,register:s,handleSubmit:h,setFocus:u,formState:{errors:g,isSubmitting:o,isValid:i}}=re({mode:"onChange"}),I=p.useId(),[M,b]=p.useState(new Date().getTime()),[$,k]=p.useState(!d.public),[j,v]=p.useState(d.slug||""),[N,S]=p.useState(!1),{hotToast:w}=Z(A),[P,l]=p.useState({name:"",image:c[0].thumbnail}),_=t=>{l(t)},L=()=>{l({name:"",image:""})};function U(t){k(!t),t||(v(""),b(new Date().getTime()))}function V(t){if(!t)return"";const y="àáäâãåăæçèéëêǵḧìíïîḿńǹñòóöôœøṕŕßśșțùúüûǘẃẍÿź·/_,:;",Q="aaaaaaaaceeeeghiiiimnnnooooooprssstuuuuuwxyz------",W=new RegExp(y.split("").join("|"),"g"),X=t.toString().toLowerCase().replace(/\s+/g,"-").replace(W,G=>Q.charAt(y.indexOf(G))).replace(/&/g,"-and-").replace(/[^\w\\-]+/g,"").replace(/\\-\\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"");v(X)}const q=async function(t){try{await x.mutateAsync({description:t.description,entId:c[0].assetId,name:t.title,public:t.enablePublic,slug:t.safeSlug,trashed:c[0].trashed,thumbnail:P.image}),S(!1),w.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(y){S(!0),console.error(y)}};function D(){navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}/pub/${j}`),w.success(r("explorer.copy.clipboard"))}function H(){f(),n()}const O=`resource_edit_modal_${I}`;return{slug:j,disableSlug:$,formId:O,errors:g,isSubmitting:o,isValid:i,versionSlug:M,correctSlug:N,onPublicChange:U,onSlugChange:V,register:s,setFocus:u,handleSubmit:h,onFormCancel:H,onSubmit:q,handleUploadImage:_,handleDeleteImage:L,onCopyToClipBoard:D}}function pe({isOpen:d,edit:a,onSuccess:n,onCancel:r}){const{appCode:x,currentApp:c}=ee(),s=E()[0],{slug:h,formId:u,isValid:g,isSubmitting:o,disableSlug:i,versionSlug:I,correctSlug:M,register:b,handleSubmit:$,onSubmit:k,handleUploadImage:j,handleDeleteImage:v,onCopyToClipBoard:N,onSlugChange:S,onPublicChange:w}=ie({resource:s,onSuccess:n,onCancel:r}),{data:P}=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(z,{headingStyle:"h4",level:"h3",className:"mb-16",children:l("explorer.resource.editModal.heading.general")}),e.jsxs("form",{id:u,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:j,onDeleteImage:v,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:l("title")}),e.jsx(R,{type:"text",defaultValue:a?s==null?void 0:s.name:"",...b("title",{required:!0,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:l("explorer.resource.editModal.title.placeholder"),size:"md","aria-required":!0})]}),e.jsxs(m,{id:"description",isOptional:!0,children:[e.jsx(F,{children:l("description")}),e.jsx(R,{type:"text",defaultValue:a?s==null?void 0:s.description:"",...b("description"),placeholder:l("explorer.resource.editModal.description.placeholder"),size:"md"})]})]})]}),le({workflow:"createPublic",actions:P})&&e.jsx(oe,{appCode:x,correctSlug:M,disableSlug:i,onCopyToClipBoard:N,onPublicChange:w,onSlugChange:S,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:u,type:"submit",color:"primary",variant:"filled",disabled:!g||o,children:l(a?"save":"explorer.create")})]})]}),document.getElementById("portal"))}export{pe as default};
@@ -1 +1 @@
1
- import{c as e,H as n}from"./index.js";const m=({imageSrc:s,imageAlt:t="",title:a,text:c})=>e.jsxs("div",{className:"emptyscreen",children:[s&&e.jsx("div",{className:"emptyscreen-image mb-12",children:e.jsx("img",{className:"mx-auto",src:s,alt:t,width:"250",height:"250"})}),a&&e.jsx(n,{level:"h2",headingStyle:"h2",className:"text-secondary mb-8",children:a}),c&&e.jsx("div",{className:"text",children:c})]});m.displayName="EmptyScreen";const r=m;export{r as E};
1
+ import{j as e}from"./index.js";import{H as r}from"./Heading.js";const c=({imageSrc:s,imageAlt:t="",title:a,text:m})=>e.jsxs("div",{className:"emptyscreen",children:[s&&e.jsx("div",{className:"emptyscreen-image mb-12",children:e.jsx("img",{className:"mx-auto",src:s,alt:t,width:"250",height:"250"})}),a&&e.jsx(r,{level:"h2",headingStyle:"h2",className:"text-secondary mb-8",children:a}),m&&e.jsx("div",{className:"text",children:m})]});c.displayName="EmptyScreen";const l=c;export{l as E};
@@ -1 +1 @@
1
- import{u as s,a6 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,W as a,j as c}from"./index.js";import{E as u}from"./EmptyScreen.js";import"./Heading.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 o,j as n}from"./index.js";import{E as s}from"./EmptyScreen.js";import"./Heading.js";function p(){const{theme:e}=r(),{t}=o();return n.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{p 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 o}from"./index.js";import{E as p}from"./EmptyScreen.js";import"./Heading.js";function l(){const{appCode:s}=r(),{theme:e}=r(),{t}=a();return o.jsx(p,{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{l as default};
@@ -1 +1 @@
1
- import{u as S,a7 as h,G as j,a8 as f,b as y,a9 as C,j as o,Z 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}=S(),{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:x}=s;return o.jsx(a.li,{className:"g-col-4",style:{...F},children:o.jsx(I,{app:p,name:x,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
+ import{u as h,a7 as j,D as f,a8 as y,E as C,a9 as I,aa as T,j as i,Z as a}from"./index.js";import{C as A}from"./Card.js";import"./Tooltip.js";import"./usePopper.js";const b=()=>{var c,d;const{currentApp:p}=h(),{data:e,isFetching:u}=j(),l=f(),o=y(),{setSelectedFolders:n,setFolderIds:r,openFolder:m}=C();function g(s){o.includes(s.id)?(r(o.filter(t=>t!==s.id)),n(l.filter(t=>t.id!==s.id))):(r([...o,s.id]),n([...l,s]))}const F=I({from:{opacity:0},to:{opacity:1}}),S=T();return(c=e==null?void 0:e.pages[0])!=null&&c.folders.length?i.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:x}=s;return i.jsx(a.li,{className:"g-col-4",style:{...F},children:i.jsx(A,{app:p,name:x,isFolder:!0,isLoading:u,isSelected:o.includes(s.id),onOpen:()=>{S(),m({folder:s,folderId:s.id})},onSelect:()=>g(s)})},t)})}):null};export{b as default};
@@ -0,0 +1 @@
1
+ import{r as d,d as i,j as l}from"./index.js";const s=d.forwardRef(({level:a="h1",headingStyle:e="h1",children:r,className:t,...o},n)=>{const c=i(e,t);return l.jsx(a,{ref:n,className:c,...o,children:r})});s.displayName="Heading";const m=s;export{m as H};
@@ -1 +1 @@
1
- import{r as s,e as R,c as a,F as d,t as p,a3 as L,a4 as E,y as N,q as S,a5 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||""}),[,c]=s.useState(!1),l=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=>{l(e.target.files)},g=e=>{e.preventDefault(),e.stopPropagation(),c(!0)},m=e=>{e.preventDefault(),e.stopPropagation(),c(!1)},w=e=>{var i;m(e);const t=(i=e.dataTransfer)==null?void 0:i.files;l(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 o,d as y,j as e,F as v,q as j,a4 as L,a5 as R,w as z,n as E,a6 as N}from"./index.js";const S=(r,d)=>{const[,l]=o.useState(!1),m=o.useCallback(a=>{a.preventDefault(),a.stopPropagation(),l(!0)},[]),c=a=>{a.preventDefault(),a.stopPropagation(),l(!1)};return{handleDragging:m,handleDragLeave:c,handleDrop:a=>{var g;c(a);const s=(g=a.dataTransfer)==null?void 0:g.files;d(s),r!=null&&r.current&&s&&(r.current.files=s)}}},A=S,C=o.forwardRef(({label:r,addButtonLabel:d="Add image",deleteButtonLabel:l="Delete image",src:m,className:c,app:a,onUploadImage:s,onDeleteImage:g},$)=>{const i=o.useRef(null),[t,p]=o.useState({name:"",image:m||""}),h=n=>{p({...t,name:"",image:""});const u=n==null?void 0:n[0];if(!u)return;const D={...t,name:u.name,image:URL.createObjectURL(u)};p(D),s(D)},b=()=>{var n;(n=i.current)==null||n.click()},k=()=>{i.current&&(i.current.value="");const n={...t,name:"",image:""};p(n),g()},w=n=>{h(n.target.files)},I=y("image-input",c),{handleDragging:x,handleDragLeave:P,handleDrop:f}=A(i,h);return e.jsxs(v,{id:"image-input",className:I,onDragEnter:x,onDragOver:x,onDragLeave:P,onDrop:f,ref:$,children:[e.jsxs("div",{className:"image-input-actions gap-8",children:[e.jsx(j,{"aria-label":d,color:"tertiary",icon:e.jsx(L,{}),onClick:b,type:"button",variant:"ghost"}),e.jsx(j,{"aria-label":l,color:"danger",disabled:!t.image,icon:e.jsx(R,{width:"20",height:"20"}),onClick:k,type:"button",variant:"ghost"})]}),e.jsxs(v.Label,{children:[e.jsx("span",{className:"visually-hidden",children:r}),e.jsx(z,{accept:"image/*",hidden:!0,onChange:w,ref:i,size:"sm",type:"file"}),t.image?e.jsx(E,{alt:t.name,src:t.image,size:"xl"}):e.jsx(N,{app:a,iconFit:"ratio",size:"160",variant:"rounded"})]})]})});C.displayName="ImagePicker";const O=C;export{O as I};
package/dist/Library.js CHANGED
@@ -1 +1 @@
1
- import{r as n,c as r,I as x,B as c,d,u as m,j 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(x,{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(c,{rightIcon:r.jsx(d,{}),className:"py-0 px-8",variant:"ghost",color:"primary",children:a})})]})}));t.displayName="Library";const g=t,y=({url:e})=>{const{i18n:a,theme:s}=m();return p.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};
1
+ import{r as n,j as r,I as c,B as x,S as m,a as p,c as d}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}=p(),{theme:s}=d();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,E as v,G as I,i as M,b as T,J as y,u as b,K as j,a as F,j as t,M as n,T as S,B as x}from"./index.js";function w({onSuccess:s}){const[a,r]=p.useState(),l=v(),d=I(),c=M(),{foldTreeItem:i,unfoldTreeItem:m}=T(),u=y();async function f(){try{if(!a)throw new Error("explorer.move.selection.empty");await l.mutate(a),await(s==null?void 0:s())}catch(e){console.error(e)}}const h=e=>{for(const o of d)if(e===o.id||e===o.parentId)return!1;for(const o of c)if(e===((o==null?void 0:o.folderIds)&&o.folderIds[0]))return!1;return!0};return{disableSubmit:!a,handleTreeItemSelect:e=>{h(e)?r(e):r(void 0)},handleTreeItemFold:i,handleTreeItemUnfold:async e=>await m(e,u),onMove:()=>{f()}}}function B({isOpen:s,onSuccess:a,onCancel:r}){const{i18n:l}=b(),{handleTreeItemFold:d,handleTreeItemSelect:c,handleTreeItemUnfold:i,onMove:m,disableSubmit:u}=w({onSuccess:a}),f=j();return F.createPortal(t.jsxs(n,{isOpen:s,onModalClose:r,id:"moveModal",children:[t.jsx(n.Header,{onModalClose:r,children:l("explorer.move.title")}),t.jsx(n.Subtitle,{children:l("explorer.move.subtitle")}),t.jsx(n.Body,{children:t.jsx(S,{data:f,onTreeItemSelect:c,onTreeItemFold:d,onTreeItemUnfold:i})}),t.jsxs(n.Footer,{children:[t.jsx(x,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:l("explorer.cancel")}),t.jsx(x,{color:"primary",onClick:m,type:"button",variant:"filled",disabled:u,children:l("explorer.move")})]})]}),document.getElementById("portal"))}export{B as default};
1
+ import{r as p,C as v,D as T,g as M,E as y,G as b,a as j,H 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 B({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{B as default};