@thanhpv102/simple-image-asset-manager 0.1.2 → 0.1.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/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),xe=require("antd"),Y=require("@ant-design/icons");var Q={exports:{}},$={};var ce;function ye(){if(ce)return $;ce=1;var d=Symbol.for("react.transitional.element"),E=Symbol.for("react.fragment");function _(y,u,f){var T=null;if(f!==void 0&&(T=""+f),u.key!==void 0&&(T=""+u.key),"key"in u){f={};for(var N in u)N!=="key"&&(f[N]=u[N])}else f=u;return u=f.ref,{$$typeof:d,type:y,key:T,ref:u!==void 0?u:null,props:f}}return $.Fragment=E,$.jsx=_,$.jsxs=_,$}var q={};var ue;function ve(){return ue||(ue=1,process.env.NODE_ENV!=="production"&&(function(){function d(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===A?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case v:return"Fragment";case w:return"Profiler";case O:return"StrictMode";case B:return"Suspense";case H:return"SuspenseList";case X:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case h:return"Portal";case g:return e.displayName||"Context";case ee:return(e._context.displayName||"Context")+".Consumer";case G:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case L:return n=e.displayName||null,n!==null?n:d(e.type)||"Memo";case C:n=e._payload,e=e._init;try{return d(e(n))}catch{}}return null}function E(e){return""+e}function _(e){try{E(e);var n=!1}catch{n=!0}if(n){n=console;var i=n.error,l=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return i.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",l),E(e)}}function y(e){if(e===v)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===C)return"<...>";try{var n=d(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function u(){var e=j.A;return e===null?null:e.getOwner()}function f(){return Error("react-stack-top-frame")}function T(e){if(F.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function N(e,n){function i(){D||(D=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",n))}i.isReactWarning=!0,Object.defineProperty(e,"key",{get:i,configurable:!0})}function ie(){var e=d(this.type);return o[e]||(o[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function K(e,n,i,l,W,M){var s=i.ref;return e={$$typeof:z,type:e,key:n,props:i,_owner:l},(s!==void 0?s:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:ie}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:W}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:M}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function V(e,n,i,l,W,M){var s=n.children;if(s!==void 0)if(l)if(I(s)){for(l=0;l<s.length;l++)b(s[l]);Object.freeze&&Object.freeze(s)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else b(s);if(F.call(n,"key")){s=d(e);var R=Object.keys(n).filter(function(te){return te!=="key"});l=0<R.length?"{key: someKey, "+R.join(": ..., ")+": ...}":"{key: someKey}",Z[s+l]||(R=0<R.length?"{"+R.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),ye=require("antd"),Y=require("@ant-design/icons");var Z={exports:{}},$={};var ce;function ve(){if(ce)return $;ce=1;var d=Symbol.for("react.transitional.element"),E=Symbol.for("react.fragment");function _(v,u,f){var T=null;if(f!==void 0&&(T=""+f),u.key!==void 0&&(T=""+u.key),"key"in u){f={};for(var I in u)I!=="key"&&(f[I]=u[I])}else f=u;return u=f.ref,{$$typeof:d,type:v,key:T,ref:u!==void 0?u:null,props:f}}return $.Fragment=E,$.jsx=_,$.jsxs=_,$}var q={};var ue;function we(){return ue||(ue=1,process.env.NODE_ENV!=="production"&&(function(){function d(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===X?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case p:return"Fragment";case O:return"Profiler";case W:return"StrictMode";case G:return"Suspense";case L:return"SuspenseList";case M:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case K:return"Portal";case ee:return e.displayName||"Context";case w:return(e._context.displayName||"Context")+".Consumer";case g:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case H:return n=e.displayName||null,n!==null?n:d(e.type)||"Memo";case C:n=e._payload,e=e._init;try{return d(e(n))}catch{}}return null}function E(e){return""+e}function _(e){try{E(e);var n=!1}catch{n=!0}if(n){n=console;var i=n.error,l=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return i.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",l),E(e)}}function v(e){if(e===p)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===C)return"<...>";try{var n=d(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function u(){var e=x.A;return e===null?null:e.getOwner()}function f(){return Error("react-stack-top-frame")}function T(e){if(A.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function I(e,n){function i(){j||(j=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",n))}i.isReactWarning=!0,Object.defineProperty(e,"key",{get:i,configurable:!0})}function ie(){var e=d(this.type);return D[e]||(D[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function Q(e,n,i,l,F,P){var s=i.ref;return e={$$typeof:B,type:e,key:n,props:i,_owner:l},(s!==void 0?s:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:ie}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:F}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:P}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function V(e,n,i,l,F,P){var s=n.children;if(s!==void 0)if(l)if(N(s)){for(l=0;l<s.length;l++)b(s[l]);Object.freeze&&Object.freeze(s)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else b(s);if(A.call(n,"key")){s=d(e);var R=Object.keys(n).filter(function(te){return te!=="key"});l=0<R.length?"{key: someKey, "+R.join(": ..., ")+": ...}":"{key: someKey}",S[s+l]||(R=0<R.length?"{"+R.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,l,s,R,s),Z[s+l]=!0)}if(s=null,i!==void 0&&(_(i),s=""+i),T(n)&&(_(n.key),s=""+n.key),"key"in n){i={};for(var U in n)U!=="key"&&(i[U]=n[U])}else i=n;return s&&N(i,typeof e=="function"?e.displayName||e.name||"Unknown":e),K(e,s,i,u(),W,M)}function b(e){J(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===C&&(e._payload.status==="fulfilled"?J(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function J(e){return typeof e=="object"&&e!==null&&e.$$typeof===z}var P=c,z=Symbol.for("react.transitional.element"),h=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),ee=Symbol.for("react.consumer"),g=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),X=Symbol.for("react.activity"),A=Symbol.for("react.client.reference"),j=P.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,I=Array.isArray,x=console.createTask?console.createTask:function(){return null};P={react_stack_bottom_frame:function(e){return e()}};var D,o={},k=P.react_stack_bottom_frame.bind(P,f)(),S=x(y(f)),Z={};q.Fragment=v,q.jsx=function(e,n,i){var l=1e4>j.recentlyCreatedOwnerStacks++;return V(e,n,i,!1,l?Error("react-stack-top-frame"):k,l?x(y(e)):S)},q.jsxs=function(e,n,i){var l=1e4>j.recentlyCreatedOwnerStacks++;return V(e,n,i,!0,l?Error("react-stack-top-frame"):k,l?x(y(e)):S)}})()),q}var fe;function we(){return fe||(fe=1,process.env.NODE_ENV==="production"?Q.exports=ye():Q.exports=ve()),Q.exports}var r=we();function m(d){return d.type==="FILE"}function oe(d){return d.type==="FOLDER"}const je=({accept:d="image/*",request:E,title:_="Asset Manager",upload:y,onCreateFile:u,onDeleteFile:f,onDeleteFolder:T,onUpdateFile:N,onUpdateFolder:ie,onCreateFolder:K,onSelect:V,visible:b=!1,setVisible:J,showUnacceptedFile:P=!1,addFolderEnabled:z=!0})=>{const[h,v]=c.useState(null),[O,w]=c.useState([]),[ee,g]=c.useState(!1),[G,B]=c.useState(null),[H,L]=c.useState(!1),[C,X]=c.useState(""),[A,j]=c.useState(!1),[F,I]=c.useState([]),[x,D]=c.useState(!1),[o,k]=c.useState(null),[S,Z]=c.useState("thumbnail"),e=c.useRef(null),[n,i]=c.useState(window.innerWidth);c.useEffect(()=>{b&&(g(!0),B(null),E(h===null?void 0:h).then(t=>w(t)).catch(t=>B(t?.message||"Failed to load assets")).finally(()=>g(!1)))},[h,b,E]),c.useEffect(()=>{b&&h===null&&I([])},[h,b]),c.useEffect(()=>{const t=()=>i(window.innerWidth);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const l=()=>{J(!1),v(null),I([]),B(null)},W=t=>{t===-1?(v(null),I([])):(v(F[t].id),I(F.slice(0,t+1)))},M=async t=>{g(!0),await f({id:t.id}),w(a=>a.filter(p=>p!==t)),g(!1)},s=async t=>{g(!0),await T({id:t.id}),w(a=>a.filter(p=>p!==t)),g(!1)},R=async()=>{if(!C.trim())return;g(!0);const t=await K({name:C,parentFolderId:h});w(a=>[...a,t]),X(""),L(!1),g(!1)},U=async t=>{const a=t.target.files;if(!(!a||a.length===0)){j(!0);for(const p of Array.from(a)){if(d&&!p.type.match(d.replace("*",".*")))continue;const re=await y(p),ne=await u({name:p.name,url:re,parentFolderId:h});w(be=>[...be,ne])}j(!1),e.current&&(e.current.value="")}},te=t=>{t.preventDefault(),D(!0)},pe=t=>{t.preventDefault(),D(!1)},me=async t=>{if(t.preventDefault(),D(!1),!!t.dataTransfer.files){j(!0);for(const a of Array.from(t.dataTransfer.files)){if(d&&!a.type.match(d.replace("*",".*")))continue;const p=await y(a),re=await u({name:a.name,url:p,parentFolderId:h});w(ne=>[...ne,re])}j(!1)}},ae=t=>{k(t)},le=t=>{v(t.id),I(a=>[...a,t]),k(t)},he=()=>{o&&m(o)&&(V(o.url),l())},se=async()=>{o&&(m(o)?(await M(o),k(null)):oe(o)&&(await s(o),k(null)))},de=Math.round(n*.8),ge=Math.round(de*.6);return b?r.jsx(xe.Modal,{open:b,title:r.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[r.jsx("span",{children:_}),r.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:0,marginRight:40,marginTop:-10},children:r.jsx("button",{onClick:()=>Z(S==="thumbnail"?"list":"thumbnail"),style:{background:"none",border:"none",cursor:"pointer",padding:0,marginTop:8,fontSize:22,color:"#222",display:"flex",alignItems:"center",transition:"color 0.2s"},title:S==="thumbnail"?"List view":"Thumbnail view",children:S==="thumbnail"?r.jsx(Y.BarsOutlined,{}):r.jsx(Y.AppstoreOutlined,{})})})]}),onCancel:l,footer:null,width:de,styles:{body:{padding:0}},destroyOnHidden:!0,mask:{closable:!1},centered:!0,children:r.jsxs("div",{className:"simple-image-asset-manager-modal",style:{padding:24},children:[r.jsxs("div",{className:"modal-body",style:{display:"flex",gap:24},children:[r.jsxs("div",{style:{flex:1},children:[r.jsxs("div",{style:{marginBottom:8,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap"},children:[r.jsx("span",{className:"breadcrumb",onClick:()=>W(-1),style:{cursor:"pointer",color:"#1890ff",textDecoration:"underline",fontWeight:500,maxWidth:120,display:"inline-block",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:"All"}),F.map((t,a)=>{const p=a===F.length-1;return r.jsxs("span",{style:{display:"flex",alignItems:"center"},children:[r.jsx("span",{style:{margin:"0 4px",fontWeight:500},children:"/"}),p?r.jsx("span",{className:"breadcrumb",style:{color:"#222",fontWeight:500,maxWidth:120,display:"inline-block",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.name}):r.jsx("span",{className:"breadcrumb",onClick:()=>W(a),style:{cursor:"pointer",color:"#1890ff",textDecoration:"underline",fontWeight:500,maxWidth:120,display:"inline-block",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.name})]},t.id)})]}),z&&!H&&r.jsxs("button",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",userSelect:"none",fontWeight:500,fontSize:15,padding:"8px 20px",borderRadius:4,background:"#1890ff",color:"#fff",border:"none",boxShadow:"0 2px 8px rgba(24,144,255,0.12)",transition:"background 0.2s, box-shadow 0.2s"},onClick:()=>L(!0),children:[r.jsx("span",{children:"New folder"}),r.jsx(Y.FolderAddOutlined,{style:{fontSize:20}})]})]}),r.jsxs("div",{className:`drop-area${x?" drag-active":""}`,onDrop:me,onDragOver:te,onDragLeave:pe,style:{border:x?"2px solid #1890ff":"2px dashed #aaa",borderRadius:8,padding:32,marginBottom:24,textAlign:"center",background:x?"#e6f7ff":"#fafafa",position:"relative",transition:"border-color 0.3s, background 0.3s"},children:[r.jsx("div",{style:{marginBottom:8,fontWeight:500},children:x?"Drop file here to upload":"Drag & drop files here"}),r.jsx("button",{onClick:()=>e.current?.click(),disabled:A,style:{marginBottom:8,visibility:x?"hidden":"visible",padding:"8px 24px",borderRadius:4,background:A?"#ccc":"#1890ff",color:"#fff",border:"none",cursor:A?"not-allowed":"pointer",fontWeight:500,fontSize:15,boxShadow:A?"none":"0 2px 8px rgba(24,144,255,0.12)",transition:"background 0.2s, box-shadow 0.2s"},children:"Upload"}),r.jsx("input",{ref:e,type:"file",accept:d,style:{display:"none"},multiple:!0,onChange:U}),A&&r.jsx("div",{children:"Uploading..."})]}),ee?r.jsx("div",{children:"Loading..."}):G?r.jsx("div",{className:"error",children:G}):r.jsxs("div",{children:[z&&H&&r.jsxs("div",{style:{marginBottom:16,display:"flex",alignItems:"center",gap:8},children:[r.jsx("input",{value:C,onChange:t=>X(t.target.value),placeholder:"Folder name",style:{padding:"8px 12px",borderRadius:4,border:"1px solid #d9d9d9",fontSize:15,fontWeight:500,outline:"none",transition:"border-color 0.2s",boxSizing:"border-box"},onFocus:t=>t.target.style.borderColor="#1890ff",onBlur:t=>t.target.style.borderColor="#d9d9d9"}),r.jsx("button",{onClick:R,style:{padding:"8px 16px",borderRadius:4,background:"#1890ff",color:"#fff",border:"none",fontWeight:500,fontSize:15,cursor:"pointer",boxShadow:"0 2px 8px rgba(24,144,255,0.12)",transition:"background 0.2s"},children:"Create"}),r.jsx("button",{onClick:()=>L(!1),style:{padding:"8px 16px",borderRadius:4,background:"#f5f5f5",color:"#222",border:"1px solid #d9d9d9",fontWeight:500,fontSize:15,cursor:"pointer",transition:"background 0.2s"},children:"Cancel"})]}),S==="thumbnail"?r.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:16},children:O.filter(oe).map(t=>r.jsxs("div",{className:"folder-item",style:{cursor:"pointer",width:120,minWidth:120,maxWidth:120,display:"flex",flexDirection:"column",alignItems:"center",padding:8,borderRadius:8,background:"#fafafa",boxSizing:"border-box"},onClick:()=>le(t),children:[t.thumbnail?r.jsx("img",{src:t.thumbnail,alt:t.name,style:{width:64,height:64,objectFit:"cover",borderRadius:4,marginBottom:8,background:"#fff"}}):r.jsx("div",{style:{fontSize:40,width:64,height:64,display:"flex",alignItems:"center",justifyContent:"center",marginBottom:8,background:"#fff",borderRadius:4},children:"📁"}),r.jsx("div",{style:{fontSize:13,fontWeight:500,width:"100%",textAlign:"center",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.name})]},t.id))}):r.jsx("div",{style:{display:"block",marginBottom:16},children:O.filter(oe).map(t=>r.jsxs("div",{className:"folder-item",style:{display:"flex",alignItems:"center",gap:12,padding:"8px 0",borderBottom:"1px solid #f0f0f0",cursor:"pointer"},onClick:()=>le(t),children:[t.thumbnail?r.jsx("img",{src:t.thumbnail,alt:t.name,style:{width:32,height:32,objectFit:"cover",borderRadius:4,background:"#fff"}}):r.jsx("div",{style:{fontSize:24,width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",background:"#fff",borderRadius:4},children:"📁"}),r.jsx("div",{style:{fontSize:14,fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flex:1},children:t.name})]},t.id))}),S==="thumbnail"?r.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:16,marginTop:16},children:O.filter(m).map(t=>{const a=o&&m(o)&&o.id===t.id;return r.jsxs("div",{className:"file-item",style:{cursor:"pointer",width:120,minWidth:120,maxWidth:120,border:"2px solid "+(a?"#1890ff":"transparent"),background:a?"#e6f7ff":"#fafafa",borderRadius:8,boxSizing:"border-box",transition:"border-color 0.2s, background 0.2s",padding:8,display:"flex",flexDirection:"column",alignItems:"center"},onClick:()=>ae(t),children:[r.jsx("img",{src:t.thumbnail||t.url,alt:t.name,style:{width:64,height:64,objectFit:"cover",borderRadius:4,background:"#fff",marginBottom:8}}),r.jsx("div",{style:{fontSize:12,fontWeight:500,width:"100%",textAlign:"center",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:4},children:t.name})]},t.id)})}):r.jsx("div",{style:{display:"block",marginTop:16},children:O.filter(m).map(t=>{const a=o&&m(o)&&o.id===t.id;return r.jsxs("div",{className:"file-item",style:{display:"flex",alignItems:"center",gap:12,padding:"8px 0",borderBottom:"1px solid #f0f0f0",cursor:"pointer",background:a?"#e6f7ff":"#fff"},onClick:()=>ae(t),children:[r.jsx("img",{src:t.thumbnail||t.url,alt:t.name,style:{width:32,height:32,objectFit:"cover",borderRadius:4,background:"#fff"}}),r.jsx("div",{style:{fontSize:14,fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flex:1},children:t.name})]},t.id)})})]})]}),o&&r.jsx("div",{style:{width:ge,minWidth:320,transition:"width 2s",overflow:"hidden"},children:r.jsxs("div",{style:{border:"1px solid #eee",borderRadius:8,padding:16,background:"#fff",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",position:"relative"},children:[r.jsx("button",{onClick:()=>k(null),style:{position:"absolute",top:12,right:12,background:"#f5f5f5",border:"none",borderRadius:4,padding:"4px 12px",cursor:"pointer",fontWeight:500,fontSize:14,color:"#222",boxShadow:"0 1px 4px rgba(0,0,0,0.08)"},children:"Hide"}),m(o)?r.jsxs(r.Fragment,{children:[r.jsx("img",{src:o.thumbnail||o.url,alt:o.name,style:{width:"100%",maxHeight:240,objectFit:"contain",borderRadius:4,marginBottom:16}}),r.jsx("div",{style:{fontWeight:500,marginBottom:8},children:o.name}),r.jsx("div",{style:{fontSize:12,color:"#888",marginBottom:8},children:o.url.startsWith("data:")?"URL: data-uri":r.jsxs(r.Fragment,{children:["URL: ",r.jsx("a",{href:o.url,target:"_blank",rel:"noopener noreferrer",children:o.url})]})}),r.jsxs("button",{onClick:se,style:{display:"flex",alignItems:"center",gap:6,color:"#ff4d4f",background:"none",border:"none",cursor:"pointer",fontWeight:500,fontSize:15,marginTop:24},children:[r.jsx(Y.DeleteOutlined,{})," Delete"]})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{style:{fontSize:64,marginBottom:16},children:"📁"}),r.jsx("div",{style:{fontWeight:500,marginBottom:8},children:o.name}),r.jsx("div",{style:{fontSize:12,color:"#888",marginBottom:8},children:`Files: ${O.filter(t=>m(t)&&t.parentFolderId===o.id).length}`}),r.jsxs("button",{onClick:se,style:{display:"flex",alignItems:"center",gap:6,color:"#ff4d4f",background:"none",border:"none",cursor:"pointer",fontWeight:500,fontSize:15,marginTop:24},children:[r.jsx(Y.DeleteOutlined,{})," Delete"]})]})]})})]}),r.jsx("div",{className:"modal-footer",style:{display:"flex",justifyContent:"flex-end",alignItems:"center",marginTop:24},children:r.jsx("button",{onClick:he,disabled:!(o&&m(o)),style:{padding:"8px 24px",borderRadius:4,background:o&&m(o)?"#1890ff":"#ccc",color:"#fff",border:"none",cursor:o&&m(o)?"pointer":"not-allowed",fontWeight:500},children:"Select"})})]})}):null};exports.AssetManager=je;
6
+ <%s key={someKey} {...props} />`,l,s,R,s),S[s+l]=!0)}if(s=null,i!==void 0&&(_(i),s=""+i),T(n)&&(_(n.key),s=""+n.key),"key"in n){i={};for(var U in n)U!=="key"&&(i[U]=n[U])}else i=n;return s&&I(i,typeof e=="function"?e.displayName||e.name||"Unknown":e),Q(e,s,i,u(),F,P)}function b(e){J(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===C&&(e._payload.status==="fulfilled"?J(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function J(e){return typeof e=="object"&&e!==null&&e.$$typeof===B}var z=c,B=Symbol.for("react.transitional.element"),K=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),W=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),ee=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),G=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),X=Symbol.for("react.client.reference"),x=z.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,N=Array.isArray,y=console.createTask?console.createTask:function(){return null};z={react_stack_bottom_frame:function(e){return e()}};var j,D={},o=z.react_stack_bottom_frame.bind(z,f)(),k=y(v(f)),S={};q.Fragment=p,q.jsx=function(e,n,i){var l=1e4>x.recentlyCreatedOwnerStacks++;return V(e,n,i,!1,l?Error("react-stack-top-frame"):o,l?y(v(e)):k)},q.jsxs=function(e,n,i){var l=1e4>x.recentlyCreatedOwnerStacks++;return V(e,n,i,!0,l?Error("react-stack-top-frame"):o,l?y(v(e)):k)}})()),q}var fe;function je(){return fe||(fe=1,process.env.NODE_ENV==="production"?Z.exports=ve():Z.exports=we()),Z.exports}var r=je();function h(d){return d.type==="FILE"}function oe(d){return d.type==="FOLDER"}const ke=({accept:d="image/*",request:E,title:_="Asset Manager",upload:v,onCreateFile:u,onDeleteFile:f,onDeleteFolder:T,onUpdateFile:I,onUpdateFolder:ie,onCreateFolder:Q,onSelect:V,visible:b=!1,setVisible:J,showUnacceptedFile:z=!1,addFolderEnabled:B=!0,getContainer:K})=>{const[p,W]=c.useState(null),[O,w]=c.useState([]),[ee,g]=c.useState(!1),[G,L]=c.useState(null),[H,C]=c.useState(!1),[M,X]=c.useState(""),[x,A]=c.useState(!1),[N,y]=c.useState([]),[j,D]=c.useState(!1),[o,k]=c.useState(null),[S,e]=c.useState("thumbnail"),n=c.useRef(null),[i,l]=c.useState(window.innerWidth);c.useEffect(()=>{b&&(g(!0),L(null),E(p===null?void 0:p).then(t=>w(t)).catch(t=>L(t?.message||"Failed to load assets")).finally(()=>g(!1)))},[p,b,E]),c.useEffect(()=>{b&&p===null&&y([])},[p,b]),c.useEffect(()=>{const t=()=>l(window.innerWidth);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const F=()=>{J(!1),W(null),y([]),L(null)},P=t=>{t===-1?(W(null),y([])):(W(N[t].id),y(N.slice(0,t+1)))},s=async t=>{g(!0),await f({id:t.id}),w(a=>a.filter(m=>m!==t)),g(!1)},R=async t=>{g(!0),await T({id:t.id}),w(a=>a.filter(m=>m!==t)),g(!1)},U=async()=>{if(!M.trim())return;g(!0);const t=await Q({name:M,parentFolderId:p});w(a=>[...a,t]),X(""),C(!1),g(!1)},te=async t=>{const a=t.target.files;if(!(!a||a.length===0)){A(!0);for(const m of Array.from(a)){if(d&&!m.type.match(d.replace("*",".*")))continue;const re=await v(m),ne=await u({name:m.name,url:re,parentFolderId:p});w(xe=>[...xe,ne])}A(!1),n.current&&(n.current.value="")}},pe=t=>{t.preventDefault(),D(!0)},me=t=>{t.preventDefault(),D(!1)},he=async t=>{if(t.preventDefault(),D(!1),!!t.dataTransfer.files){A(!0);for(const a of Array.from(t.dataTransfer.files)){if(d&&!a.type.match(d.replace("*",".*")))continue;const m=await v(a),re=await u({name:a.name,url:m,parentFolderId:p});w(ne=>[...ne,re])}A(!1)}},ae=t=>{k(t)},le=t=>{W(t.id),y(a=>[...a,t]),k(t)},ge=()=>{o&&h(o)&&(V(o.url),F())},se=async()=>{o&&(h(o)?(await s(o),k(null)):oe(o)&&(await R(o),k(null)))},de=Math.round(i*.8),be=Math.round(de*.6);return b?r.jsx(ye.Modal,{open:b,title:r.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[r.jsx("span",{children:_}),r.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:0,marginRight:40,marginTop:-10},children:r.jsx("button",{onClick:()=>e(S==="thumbnail"?"list":"thumbnail"),style:{background:"none",border:"none",cursor:"pointer",padding:0,marginTop:8,fontSize:22,color:"#222",display:"flex",alignItems:"center",transition:"color 0.2s"},title:S==="thumbnail"?"List view":"Thumbnail view",children:S==="thumbnail"?r.jsx(Y.BarsOutlined,{}):r.jsx(Y.AppstoreOutlined,{})})})]}),onCancel:F,footer:null,width:de,styles:{body:{padding:0}},destroyOnHidden:!0,mask:{closable:!1},centered:!0,getContainer:K,children:r.jsxs("div",{className:"simple-image-asset-manager-modal",style:{padding:24},children:[r.jsxs("div",{className:"modal-body",style:{display:"flex",gap:24},children:[r.jsxs("div",{style:{flex:1},children:[r.jsxs("div",{style:{marginBottom:8,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap"},children:[r.jsx("span",{className:"breadcrumb",onClick:()=>P(-1),style:{cursor:"pointer",color:"#1890ff",textDecoration:"underline",fontWeight:500,maxWidth:120,display:"inline-block",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:"All"}),N.map((t,a)=>{const m=a===N.length-1;return r.jsxs("span",{style:{display:"flex",alignItems:"center"},children:[r.jsx("span",{style:{margin:"0 4px",fontWeight:500},children:"/"}),m?r.jsx("span",{className:"breadcrumb",style:{color:"#222",fontWeight:500,maxWidth:120,display:"inline-block",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.name}):r.jsx("span",{className:"breadcrumb",onClick:()=>P(a),style:{cursor:"pointer",color:"#1890ff",textDecoration:"underline",fontWeight:500,maxWidth:120,display:"inline-block",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.name})]},t.id)})]}),B&&!H&&r.jsxs("button",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",userSelect:"none",fontWeight:500,fontSize:15,padding:"8px 20px",borderRadius:4,background:"#1890ff",color:"#fff",border:"none",boxShadow:"0 2px 8px rgba(24,144,255,0.12)",transition:"background 0.2s, box-shadow 0.2s"},onClick:()=>C(!0),children:[r.jsx("span",{children:"New folder"}),r.jsx(Y.FolderAddOutlined,{style:{fontSize:20}})]})]}),r.jsxs("div",{className:`drop-area${j?" drag-active":""}`,onDrop:he,onDragOver:pe,onDragLeave:me,style:{border:j?"2px solid #1890ff":"2px dashed #aaa",borderRadius:8,padding:32,marginBottom:24,textAlign:"center",background:j?"#e6f7ff":"#fafafa",position:"relative",transition:"border-color 0.3s, background 0.3s"},children:[r.jsx("div",{style:{marginBottom:8,fontWeight:500},children:j?"Drop file here to upload":"Drag & drop files here"}),r.jsx("button",{onClick:()=>n.current?.click(),disabled:x,style:{marginBottom:8,visibility:j?"hidden":"visible",padding:"8px 24px",borderRadius:4,background:x?"#ccc":"#1890ff",color:"#fff",border:"none",cursor:x?"not-allowed":"pointer",fontWeight:500,fontSize:15,boxShadow:x?"none":"0 2px 8px rgba(24,144,255,0.12)",transition:"background 0.2s, box-shadow 0.2s"},children:"Upload"}),r.jsx("input",{ref:n,type:"file",accept:d,style:{display:"none"},multiple:!0,onChange:te}),x&&r.jsx("div",{children:"Uploading..."})]}),ee?r.jsx("div",{children:"Loading..."}):G?r.jsx("div",{className:"error",children:G}):r.jsxs("div",{children:[B&&H&&r.jsxs("div",{style:{marginBottom:16,display:"flex",alignItems:"center",gap:8},children:[r.jsx("input",{value:M,onChange:t=>X(t.target.value),placeholder:"Folder name",style:{padding:"8px 12px",borderRadius:4,border:"1px solid #d9d9d9",fontSize:15,fontWeight:500,outline:"none",transition:"border-color 0.2s",boxSizing:"border-box"},onFocus:t=>t.target.style.borderColor="#1890ff",onBlur:t=>t.target.style.borderColor="#d9d9d9"}),r.jsx("button",{onClick:U,style:{padding:"8px 16px",borderRadius:4,background:"#1890ff",color:"#fff",border:"none",fontWeight:500,fontSize:15,cursor:"pointer",boxShadow:"0 2px 8px rgba(24,144,255,0.12)",transition:"background 0.2s"},children:"Create"}),r.jsx("button",{onClick:()=>C(!1),style:{padding:"8px 16px",borderRadius:4,background:"#f5f5f5",color:"#222",border:"1px solid #d9d9d9",fontWeight:500,fontSize:15,cursor:"pointer",transition:"background 0.2s"},children:"Cancel"})]}),S==="thumbnail"?r.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:16},children:O.filter(oe).map(t=>r.jsxs("div",{className:"folder-item",style:{cursor:"pointer",width:120,minWidth:120,maxWidth:120,display:"flex",flexDirection:"column",alignItems:"center",padding:8,borderRadius:8,background:"#fafafa",boxSizing:"border-box"},onClick:()=>le(t),children:[t.thumbnail?r.jsx("img",{src:t.thumbnail,alt:t.name,style:{width:64,height:64,objectFit:"cover",borderRadius:4,marginBottom:8,background:"#fff"}}):r.jsx("div",{style:{fontSize:40,width:64,height:64,display:"flex",alignItems:"center",justifyContent:"center",marginBottom:8,background:"#fff",borderRadius:4},children:"📁"}),r.jsx("div",{style:{fontSize:13,fontWeight:500,width:"100%",textAlign:"center",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.name})]},t.id))}):r.jsx("div",{style:{display:"block",marginBottom:16},children:O.filter(oe).map(t=>r.jsxs("div",{className:"folder-item",style:{display:"flex",alignItems:"center",gap:12,padding:"8px 0",borderBottom:"1px solid #f0f0f0",cursor:"pointer"},onClick:()=>le(t),children:[t.thumbnail?r.jsx("img",{src:t.thumbnail,alt:t.name,style:{width:32,height:32,objectFit:"cover",borderRadius:4,background:"#fff"}}):r.jsx("div",{style:{fontSize:24,width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",background:"#fff",borderRadius:4},children:"📁"}),r.jsx("div",{style:{fontSize:14,fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flex:1},children:t.name})]},t.id))}),S==="thumbnail"?r.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:16,marginTop:16},children:O.filter(h).map(t=>{const a=o&&h(o)&&o.id===t.id;return r.jsxs("div",{className:"file-item",style:{cursor:"pointer",width:120,minWidth:120,maxWidth:120,border:"2px solid "+(a?"#1890ff":"transparent"),background:a?"#e6f7ff":"#fafafa",borderRadius:8,boxSizing:"border-box",transition:"border-color 0.2s, background 0.2s",padding:8,display:"flex",flexDirection:"column",alignItems:"center"},onClick:()=>ae(t),children:[r.jsx("img",{src:t.thumbnail||t.url,alt:t.name,style:{width:64,height:64,objectFit:"cover",borderRadius:4,background:"#fff",marginBottom:8}}),r.jsx("div",{style:{fontSize:12,fontWeight:500,width:"100%",textAlign:"center",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:4},children:t.name})]},t.id)})}):r.jsx("div",{style:{display:"block",marginTop:16},children:O.filter(h).map(t=>{const a=o&&h(o)&&o.id===t.id;return r.jsxs("div",{className:"file-item",style:{display:"flex",alignItems:"center",gap:12,padding:"8px 0",borderBottom:"1px solid #f0f0f0",cursor:"pointer",background:a?"#e6f7ff":"#fff"},onClick:()=>ae(t),children:[r.jsx("img",{src:t.thumbnail||t.url,alt:t.name,style:{width:32,height:32,objectFit:"cover",borderRadius:4,background:"#fff"}}),r.jsx("div",{style:{fontSize:14,fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flex:1},children:t.name})]},t.id)})})]})]}),o&&r.jsx("div",{style:{width:be,minWidth:320,transition:"width 2s",overflow:"hidden"},children:r.jsxs("div",{style:{border:"1px solid #eee",borderRadius:8,padding:16,background:"#fff",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",position:"relative"},children:[r.jsx("button",{onClick:()=>k(null),style:{position:"absolute",top:12,right:12,background:"#f5f5f5",border:"none",borderRadius:4,padding:"4px 12px",cursor:"pointer",fontWeight:500,fontSize:14,color:"#222",boxShadow:"0 1px 4px rgba(0,0,0,0.08)"},children:"Hide"}),h(o)?r.jsxs(r.Fragment,{children:[r.jsx("img",{src:o.thumbnail||o.url,alt:o.name,style:{width:"100%",maxHeight:240,objectFit:"contain",borderRadius:4,marginBottom:16}}),r.jsx("div",{style:{fontWeight:500,marginBottom:8},children:o.name}),r.jsx("div",{style:{fontSize:12,color:"#888",marginBottom:8},children:o.url.startsWith("data:")?"URL: data-uri":r.jsxs(r.Fragment,{children:["URL: ",r.jsx("a",{href:o.url,target:"_blank",rel:"noopener noreferrer",children:o.url})]})}),r.jsxs("button",{onClick:se,style:{display:"flex",alignItems:"center",gap:6,color:"#ff4d4f",background:"none",border:"none",cursor:"pointer",fontWeight:500,fontSize:15,marginTop:24},children:[r.jsx(Y.DeleteOutlined,{})," Delete"]})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{style:{fontSize:64,marginBottom:16},children:"📁"}),r.jsx("div",{style:{fontWeight:500,marginBottom:8},children:o.name}),r.jsx("div",{style:{fontSize:12,color:"#888",marginBottom:8},children:`Files: ${O.filter(t=>h(t)&&t.parentFolderId===o.id).length}`}),r.jsxs("button",{onClick:se,style:{display:"flex",alignItems:"center",gap:6,color:"#ff4d4f",background:"none",border:"none",cursor:"pointer",fontWeight:500,fontSize:15,marginTop:24},children:[r.jsx(Y.DeleteOutlined,{})," Delete"]})]})]})})]}),r.jsx("div",{className:"modal-footer",style:{display:"flex",justifyContent:"flex-end",alignItems:"center",marginTop:24},children:r.jsx("button",{onClick:ge,disabled:!(o&&h(o)),style:{padding:"8px 24px",borderRadius:4,background:o&&h(o)?"#1890ff":"#ccc",color:"#fff",border:"none",cursor:o&&h(o)?"pointer":"not-allowed",fontWeight:500},children:"Select"})})]})}):null};exports.AssetManager=ke;
package/dist/index.js CHANGED
@@ -1,22 +1,22 @@
1
- import ye, { useState as u, useRef as ve, useEffect as ne } from "react";
2
- import { Modal as we } from "antd";
3
- import { FolderAddOutlined as je, DeleteOutlined as ce, BarsOutlined as ke, AppstoreOutlined as Re } from "@ant-design/icons";
4
- var Z = { exports: {} }, M = {};
1
+ import ve, { useState as p, useRef as we, useEffect as ne } from "react";
2
+ import { Modal as je } from "antd";
3
+ import { FolderAddOutlined as ke, DeleteOutlined as ce, BarsOutlined as Re, AppstoreOutlined as Ee } from "@ant-design/icons";
4
+ var X = { exports: {} }, M = {};
5
5
  var fe;
6
- function Ee() {
6
+ function Se() {
7
7
  if (fe) return M;
8
8
  fe = 1;
9
9
  var d = /* @__PURE__ */ Symbol.for("react.transitional.element"), S = /* @__PURE__ */ Symbol.for("react.fragment");
10
- function _(y, c, f) {
10
+ function _(v, c, f) {
11
11
  var T = null;
12
12
  if (f !== void 0 && (T = "" + f), c.key !== void 0 && (T = "" + c.key), "key" in c) {
13
13
  f = {};
14
- for (var N in c)
15
- N !== "key" && (f[N] = c[N]);
14
+ for (var I in c)
15
+ I !== "key" && (f[I] = c[I]);
16
16
  } else f = c;
17
17
  return c = f.ref, {
18
18
  $$typeof: d,
19
- type: y,
19
+ type: v,
20
20
  key: T,
21
21
  ref: c !== void 0 ? c : null,
22
22
  props: f
@@ -26,41 +26,41 @@ function Ee() {
26
26
  }
27
27
  var $ = {};
28
28
  var ue;
29
- function Se() {
29
+ function _e() {
30
30
  return ue || (ue = 1, process.env.NODE_ENV !== "production" && (function() {
31
31
  function d(e) {
32
32
  if (e == null) return null;
33
33
  if (typeof e == "function")
34
- return e.$$typeof === A ? null : e.displayName || e.name || null;
34
+ return e.$$typeof === H ? null : e.displayName || e.name || null;
35
35
  if (typeof e == "string") return e;
36
36
  switch (e) {
37
- case v:
37
+ case u:
38
38
  return "Fragment";
39
- case w:
40
- return "Profiler";
41
39
  case C:
40
+ return "Profiler";
41
+ case W:
42
42
  return "StrictMode";
43
- case B:
43
+ case q:
44
44
  return "Suspense";
45
- case G:
45
+ case L:
46
46
  return "SuspenseList";
47
- case H:
47
+ case U:
48
48
  return "Activity";
49
49
  }
50
50
  if (typeof e == "object")
51
51
  switch (typeof e.tag == "number" && console.error(
52
52
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
53
53
  ), e.$$typeof) {
54
- case h:
54
+ case Q:
55
55
  return "Portal";
56
- case g:
57
- return e.displayName || "Context";
58
56
  case K:
57
+ return e.displayName || "Context";
58
+ case w:
59
59
  return (e._context.displayName || "Context") + ".Consumer";
60
- case q:
60
+ case g:
61
61
  var n = e.render;
62
62
  return e = e.displayName, e || (e = n.displayName || n.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
63
- case L:
63
+ case G:
64
64
  return n = e.displayName || null, n !== null ? n : d(e.type) || "Memo";
65
65
  case O:
66
66
  n = e._payload, e = e._init;
@@ -91,8 +91,8 @@ function Se() {
91
91
  ), S(e);
92
92
  }
93
93
  }
94
- function y(e) {
95
- if (e === v) return "<>";
94
+ function v(e) {
95
+ if (e === u) return "<>";
96
96
  if (typeof e == "object" && e !== null && e.$$typeof === O)
97
97
  return "<...>";
98
98
  try {
@@ -103,22 +103,22 @@ function Se() {
103
103
  }
104
104
  }
105
105
  function c() {
106
- var e = j.A;
106
+ var e = b.A;
107
107
  return e === null ? null : e.getOwner();
108
108
  }
109
109
  function f() {
110
110
  return Error("react-stack-top-frame");
111
111
  }
112
112
  function T(e) {
113
- if (F.call(e, "key")) {
113
+ if (A.call(e, "key")) {
114
114
  var n = Object.getOwnPropertyDescriptor(e, "key").get;
115
115
  if (n && n.isReactWarning) return !1;
116
116
  }
117
117
  return e.key !== void 0;
118
118
  }
119
- function N(e, n) {
119
+ function I(e, n) {
120
120
  function i() {
121
- D || (D = !0, console.error(
121
+ j || (j = !0, console.error(
122
122
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
123
123
  n
124
124
  ));
@@ -130,14 +130,14 @@ function Se() {
130
130
  }
131
131
  function ie() {
132
132
  var e = d(this.type);
133
- return o[e] || (o[e] = !0, console.error(
133
+ return D[e] || (D[e] = !0, console.error(
134
134
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
135
135
  )), e = this.props.ref, e !== void 0 ? e : null;
136
136
  }
137
- function Q(e, n, i, l, W, U) {
137
+ function Z(e, n, i, l, F, P) {
138
138
  var s = i.ref;
139
139
  return e = {
140
- $$typeof: z,
140
+ $$typeof: B,
141
141
  type: e,
142
142
  key: n,
143
143
  props: i,
@@ -159,19 +159,19 @@ function Se() {
159
159
  configurable: !1,
160
160
  enumerable: !1,
161
161
  writable: !0,
162
- value: W
162
+ value: F
163
163
  }), Object.defineProperty(e, "_debugTask", {
164
164
  configurable: !1,
165
165
  enumerable: !1,
166
166
  writable: !0,
167
- value: U
167
+ value: P
168
168
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
169
169
  }
170
- function V(e, n, i, l, W, U) {
170
+ function V(e, n, i, l, F, P) {
171
171
  var s = n.children;
172
172
  if (s !== void 0)
173
173
  if (l)
174
- if (I(s)) {
174
+ if (N(s)) {
175
175
  for (l = 0; l < s.length; l++)
176
176
  x(s[l]);
177
177
  Object.freeze && Object.freeze(s);
@@ -180,12 +180,12 @@ function Se() {
180
180
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
181
181
  );
182
182
  else x(s);
183
- if (F.call(n, "key")) {
183
+ if (A.call(n, "key")) {
184
184
  s = d(e);
185
185
  var E = Object.keys(n).filter(function(ee) {
186
186
  return ee !== "key";
187
187
  });
188
- l = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", X[s + l] || (E = 0 < E.length ? "{" + E.join(": ..., ") + ": ...}" : "{}", console.error(
188
+ l = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", R[s + l] || (E = 0 < E.length ? "{" + E.join(": ..., ") + ": ...}" : "{}", console.error(
189
189
  `A props object containing a "key" prop is being spread into JSX:
190
190
  let props = %s;
191
191
  <%s {...props} />
@@ -196,154 +196,155 @@ React keys must be passed directly to JSX without using spread:
196
196
  s,
197
197
  E,
198
198
  s
199
- ), X[s + l] = !0);
199
+ ), R[s + l] = !0);
200
200
  }
201
201
  if (s = null, i !== void 0 && (_(i), s = "" + i), T(n) && (_(n.key), s = "" + n.key), "key" in n) {
202
202
  i = {};
203
203
  for (var Y in n)
204
204
  Y !== "key" && (i[Y] = n[Y]);
205
205
  } else i = n;
206
- return s && N(
206
+ return s && I(
207
207
  i,
208
208
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
209
- ), Q(
209
+ ), Z(
210
210
  e,
211
211
  s,
212
212
  i,
213
213
  c(),
214
- W,
215
- U
214
+ F,
215
+ P
216
216
  );
217
217
  }
218
218
  function x(e) {
219
219
  J(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === O && (e._payload.status === "fulfilled" ? J(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
220
220
  }
221
221
  function J(e) {
222
- return typeof e == "object" && e !== null && e.$$typeof === z;
222
+ return typeof e == "object" && e !== null && e.$$typeof === B;
223
223
  }
224
- var P = ye, z = /* @__PURE__ */ Symbol.for("react.transitional.element"), h = /* @__PURE__ */ Symbol.for("react.portal"), v = /* @__PURE__ */ Symbol.for("react.fragment"), C = /* @__PURE__ */ Symbol.for("react.strict_mode"), w = /* @__PURE__ */ Symbol.for("react.profiler"), K = /* @__PURE__ */ Symbol.for("react.consumer"), g = /* @__PURE__ */ Symbol.for("react.context"), q = /* @__PURE__ */ Symbol.for("react.forward_ref"), B = /* @__PURE__ */ Symbol.for("react.suspense"), G = /* @__PURE__ */ Symbol.for("react.suspense_list"), L = /* @__PURE__ */ Symbol.for("react.memo"), O = /* @__PURE__ */ Symbol.for("react.lazy"), H = /* @__PURE__ */ Symbol.for("react.activity"), A = /* @__PURE__ */ Symbol.for("react.client.reference"), j = P.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, F = Object.prototype.hasOwnProperty, I = Array.isArray, b = console.createTask ? console.createTask : function() {
224
+ var z = ve, B = /* @__PURE__ */ Symbol.for("react.transitional.element"), Q = /* @__PURE__ */ Symbol.for("react.portal"), u = /* @__PURE__ */ Symbol.for("react.fragment"), W = /* @__PURE__ */ Symbol.for("react.strict_mode"), C = /* @__PURE__ */ Symbol.for("react.profiler"), w = /* @__PURE__ */ Symbol.for("react.consumer"), K = /* @__PURE__ */ Symbol.for("react.context"), g = /* @__PURE__ */ Symbol.for("react.forward_ref"), q = /* @__PURE__ */ Symbol.for("react.suspense"), L = /* @__PURE__ */ Symbol.for("react.suspense_list"), G = /* @__PURE__ */ Symbol.for("react.memo"), O = /* @__PURE__ */ Symbol.for("react.lazy"), U = /* @__PURE__ */ Symbol.for("react.activity"), H = /* @__PURE__ */ Symbol.for("react.client.reference"), b = z.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, A = Object.prototype.hasOwnProperty, N = Array.isArray, y = console.createTask ? console.createTask : function() {
225
225
  return null;
226
226
  };
227
- P = {
227
+ z = {
228
228
  react_stack_bottom_frame: function(e) {
229
229
  return e();
230
230
  }
231
231
  };
232
- var D, o = {}, k = P.react_stack_bottom_frame.bind(
233
- P,
232
+ var j, D = {}, o = z.react_stack_bottom_frame.bind(
233
+ z,
234
234
  f
235
- )(), R = b(y(f)), X = {};
236
- $.Fragment = v, $.jsx = function(e, n, i) {
237
- var l = 1e4 > j.recentlyCreatedOwnerStacks++;
235
+ )(), k = y(v(f)), R = {};
236
+ $.Fragment = u, $.jsx = function(e, n, i) {
237
+ var l = 1e4 > b.recentlyCreatedOwnerStacks++;
238
238
  return V(
239
239
  e,
240
240
  n,
241
241
  i,
242
242
  !1,
243
- l ? Error("react-stack-top-frame") : k,
244
- l ? b(y(e)) : R
243
+ l ? Error("react-stack-top-frame") : o,
244
+ l ? y(v(e)) : k
245
245
  );
246
246
  }, $.jsxs = function(e, n, i) {
247
- var l = 1e4 > j.recentlyCreatedOwnerStacks++;
247
+ var l = 1e4 > b.recentlyCreatedOwnerStacks++;
248
248
  return V(
249
249
  e,
250
250
  n,
251
251
  i,
252
252
  !0,
253
- l ? Error("react-stack-top-frame") : k,
254
- l ? b(y(e)) : R
253
+ l ? Error("react-stack-top-frame") : o,
254
+ l ? y(v(e)) : k
255
255
  );
256
256
  };
257
257
  })()), $;
258
258
  }
259
259
  var pe;
260
- function _e() {
261
- return pe || (pe = 1, process.env.NODE_ENV === "production" ? Z.exports = Ee() : Z.exports = Se()), Z.exports;
260
+ function Te() {
261
+ return pe || (pe = 1, process.env.NODE_ENV === "production" ? X.exports = Se() : X.exports = _e()), X.exports;
262
262
  }
263
- var t = _e();
264
- function m(d) {
263
+ var t = Te();
264
+ function h(d) {
265
265
  return d.type === "FILE";
266
266
  }
267
267
  function oe(d) {
268
268
  return d.type === "FOLDER";
269
269
  }
270
- const Ae = ({
270
+ const Fe = ({
271
271
  accept: d = "image/*",
272
272
  request: S,
273
273
  title: _ = "Asset Manager",
274
- upload: y,
274
+ upload: v,
275
275
  onCreateFile: c,
276
276
  onDeleteFile: f,
277
277
  onDeleteFolder: T,
278
- onUpdateFile: N,
278
+ onUpdateFile: I,
279
279
  onUpdateFolder: ie,
280
- onCreateFolder: Q,
280
+ onCreateFolder: Z,
281
281
  onSelect: V,
282
282
  visible: x = !1,
283
283
  setVisible: J,
284
- showUnacceptedFile: P = !1,
285
- addFolderEnabled: z = !0
284
+ showUnacceptedFile: z = !1,
285
+ addFolderEnabled: B = !0,
286
+ getContainer: Q
286
287
  }) => {
287
- const [h, v] = u(null), [C, w] = u([]), [K, g] = u(!1), [q, B] = u(null), [G, L] = u(!1), [O, H] = u(""), [A, j] = u(!1), [F, I] = u([]), [b, D] = u(!1), [o, k] = u(null), [R, X] = u("thumbnail"), e = ve(null), [n, i] = u(window.innerWidth);
288
+ const [u, W] = p(null), [C, w] = p([]), [K, g] = p(!1), [q, L] = p(null), [G, O] = p(!1), [U, H] = p(""), [b, A] = p(!1), [N, y] = p([]), [j, D] = p(!1), [o, k] = p(null), [R, e] = p("thumbnail"), n = we(null), [i, l] = p(window.innerWidth);
288
289
  ne(() => {
289
- x && (g(!0), B(null), S(h === null ? void 0 : h).then((r) => w(r)).catch((r) => B(r?.message || "Failed to load assets")).finally(() => g(!1)));
290
- }, [h, x, S]), ne(() => {
291
- x && h === null && I([]);
292
- }, [h, x]), ne(() => {
293
- const r = () => i(window.innerWidth);
290
+ x && (g(!0), L(null), S(u === null ? void 0 : u).then((r) => w(r)).catch((r) => L(r?.message || "Failed to load assets")).finally(() => g(!1)));
291
+ }, [u, x, S]), ne(() => {
292
+ x && u === null && y([]);
293
+ }, [u, x]), ne(() => {
294
+ const r = () => l(window.innerWidth);
294
295
  return window.addEventListener("resize", r), () => window.removeEventListener("resize", r);
295
296
  }, []);
296
- const l = () => {
297
- J(!1), v(null), I([]), B(null);
298
- }, W = (r) => {
299
- r === -1 ? (v(null), I([])) : (v(F[r].id), I(F.slice(0, r + 1)));
300
- }, U = async (r) => {
301
- g(!0), await f({ id: r.id }), w((a) => a.filter((p) => p !== r)), g(!1);
297
+ const F = () => {
298
+ J(!1), W(null), y([]), L(null);
299
+ }, P = (r) => {
300
+ r === -1 ? (W(null), y([])) : (W(N[r].id), y(N.slice(0, r + 1)));
302
301
  }, s = async (r) => {
303
- g(!0), await T({ id: r.id }), w((a) => a.filter((p) => p !== r)), g(!1);
304
- }, E = async () => {
305
- if (!O.trim()) return;
302
+ g(!0), await f({ id: r.id }), w((a) => a.filter((m) => m !== r)), g(!1);
303
+ }, E = async (r) => {
304
+ g(!0), await T({ id: r.id }), w((a) => a.filter((m) => m !== r)), g(!1);
305
+ }, Y = async () => {
306
+ if (!U.trim()) return;
306
307
  g(!0);
307
- const r = await Q({ name: O, parentFolderId: h });
308
- w((a) => [...a, r]), H(""), L(!1), g(!1);
309
- }, Y = async (r) => {
308
+ const r = await Z({ name: U, parentFolderId: u });
309
+ w((a) => [...a, r]), H(""), O(!1), g(!1);
310
+ }, ee = async (r) => {
310
311
  const a = r.target.files;
311
312
  if (!(!a || a.length === 0)) {
312
- j(!0);
313
- for (const p of Array.from(a)) {
314
- if (d && !p.type.match(d.replace("*", ".*")))
313
+ A(!0);
314
+ for (const m of Array.from(a)) {
315
+ if (d && !m.type.match(d.replace("*", ".*")))
315
316
  continue;
316
- const re = await y(p), te = await c({ name: p.name, url: re, parentFolderId: h });
317
- w((be) => [...be, te]);
317
+ const re = await v(m), te = await c({ name: m.name, url: re, parentFolderId: u });
318
+ w((ye) => [...ye, te]);
318
319
  }
319
- j(!1), e.current && (e.current.value = "");
320
+ A(!1), n.current && (n.current.value = "");
320
321
  }
321
- }, ee = (r) => {
322
- r.preventDefault(), D(!0);
323
322
  }, me = (r) => {
323
+ r.preventDefault(), D(!0);
324
+ }, he = (r) => {
324
325
  r.preventDefault(), D(!1);
325
- }, he = async (r) => {
326
+ }, ge = async (r) => {
326
327
  if (r.preventDefault(), D(!1), !!r.dataTransfer.files) {
327
- j(!0);
328
+ A(!0);
328
329
  for (const a of Array.from(r.dataTransfer.files)) {
329
330
  if (d && !a.type.match(d.replace("*", ".*")))
330
331
  continue;
331
- const p = await y(a), re = await c({ name: a.name, url: p, parentFolderId: h });
332
+ const m = await v(a), re = await c({ name: a.name, url: m, parentFolderId: u });
332
333
  w((te) => [...te, re]);
333
334
  }
334
- j(!1);
335
+ A(!1);
335
336
  }
336
337
  }, ae = (r) => {
337
338
  k(r);
338
339
  }, le = (r) => {
339
- v(r.id), I((a) => [...a, r]), k(r);
340
- }, ge = () => {
341
- o && m(o) && (V(o.url), l());
340
+ W(r.id), y((a) => [...a, r]), k(r);
341
+ }, xe = () => {
342
+ o && h(o) && (V(o.url), F());
342
343
  }, se = async () => {
343
- o && (m(o) ? (await U(o), k(null)) : oe(o) && (await s(o), k(null)));
344
- }, de = Math.round(n * 0.8), xe = Math.round(de * 0.6);
344
+ o && (h(o) ? (await s(o), k(null)) : oe(o) && (await E(o), k(null)));
345
+ }, de = Math.round(i * 0.8), be = Math.round(de * 0.6);
345
346
  return x ? /* @__PURE__ */ t.jsx(
346
- we,
347
+ je,
347
348
  {
348
349
  open: x,
349
350
  title: /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between" }, children: [
@@ -351,7 +352,7 @@ const Ae = ({
351
352
  /* @__PURE__ */ t.jsx("div", { style: { display: "flex", flexDirection: "column", alignItems: "flex-end", gap: 0, marginRight: 40, marginTop: -10 }, children: /* @__PURE__ */ t.jsx(
352
353
  "button",
353
354
  {
354
- onClick: () => X(R === "thumbnail" ? "list" : "thumbnail"),
355
+ onClick: () => e(R === "thumbnail" ? "list" : "thumbnail"),
355
356
  style: {
356
357
  background: "none",
357
358
  border: "none",
@@ -365,17 +366,18 @@ const Ae = ({
365
366
  transition: "color 0.2s"
366
367
  },
367
368
  title: R === "thumbnail" ? "List view" : "Thumbnail view",
368
- children: R === "thumbnail" ? /* @__PURE__ */ t.jsx(ke, {}) : /* @__PURE__ */ t.jsx(Re, {})
369
+ children: R === "thumbnail" ? /* @__PURE__ */ t.jsx(Re, {}) : /* @__PURE__ */ t.jsx(Ee, {})
369
370
  }
370
371
  ) })
371
372
  ] }),
372
- onCancel: l,
373
+ onCancel: F,
373
374
  footer: null,
374
375
  width: de,
375
376
  styles: { body: { padding: 0 } },
376
377
  destroyOnHidden: !0,
377
378
  mask: { closable: !1 },
378
379
  centered: !0,
380
+ getContainer: Q,
379
381
  children: /* @__PURE__ */ t.jsxs("div", { className: "simple-image-asset-manager-modal", style: { padding: 24 }, children: [
380
382
  /* @__PURE__ */ t.jsxs("div", { className: "modal-body", style: { display: "flex", gap: 24 }, children: [
381
383
  /* @__PURE__ */ t.jsxs("div", { style: { flex: 1 }, children: [
@@ -385,16 +387,16 @@ const Ae = ({
385
387
  "span",
386
388
  {
387
389
  className: "breadcrumb",
388
- onClick: () => W(-1),
390
+ onClick: () => P(-1),
389
391
  style: { cursor: "pointer", color: "#1890ff", textDecoration: "underline", fontWeight: 500, maxWidth: 120, display: "inline-block", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" },
390
392
  children: "All"
391
393
  }
392
394
  ),
393
- F.map((r, a) => {
394
- const p = a === F.length - 1;
395
+ N.map((r, a) => {
396
+ const m = a === N.length - 1;
395
397
  return /* @__PURE__ */ t.jsxs("span", { style: { display: "flex", alignItems: "center" }, children: [
396
398
  /* @__PURE__ */ t.jsx("span", { style: { margin: "0 4px", fontWeight: 500 }, children: "/" }),
397
- p ? /* @__PURE__ */ t.jsx(
399
+ m ? /* @__PURE__ */ t.jsx(
398
400
  "span",
399
401
  {
400
402
  className: "breadcrumb",
@@ -405,7 +407,7 @@ const Ae = ({
405
407
  "span",
406
408
  {
407
409
  className: "breadcrumb",
408
- onClick: () => W(a),
410
+ onClick: () => P(a),
409
411
  style: { cursor: "pointer", color: "#1890ff", textDecoration: "underline", fontWeight: 500, maxWidth: 120, display: "inline-block", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" },
410
412
  children: r.name
411
413
  }
@@ -413,7 +415,7 @@ const Ae = ({
413
415
  ] }, r.id);
414
416
  })
415
417
  ] }),
416
- z && !G && /* @__PURE__ */ t.jsxs(
418
+ B && !G && /* @__PURE__ */ t.jsxs(
417
419
  "button",
418
420
  {
419
421
  style: {
@@ -432,10 +434,10 @@ const Ae = ({
432
434
  boxShadow: "0 2px 8px rgba(24,144,255,0.12)",
433
435
  transition: "background 0.2s, box-shadow 0.2s"
434
436
  },
435
- onClick: () => L(!0),
437
+ onClick: () => O(!0),
436
438
  children: [
437
439
  /* @__PURE__ */ t.jsx("span", { children: "New folder" }),
438
- /* @__PURE__ */ t.jsx(je, { style: { fontSize: 20 } })
440
+ /* @__PURE__ */ t.jsx(ke, { style: { fontSize: 20 } })
439
441
  ]
440
442
  }
441
443
  )
@@ -443,17 +445,17 @@ const Ae = ({
443
445
  /* @__PURE__ */ t.jsxs(
444
446
  "div",
445
447
  {
446
- className: `drop-area${b ? " drag-active" : ""}`,
447
- onDrop: he,
448
- onDragOver: ee,
449
- onDragLeave: me,
448
+ className: `drop-area${j ? " drag-active" : ""}`,
449
+ onDrop: ge,
450
+ onDragOver: me,
451
+ onDragLeave: he,
450
452
  style: {
451
- border: b ? "2px solid #1890ff" : "2px dashed #aaa",
453
+ border: j ? "2px solid #1890ff" : "2px dashed #aaa",
452
454
  borderRadius: 8,
453
455
  padding: 32,
454
456
  marginBottom: 24,
455
457
  textAlign: "center",
456
- background: b ? "#e6f7ff" : "#fafafa",
458
+ background: j ? "#e6f7ff" : "#fafafa",
457
459
  position: "relative",
458
460
  transition: "border-color 0.3s, background 0.3s"
459
461
  },
@@ -461,24 +463,24 @@ const Ae = ({
461
463
  /* @__PURE__ */ t.jsx("div", { style: {
462
464
  marginBottom: 8,
463
465
  fontWeight: 500
464
- }, children: b ? "Drop file here to upload" : "Drag & drop files here" }),
466
+ }, children: j ? "Drop file here to upload" : "Drag & drop files here" }),
465
467
  /* @__PURE__ */ t.jsx(
466
468
  "button",
467
469
  {
468
- onClick: () => e.current?.click(),
469
- disabled: A,
470
+ onClick: () => n.current?.click(),
471
+ disabled: b,
470
472
  style: {
471
473
  marginBottom: 8,
472
- visibility: b ? "hidden" : "visible",
474
+ visibility: j ? "hidden" : "visible",
473
475
  padding: "8px 24px",
474
476
  borderRadius: 4,
475
- background: A ? "#ccc" : "#1890ff",
477
+ background: b ? "#ccc" : "#1890ff",
476
478
  color: "#fff",
477
479
  border: "none",
478
- cursor: A ? "not-allowed" : "pointer",
480
+ cursor: b ? "not-allowed" : "pointer",
479
481
  fontWeight: 500,
480
482
  fontSize: 15,
481
- boxShadow: A ? "none" : "0 2px 8px rgba(24,144,255,0.12)",
483
+ boxShadow: b ? "none" : "0 2px 8px rgba(24,144,255,0.12)",
482
484
  transition: "background 0.2s, box-shadow 0.2s"
483
485
  },
484
486
  children: "Upload"
@@ -487,24 +489,24 @@ const Ae = ({
487
489
  /* @__PURE__ */ t.jsx(
488
490
  "input",
489
491
  {
490
- ref: e,
492
+ ref: n,
491
493
  type: "file",
492
494
  accept: d,
493
495
  style: { display: "none" },
494
496
  multiple: !0,
495
- onChange: Y
497
+ onChange: ee
496
498
  }
497
499
  ),
498
- A && /* @__PURE__ */ t.jsx("div", { children: "Uploading..." })
500
+ b && /* @__PURE__ */ t.jsx("div", { children: "Uploading..." })
499
501
  ]
500
502
  }
501
503
  ),
502
504
  K ? /* @__PURE__ */ t.jsx("div", { children: "Loading..." }) : q ? /* @__PURE__ */ t.jsx("div", { className: "error", children: q }) : /* @__PURE__ */ t.jsxs("div", { children: [
503
- z && G && /* @__PURE__ */ t.jsxs("div", { style: { marginBottom: 16, display: "flex", alignItems: "center", gap: 8 }, children: [
505
+ B && G && /* @__PURE__ */ t.jsxs("div", { style: { marginBottom: 16, display: "flex", alignItems: "center", gap: 8 }, children: [
504
506
  /* @__PURE__ */ t.jsx(
505
507
  "input",
506
508
  {
507
- value: O,
509
+ value: U,
508
510
  onChange: (r) => H(r.target.value),
509
511
  placeholder: "Folder name",
510
512
  style: {
@@ -524,7 +526,7 @@ const Ae = ({
524
526
  /* @__PURE__ */ t.jsx(
525
527
  "button",
526
528
  {
527
- onClick: E,
529
+ onClick: Y,
528
530
  style: {
529
531
  padding: "8px 16px",
530
532
  borderRadius: 4,
@@ -543,7 +545,7 @@ const Ae = ({
543
545
  /* @__PURE__ */ t.jsx(
544
546
  "button",
545
547
  {
546
- onClick: () => L(!1),
548
+ onClick: () => O(!1),
547
549
  style: {
548
550
  padding: "8px 16px",
549
551
  borderRadius: 4,
@@ -632,8 +634,8 @@ const Ae = ({
632
634
  },
633
635
  r.id
634
636
  )) }),
635
- R === "thumbnail" ? /* @__PURE__ */ t.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 16, marginTop: 16 }, children: C.filter(m).map((r) => {
636
- const a = o && m(o) && o.id === r.id;
637
+ R === "thumbnail" ? /* @__PURE__ */ t.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 16, marginTop: 16 }, children: C.filter(h).map((r) => {
638
+ const a = o && h(o) && o.id === r.id;
637
639
  return /* @__PURE__ */ t.jsxs(
638
640
  "div",
639
641
  {
@@ -677,8 +679,8 @@ const Ae = ({
677
679
  },
678
680
  r.id
679
681
  );
680
- }) }) : /* @__PURE__ */ t.jsx("div", { style: { display: "block", marginTop: 16 }, children: C.filter(m).map((r) => {
681
- const a = o && m(o) && o.id === r.id;
682
+ }) }) : /* @__PURE__ */ t.jsx("div", { style: { display: "block", marginTop: 16 }, children: C.filter(h).map((r) => {
683
+ const a = o && h(o) && o.id === r.id;
682
684
  return /* @__PURE__ */ t.jsxs(
683
685
  "div",
684
686
  {
@@ -717,7 +719,7 @@ const Ae = ({
717
719
  }) })
718
720
  ] })
719
721
  ] }),
720
- o && /* @__PURE__ */ t.jsx("div", { style: { width: xe, minWidth: 320, transition: "width 2s", overflow: "hidden" }, children: /* @__PURE__ */ t.jsxs("div", { style: {
722
+ o && /* @__PURE__ */ t.jsx("div", { style: { width: be, minWidth: 320, transition: "width 2s", overflow: "hidden" }, children: /* @__PURE__ */ t.jsxs("div", { style: {
721
723
  border: "1px solid #eee",
722
724
  borderRadius: 8,
723
725
  padding: 16,
@@ -749,7 +751,7 @@ const Ae = ({
749
751
  children: "Hide"
750
752
  }
751
753
  ),
752
- m(o) ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
754
+ h(o) ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
753
755
  /* @__PURE__ */ t.jsx("img", { src: o.thumbnail || o.url, alt: o.name, style: { width: "100%", maxHeight: 240, objectFit: "contain", borderRadius: 4, marginBottom: 16 } }),
754
756
  /* @__PURE__ */ t.jsx("div", { style: { fontWeight: 500, marginBottom: 8 }, children: o.name }),
755
757
  /* @__PURE__ */ t.jsx("div", { style: { fontSize: 12, color: "#888", marginBottom: 8 }, children: o.url.startsWith("data:") ? "URL: data-uri" : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
@@ -781,7 +783,7 @@ const Ae = ({
781
783
  ] }) : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
782
784
  /* @__PURE__ */ t.jsx("div", { style: { fontSize: 64, marginBottom: 16 }, children: "📁" }),
783
785
  /* @__PURE__ */ t.jsx("div", { style: { fontWeight: 500, marginBottom: 8 }, children: o.name }),
784
- /* @__PURE__ */ t.jsx("div", { style: { fontSize: 12, color: "#888", marginBottom: 8 }, children: `Files: ${C.filter((r) => m(r) && r.parentFolderId === o.id).length}` }),
786
+ /* @__PURE__ */ t.jsx("div", { style: { fontSize: 12, color: "#888", marginBottom: 8 }, children: `Files: ${C.filter((r) => h(r) && r.parentFolderId === o.id).length}` }),
785
787
  /* @__PURE__ */ t.jsxs(
786
788
  "button",
787
789
  {
@@ -815,15 +817,15 @@ const Ae = ({
815
817
  children: /* @__PURE__ */ t.jsx(
816
818
  "button",
817
819
  {
818
- onClick: ge,
819
- disabled: !(o && m(o)),
820
+ onClick: xe,
821
+ disabled: !(o && h(o)),
820
822
  style: {
821
823
  padding: "8px 24px",
822
824
  borderRadius: 4,
823
- background: o && m(o) ? "#1890ff" : "#ccc",
825
+ background: o && h(o) ? "#1890ff" : "#ccc",
824
826
  color: "#fff",
825
827
  border: "none",
826
- cursor: o && m(o) ? "pointer" : "not-allowed",
828
+ cursor: o && h(o) ? "pointer" : "not-allowed",
827
829
  fontWeight: 500
828
830
  },
829
831
  children: "Select"
@@ -836,5 +838,5 @@ const Ae = ({
836
838
  ) : null;
837
839
  };
838
840
  export {
839
- Ae as AssetManager
841
+ Fe as AssetManager
840
842
  };
package/dist/types.d.ts CHANGED
@@ -41,4 +41,5 @@ export interface AssetManagerProps {
41
41
  setVisible: React.Dispatch<React.SetStateAction<boolean>>;
42
42
  showUnacceptedFile?: boolean;
43
43
  addFolderEnabled?: boolean;
44
+ getContainer?: () => HTMLElement;
44
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thanhpv102/simple-image-asset-manager",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.js",
6
6
  "files": [