@orangelogic/orange-dam-content-browser-sdk 2.1.40-pr61281.80 → 2.1.41-pr61281.18
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.
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
margin-bottom: var(--cx-spacing-3x-small);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
`;var Ut=n(4413),Vt=n(579);const qt=e=>{let{loadMore:t,isLoading:n,disabled:r=!1,slot:o,disabledIndentation:i}=e;return(0,Vt.jsxs)("cx-space",{direction:"horizontal",slot:o,children:[!i&&(0,Vt.jsx)("div",{className:"browser__load-more__indentation"}),(0,Vt.jsxs)("cx-button",{variant:"text",size:"small",onClick:t,disabled:r,loading:n,className:"browser__load-more",children:[(0,Vt.jsx)("cx-icon",{name:"add",slot:"prefix"}),"More"]})]})},Wt=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Ht=(e,t)=>{if(!t)return e;const n=t.toLowerCase().split(" ").filter(Boolean),r=n.map(Wt),o=new RegExp(`(${r.join("|")})`,"gi");return e.split(o).map(((e,t)=>n.includes(e.toLowerCase())?(0,Vt.jsx)("strong",{children:e},t):e))},Kt=e=>{var t;let{allowedFolders:n,folder:r,currentFolderID:o,icon:i,searchText:a,useSession:s}=e;const[l,c]=(0,wt.useState)(!1),[u,d]=(0,wt.useState)(!1),[h,p]=(0,wt.useState)({start:0,pageSize:Ut.VH}),f=(0,wt.useRef)(null),m=o===r.id,{data:g,isFetching:v,isLoading:b}=(0,Rt.Jz)({allowedFolders:n,folder:r,searchText:"",useSession:s,start:h.start,pageSize:h.pageSize},{skip:!u}),y=(0,wt.useMemo)((()=>{var e;return null!==(e=null===g||void 0===g?void 0:g.items)&&void 0!==e?e:void 0}),[g]),x=null!==(t=null===g||void 0===g?void 0:g.totalCount)&&void 0!==t?t:0,w=(0,wt.useCallback)((()=>{const e=(null===y||void 0===y?void 0:y.length)||0;e>=x||p((t=>({...t,start:e})))}),[null===y||void 0===y?void 0:y.length,x]);(0,wt.useEffect)((()=>{Promise.all([customElements.whenDefined("cx-tree-item")]).then((()=>{c(!0)}))}),[l]),(0,wt.useEffect)((()=>{const e=f.current;if(!e)return;const t=()=>{d(!0)},n=e=>{e.detail.target===f.current&&d(!1)};return e.addEventListener("cx-lazy-load",t),e.addEventListener("cx-expand",t),e.addEventListener("cx-collapse",n),()=>{e.removeEventListener("cx-lazy-load",t),e.removeEventListener("cx-expand",t),e.removeEventListener("cx-collapse",n)}}),[l]);const k=(0,wt.useMemo)((()=>{let e;return e=i||("Album"===r.docType?"share":"folder"),e}),[r.docType,i]),S=r.hasChildren&&(void 0===y||v);return(0,Vt.jsxs)(Vt.Fragment,{children:[(0,Vt.jsxs)("cx-tree-item",{ref:f,"data-value":JSON.stringify(r),expanded:u,selected:m,lazy:S,children:[(0,Vt.jsx)("cx-icon",{name:k}),(0,Vt.jsx)("cx-line-clamp",{lines:1,children:Ht(r.title,a)}),null===y||void 0===y?void 0:y.map((e=>(0,Vt.jsx)(Kt,{folder:e,searchText:a,currentFolderID:o},e.id)))]}),y&&y.length<x&&!b&&(0,Vt.jsx)(qt,{loadMore:w,isLoading:v,disabled:v})]})},$t=Kt,Qt=e=>{var t,n;let{allowedFolders:r,collectionPath:o,currentFolder:i,favoriteFolderId:a,focusInput:s,lastLocationMode:l,open:c,showCollections:u,showFavoriteFolder:d,useSession:h,onFolderSelect:p,onClose:f}=e;const[m,g]=(0,wt.useState)(""),[v,b]=(0,wt.useState)(!1),[y,x]=(0,wt.useState)(!1),[w,k]=(0,wt.useState)(!1),[S,_]=(0,wt.useState)({start:0,pageSize:Ut.VH}),[E,C]=(0,wt.useState)({start:0,pageSize:Ut.VH}),A=(0,wt.useRef)(null),T=(0,wt.useRef)(null),O=(0,wt.useRef)(null),P=(0,wt.useRef)(null),z=(0,wt.useRef)(!0);(0,wt.useEffect)((()=>{Promise.all([customElements.whenDefined("cx-drawer"),customElements.whenDefined("cx-input"),customElements.whenDefined("cx-tree")]).then((()=>{b(!0)}))}),[]),(0,wt.useEffect)((()=>{const e=O.current;if(!e)return;const t=Se((e=>{const t=e.target.value;m!==t&&(t.length>2||0===t.length)&&g(t)}),500);return e.addEventListener("cx-input",t),()=>{e.removeEventListener("cx-input",t)}}),[v,m]),(0,wt.useEffect)((()=>{const e=T.current;if(!e)return;const t=()=>{f()};return e.addEventListener("cx-request-close",t),()=>{e.removeEventListener("cx-request-close",t)}}),[v,f]);const{data:D,isLoading:R,isFetching:N,isError:j}=(0,Rt.Jz)({allowedFolders:r,folder:jt,searchText:m,useSession:h,start:S.start,pageSize:S.pageSize}),I=(0,wt.useMemo)((()=>{var e;return null!==(e=null===D||void 0===D?void 0:D.items)&&void 0!==e?e:void 0}),[D]),M=null!==(t=null===D||void 0===D?void 0:D.totalCount)&&void 0!==t?t:0,L=(0,wt.useCallback)((()=>{if(!I)return;const e=I.length;e>=M||(x(!0),_((t=>({...t,start:e}))))}),[I,M]);(0,wt.useEffect)((()=>{const e=()=>{if(!I)return;if(r&&r.length>0){const e=I.find((e=>r.includes(e.id)));if(e)return void p(e)}const e=I.find((e=>e.title===Dt.mT));p(e||jt)};z.current&&I&&(z.current=!1,l?(0,Mt.bQ)("lastLocation").then((t=>{if("string"===typeof t)try{const n=JSON.parse(t);if(n.id===a&&!d||r&&r.length>0)return void e();p(n)}catch(n){e()}else e()})).catch((()=>{e()})):e())}),[r,a,I,l,p,d]);const{data:F,isLoading:B,isFetching:U,isError:V}=(0,Rt.$Y)(o?{folder:o,searchText:m,useSession:h,start:E.start,pageSize:E.pageSize}:Lt.hT),q=(0,wt.useMemo)((()=>{var e;return null!==(e=null===F||void 0===F?void 0:F.items)&&void 0!==e?e:void 0}),[F]),W=null!==(n=null===F||void 0===F?void 0:F.totalCount)&&void 0!==n?n:0,H=(0,wt.useCallback)((()=>{if(!q)return;k(!0);const e=q.length;e>=W||C((t=>({...t,start:e})))}),[q,W]);(0,wt.useEffect)((()=>{const e=P.current;if(!e)return;const t=e=>{var t;const n=JSON.parse(null!==(t=e.detail.selection[0].dataset.value)&&void 0!==t?t:"{}");null===p||void 0===p||p(n)};return e.addEventListener("cx-selection-change",t),()=>{e.removeEventListener("cx-selection-change",t)}}),[v,p]),(0,wt.useEffect)((()=>{const e=A.current;if(!e)return;const t=e=>{var t;const n=JSON.parse(null!==(t=e.detail.item.value)&&void 0!==t?t:"{}");null===p||void 0===p||p(n)};return e.addEventListener("cx-select",t),()=>{e.removeEventListener("cx-select",t)}}),[v,q,p]),(0,wt.useEffect)((()=>{N||x(!1)}),[N]),(0,wt.useEffect)((()=>{U||k(!1)}),[U]);const K=(0,wt.useCallback)((()=>{if(R||N&&!y)return Array.from({length:5}).map(((e,t)=>(0,Vt.jsx)("cx-skeleton",{},t)));if(I&&I.length>0){const e=[];return a&&e.push((0,Vt.jsx)($t,{folder:{id:a,title:"My Favorites",docType:"Story",path:[],parents:[],fullPath:"My Favorites",hasChildren:!1},currentFolderID:i.id,icon:"star",useSession:h},a)),[...e,...(null!==I&&void 0!==I?I:[]).map((e=>(0,Vt.jsx)($t,{allowedFolders:r,folder:e,currentFolderID:i.id,searchText:m,useSession:h},e.id)))]}return j?(0,Vt.jsx)("cx-typography",{variant:"body3",children:"Failed to load folders"}):(0,Vt.jsx)("cx-typography",{variant:"body3",children:"No folders found"})}),[r,i.id,a,I,j,N,R,m,h,y]),$=(0,wt.useCallback)((()=>B||U&&!w?Array.from({length:5}).map(((e,t)=>(0,Vt.jsx)("cx-skeleton",{},t))):q&&q.length>0?null===q||void 0===q?void 0:q.map((e=>{const t=i.id===e.id;return(0,Vt.jsxs)("cx-menu-item",{value:JSON.stringify(e),className:""+(t?"selected":""),children:[(0,Vt.jsx)("cx-icon",{slot:"prefix",name:"collections"}),Ht(e.title,m)]},e.id)})):V?(0,Vt.jsx)("cx-typography",{variant:"body3",children:"Failed to load collections"}):(0,Vt.jsx)("cx-typography",{variant:"body3",children:"No collections found"})),[B,U,q,V,i.id,m,w]);return(0,Vt.jsx)(Bt,{ref:T,label:"Browser",placement:"start",contained:!0,open:c,children:(0,Vt.jsxs)("cx-space",{direction:"vertical",spacing:"small",wrap:"nowrap",children:[(0,Vt.jsxs)("cx-space",{direction:"vertical",spacing:"small",style:{padding:"var(--body-spacing) var(--body-spacing) 0"},children:[(0,Vt.jsx)("cx-typography",{variant:"body3",children:"Folders"}),(0,Vt.jsx)("cx-input",{ref:O,value:m,placeholder:"Search...",clearable:!0,autoFocus:s,className:"search-input",children:(0,Vt.jsx)("cx-icon",{name:"search",slot:"prefix",className:"icon--large"})}),(0,Vt.
|
|
106
|
+
`;var Ut=n(4413),Vt=n(579);const qt=e=>{let{loadMore:t,isLoading:n,disabled:r=!1,slot:o,disabledIndentation:i}=e;return(0,Vt.jsxs)("cx-space",{direction:"horizontal",slot:o,children:[!i&&(0,Vt.jsx)("div",{className:"browser__load-more__indentation"}),(0,Vt.jsxs)("cx-button",{variant:"text",size:"small",onClick:t,disabled:r,loading:n,className:"browser__load-more",children:[(0,Vt.jsx)("cx-icon",{name:"add",slot:"prefix"}),"More"]})]})},Wt=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Ht=(e,t)=>{if(!t)return e;const n=t.toLowerCase().split(" ").filter(Boolean),r=n.map(Wt),o=new RegExp(`(${r.join("|")})`,"gi");return e.split(o).map(((e,t)=>n.includes(e.toLowerCase())?(0,Vt.jsx)("strong",{children:e},t):e))},Kt=e=>{var t;let{allowedFolders:n,folder:r,currentFolderID:o,icon:i,searchText:a,useSession:s}=e;const[l,c]=(0,wt.useState)(!1),[u,d]=(0,wt.useState)(!1),[h,p]=(0,wt.useState)({start:0,pageSize:Ut.VH}),f=(0,wt.useRef)(null),m=o===r.id,{data:g,isFetching:v,isLoading:b}=(0,Rt.Jz)({allowedFolders:n,folder:r,searchText:"",useSession:s,start:h.start,pageSize:h.pageSize},{skip:!u}),y=(0,wt.useMemo)((()=>{var e;return null!==(e=null===g||void 0===g?void 0:g.items)&&void 0!==e?e:void 0}),[g]),x=null!==(t=null===g||void 0===g?void 0:g.totalCount)&&void 0!==t?t:0,w=(0,wt.useCallback)((()=>{const e=(null===y||void 0===y?void 0:y.length)||0;e>=x||p((t=>({...t,start:e})))}),[null===y||void 0===y?void 0:y.length,x]);(0,wt.useEffect)((()=>{Promise.all([customElements.whenDefined("cx-tree-item")]).then((()=>{c(!0)}))}),[l]),(0,wt.useEffect)((()=>{const e=f.current;if(!e)return;const t=()=>{d(!0)},n=e=>{e.detail.target===f.current&&d(!1)};return e.addEventListener("cx-lazy-load",t),e.addEventListener("cx-expand",t),e.addEventListener("cx-collapse",n),()=>{e.removeEventListener("cx-lazy-load",t),e.removeEventListener("cx-expand",t),e.removeEventListener("cx-collapse",n)}}),[l]);const k=(0,wt.useMemo)((()=>{let e;return e=i||("Album"===r.docType?"share":"folder"),e}),[r.docType,i]),S=r.hasChildren&&(void 0===y||v);return(0,Vt.jsxs)(Vt.Fragment,{children:[(0,Vt.jsxs)("cx-tree-item",{ref:f,"data-value":JSON.stringify(r),expanded:u,selected:m,lazy:S,children:[(0,Vt.jsx)("cx-icon",{name:k}),(0,Vt.jsx)("cx-line-clamp",{lines:1,children:Ht(r.title,a)}),null===y||void 0===y?void 0:y.map((e=>(0,Vt.jsx)(Kt,{folder:e,searchText:a,currentFolderID:o},e.id)))]}),y&&y.length<x&&!b&&(0,Vt.jsx)(qt,{loadMore:w,isLoading:v,disabled:v})]})},$t=Kt,Qt=e=>{var t,n;let{allowedFolders:r,collectionPath:o,currentFolder:i,favoriteFolderId:a,focusInput:s,lastLocationMode:l,open:c,showCollections:u,showFavoriteFolder:d,useSession:h,onFolderSelect:p,onClose:f}=e;const[m,g]=(0,wt.useState)(""),[v,b]=(0,wt.useState)(!1),[y,x]=(0,wt.useState)(!1),[w,k]=(0,wt.useState)(!1),[S,_]=(0,wt.useState)({start:0,pageSize:Ut.VH}),[E,C]=(0,wt.useState)({start:0,pageSize:Ut.VH}),A=(0,wt.useRef)(null),T=(0,wt.useRef)(null),O=(0,wt.useRef)(null),P=(0,wt.useRef)(null),z=(0,wt.useRef)(!0);(0,wt.useEffect)((()=>{Promise.all([customElements.whenDefined("cx-drawer"),customElements.whenDefined("cx-input"),customElements.whenDefined("cx-tree")]).then((()=>{b(!0)}))}),[]),(0,wt.useEffect)((()=>{const e=O.current;if(!e)return;const t=Se((e=>{const t=e.target.value;m!==t&&(t.length>2||0===t.length)&&g(t)}),500);return e.addEventListener("cx-input",t),()=>{e.removeEventListener("cx-input",t)}}),[v,m]),(0,wt.useEffect)((()=>{const e=T.current;if(!e)return;const t=()=>{f()};return e.addEventListener("cx-request-close",t),()=>{e.removeEventListener("cx-request-close",t)}}),[v,f]);const{data:D,isLoading:R,isFetching:N,isError:j}=(0,Rt.Jz)({allowedFolders:r,folder:jt,searchText:m,useSession:h,start:S.start,pageSize:S.pageSize}),I=(0,wt.useMemo)((()=>{var e;return null!==(e=null===D||void 0===D?void 0:D.items)&&void 0!==e?e:void 0}),[D]),M=null!==(t=null===D||void 0===D?void 0:D.totalCount)&&void 0!==t?t:0,L=(0,wt.useCallback)((()=>{if(!I)return;const e=I.length;e>=M||(x(!0),_((t=>({...t,start:e}))))}),[I,M]);(0,wt.useEffect)((()=>{const e=()=>{if(!I)return;if(r&&r.length>0){const e=I.find((e=>r.includes(e.id)));if(e)return void p(e)}const e=I.find((e=>e.title===Dt.mT));p(e||jt)};z.current&&I&&(z.current=!1,l?(0,Mt.bQ)("lastLocation").then((t=>{if("string"===typeof t)try{const n=JSON.parse(t);if(n.id===a&&!d||r&&r.length>0)return void e();p(n)}catch(n){e()}else e()})).catch((()=>{e()})):e())}),[r,a,I,l,p,d]);const{data:F,isLoading:B,isFetching:U,isError:V}=(0,Rt.$Y)(o?{folder:o,searchText:m,useSession:h,start:E.start,pageSize:E.pageSize}:Lt.hT),q=(0,wt.useMemo)((()=>{var e;return null!==(e=null===F||void 0===F?void 0:F.items)&&void 0!==e?e:void 0}),[F]),W=null!==(n=null===F||void 0===F?void 0:F.totalCount)&&void 0!==n?n:0,H=(0,wt.useCallback)((()=>{if(!q)return;k(!0);const e=q.length;e>=W||C((t=>({...t,start:e})))}),[q,W]);(0,wt.useEffect)((()=>{const e=P.current;if(!e)return;const t=e=>{var t;const n=JSON.parse(null!==(t=e.detail.selection[0].dataset.value)&&void 0!==t?t:"{}");null===p||void 0===p||p(n)};return e.addEventListener("cx-selection-change",t),()=>{e.removeEventListener("cx-selection-change",t)}}),[v,p]),(0,wt.useEffect)((()=>{const e=A.current;if(!e)return;const t=e=>{var t;const n=JSON.parse(null!==(t=e.detail.item.value)&&void 0!==t?t:"{}");null===p||void 0===p||p(n)};return e.addEventListener("cx-select",t),()=>{e.removeEventListener("cx-select",t)}}),[v,q,p]),(0,wt.useEffect)((()=>{N||x(!1)}),[N]),(0,wt.useEffect)((()=>{U||k(!1)}),[U]);const K=(0,wt.useCallback)((()=>{if(R||N&&!y)return Array.from({length:5}).map(((e,t)=>(0,Vt.jsx)("cx-skeleton",{},t)));if(I&&I.length>0){const e=[];return a&&e.push((0,Vt.jsx)($t,{folder:{id:a,title:"My Favorites",docType:"Story",path:[],parents:[],fullPath:"My Favorites",hasChildren:!1},currentFolderID:i.id,icon:"star",useSession:h},a)),[...e,...(null!==I&&void 0!==I?I:[]).map((e=>(0,Vt.jsx)($t,{allowedFolders:r,folder:e,currentFolderID:i.id,searchText:m,useSession:h},e.id)))]}return j?(0,Vt.jsx)("cx-typography",{variant:"body3",children:"Failed to load folders"}):(0,Vt.jsx)("cx-typography",{variant:"body3",children:"No folders found"})}),[r,i.id,a,I,j,N,R,m,h,y]),$=(0,wt.useCallback)((()=>B||U&&!w?Array.from({length:5}).map(((e,t)=>(0,Vt.jsx)("cx-skeleton",{},t))):q&&q.length>0?null===q||void 0===q?void 0:q.map((e=>{const t=i.id===e.id;return(0,Vt.jsxs)("cx-menu-item",{value:JSON.stringify(e),className:""+(t?"selected":""),children:[(0,Vt.jsx)("cx-icon",{slot:"prefix",name:"collections"}),Ht(e.title,m)]},e.id)})):V?(0,Vt.jsx)("cx-typography",{variant:"body3",children:"Failed to load collections"}):(0,Vt.jsx)("cx-typography",{variant:"body3",children:"No collections found"})),[B,U,q,V,i.id,m,w]);return(0,Vt.jsx)(Bt,{ref:T,label:"Browser",placement:"start",contained:!0,open:c,children:(0,Vt.jsxs)("cx-space",{direction:"vertical",spacing:"small",wrap:"nowrap",children:[(0,Vt.jsxs)("cx-space",{direction:"vertical",spacing:"small",style:{padding:"var(--body-spacing) var(--body-spacing) 0"},children:[(0,Vt.jsx)("cx-typography",{variant:"body3",children:"Folders"}),(0,Vt.jsx)("cx-input",{ref:O,value:m,placeholder:"Search...",clearable:!0,autoFocus:s,className:"search-input",children:(0,Vt.jsx)("cx-icon",{name:"search",slot:"prefix",className:"icon--large"})}),(0,Vt.jsx)("div",{className:"browser__folders",children:(0,Vt.jsxs)("cx-tree",{ref:P,"force-on-change":!0,children:[K(),I&&I.length<M&&!R&&(0,Vt.jsx)(qt,{loadMore:L,isLoading:N,disabled:N})]})})]}),u&&(0,Vt.jsx)("div",{className:"browser__collections",children:(0,Vt.jsxs)("cx-details",{children:[(0,Vt.jsx)("cx-typography",{slot:"summary",variant:"body3",children:"Collections"}),(0,Vt.jsxs)("cx-menu",{ref:A,className:"browser__collections__menu",children:[$(),q&&q.length<W&&!B&&(0,Vt.jsx)(qt,{loadMore:H,isLoading:U,disabled:U,disabledIndentation:!0})]})]})})]})})};var Xt=n(1158);const Gt=[{label:"Ascending",value:"ascending",icon:()=>(0,Vt.jsxs)("svg",{slot:"prefix",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,Vt.jsx)("path",{d:"M3.33333 4.7619L4.25984 5.68841L6.60714 3.33929V11.3095H7.61905V3.33929L9.96627 5.68841L10.8929 4.7619L6.96429 0.833333L3.33333 4.7619Z",fill:"currentColor"}),(0,Vt.jsx)("path",{opacity:"0.3",d:"M17.0833 15.2381L16.1568 14.3116L13.8095 16.6607V8.69048H12.7976V16.6607L10.4504 14.3116L9.52381 15.2381L13.4524 19.1667L17.0833 15.2381Z",fill:"currentColor"})]})},{label:"Descending",value:"descending",icon:()=>(0,Vt.jsxs)("svg",{slot:"prefix",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,Vt.jsx)("path",{opacity:"0.3",d:"M3.33333 4.7619L4.25984 5.68841L6.60714 3.33929V11.3095H7.61905V3.33929L9.96627 5.68841L10.8929 4.7619L6.96429 0.833333L3.33333 4.7619Z",fill:"currentColor"}),(0,Vt.jsx)("path",{d:"M17.0833 15.2381L16.1568 14.3116L13.8095 16.6607V8.69048H12.7976V16.6607L10.4504 14.3116L9.52381 15.2381L13.4524 19.1667L17.0833 15.2381Z",fill:"currentColor"})]})}],Zt=[{value:Xt.gf.Small,label:"Small labeled"},{value:Xt.gf.Medium,label:"Medium labeled"},{value:Xt.gf.Large,label:"Large labeled"}],Yt=Ft.Ay.div`
|
|
107
107
|
display: flex;
|
|
108
108
|
justify-content: space-between;
|
|
109
109
|
flex-wrap: wrap;
|
|
@@ -191,6 +191,7 @@
|
|
|
191
191
|
position: relative;
|
|
192
192
|
width: 100%;
|
|
193
193
|
height: 350px;
|
|
194
|
+
min-height: 350px;
|
|
194
195
|
display: flex;
|
|
195
196
|
align-items: center;
|
|
196
197
|
justify-content: center;
|