@ukpc-lib/react 0.10.18 → 0.10.20-dev.2

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.
@@ -29,7 +29,7 @@
29
29
  .tab-content {
30
30
  padding: 16px 0;
31
31
  }
32
- `}),l.jsxs("div",{className:"tab-container",children:[l.jsx("div",{style:{display:"flex",width:"100%",height:"50px",borderBottom:`1px solid ${g.color.grey200}`},className:"tab-container__title",children:t.map((i,s)=>l.jsx("button",{id:i.id,disabled:e.currentTab===`${i.id}`,onClick:n,className:`tab-title ${e.currentTab===`${i.id}`?"is-active":""}`,children:i.tabTitle},s))}),l.jsx("div",{className:"tab-content",children:t.map((i,s)=>l.jsx("div",{children:e.currentTab===`${i.id}`&&l.jsx("div",{children:i.children})},s))})]})]})},cn=({baseUrl:e,notiPath:t,setNotiData:n})=>async()=>{var d;const i=e+(t||"/notification-management/api/v1/notifications"),c=(d=(await g.axiosInstance.get(i,{params:{filter:{notificationFilterType:"all"}}})).data)==null?void 0:d.rows,u=c==null?void 0:c.filter(f=>f.isRead===!1);n({all:{rows:c??[],total:(c==null?void 0:c.length)??0},unread:{rows:u??[],total:(u==null?void 0:u.length)??0}})},So=({notification:e,baseUrl:t,notiPath:n,markAllAsReadState:r,brandColors:o})=>{var v;const[i,s]=T.useState(!1),[c,u]=T.useState({id:e.id,isRead:e.isRead}),d=c.isRead===!1?"unread":"read",f={borderColor:c.isRead?"#c5c5c5":(o==null?void 0:o.primary500)||g.color.primary500,backgroundColor:c.isRead?"#c5c5c5":(o==null?void 0:o.primary500)||g.color.primary500},{setNotiData:h}=T.useContext(g.CustomOpenList),p=cn({baseUrl:t,notiPath:n,setNotiData:h}),b=async(w,S)=>{try{const C=n||`/notification-management/api/v1/notifications/${w}`,x=t+C;await g.axiosInstance.put(x,{isRead:S})}catch(C){console.log(C),u({id:e.id,isRead:e.isRead})}await p()},m=(w,S)=>{console.log("specificNotificationID",w);const C=!S;u(x=>({...x,isRead:C})),console.log("newIsReadState",C),b(w,C)};T.useEffect(()=>{u(r?w=>({...w,isRead:!0}):{id:e.id,isRead:e.isRead})},[r,e.id,e.isRead]);const a=()=>{s(!i)},y=w=>{const S=X(),C=X(w),x=S.diff(C,"days"),_=S.diff(C,"minutes"),E=S.diff(C,"months"),I=S.diff(C,"years");if(console.log("diffInMonths",E),_<1)return"Just now";if(x===0){if(_<=60)return`${_} minute${_>1?"s":""} ago`;const j=Math.floor(_/60);return console.log("diffIhours",j),`${j} hour${j>1?"s":""} ago`}if(x===1)return"Yesterday";if(x>=2&&x<7)return`${x} days ago`;if(x<30){const j=Math.floor(x/7);return`${j} week${j>1?"s":""} ago`}return E===0||E===1?"1 month ago":E<12?`${E} months ago`:I===0||I===1?"1 year ago":"Over 1 year ago"};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"notitification-item__container",children:[l.jsx("div",{className:"notification-item__image-container",children:l.jsx("img",{src:!e.actorAvatarUrl||e.actorName==="System"?"https://ukpcsaprod.blob.core.windows.net/account/logo.png":e.actorAvatarUrl,onError:({currentTarget:w})=>{console.log("img on error",w),w.onerror=null,w.src="https://ukpcsaprod.blob.core.windows.net/account/logo.png"},alt:e.actorName})}),l.jsxs("div",{style:{width:"100%"},children:[l.jsxs("div",{className:"notification-item__content-wrapper",children:[l.jsxs("div",{className:"notification-item__content",children:[l.jsx("p",{className:"notification-item__user-name",children:e.actorName}),l.jsxs("a",{href:e==null?void 0:e.contextUrl,style:{cursor:"pointer"},children:[`${e.message} `,l.jsx("span",{className:"notification-item__context-link",children:e==null?void 0:e.context})]}),(e==null?void 0:e.notificationType)==="deleteMultiple"&&l.jsxs("button",{style:{color:g.color.primary400,textDecoration:"underline"},onClick:a,children:[i?"Hide":"Show "," details"]})]}),l.jsx("div",{className:"notification-item__time",children:l.jsx("p",{children:y(e.createdAt)})}),l.jsx("button",{className:`${d} notification-item__read-at`,"aria-label":"Mark as read",style:f,onClick:()=>m(e.id,e.isRead)})]}),i&&l.jsx("div",{style:{background:"#fff",width:"100%",padding:"8px",fontSize:"12px",marginTop:"8px"},children:l.jsx("ul",{children:(v=e==null?void 0:e.data)==null?void 0:v.map((w,S)=>l.jsxs("li",{style:{display:"flex",alignItems:"center",marginBottom:"4px"},children:[l.jsx("span",{style:{backgroundColor:g.color.primary400},className:"list-dot"}),l.jsx("span",{style:{width:"calc(100% - 12px)"},children:w.name})]},S))})})]})]})})},Tn=({notidata:e,baseUrl:t,notiPath:n,brandColors:r,notiUnreadNumber:o})=>{const[i,s]=T.useState(!1);console.log(i);const{setNotiData:c}=T.useContext(g.CustomOpenList),u=cn({baseUrl:t,notiPath:n,setNotiData:c}),d=async()=>{try{const p=t+(n||"/notification-management/api/v1/notifications");await g.axiosInstance.put(p)}catch(h){console.log(h)}await u(),s(!1)},f=()=>{s(!0),d()};return console.log("notiUnreadNumber",o),l.jsxs("div",{children:[l.jsx("div",{className:"mark-all-read",children:l.jsx("button",{onClick:f,style:{visibility:o===0?"hidden":"visible"},children:"Mark all as read"})}),l.jsx("div",{className:"notification-items__wrapper",children:l.jsx("div",{className:"notification-items__content",children:Object.values(e).map((h,p)=>l.jsx(So,{notification:h,baseUrl:t,notiPath:n,markAllAsReadState:i,brandColors:r},p))})})]})},wo=({baseUrl:e,notiPath:t,brandColors:n})=>{var d,f,h,p;const r=T.useRef(null),{setShowModalFalse:o}=T.useContext(g.CustomOpenList),{notidata:i}=T.useContext(g.CustomOpenList);console.log(i),T.useEffect(()=>{const b=a=>{r.current&&!r.current.contains(a.target)&&!a.target.closest(".noti-container")&&o()},m=setTimeout(()=>{document.addEventListener("mousedown",b)},100);return()=>{clearTimeout(m),document.removeEventListener("mousedown",b)}},[o]);const[s,c]=T.useState("all"),u=[{id:"all",tabTitle:`All (${((d=i==null?void 0:i.all)==null?void 0:d.total)||0})`,children:l.jsx(Tn,{notidata:((f=i==null?void 0:i.all)==null?void 0:f.rows)||[],baseUrl:e,notiPath:t,brandColors:n,notiUnreadNumber:i.unread.total})},{id:"unread",tabTitle:`Unread (${((h=i==null?void 0:i.unread)==null?void 0:h.total)||0})`,children:l.jsx(Tn,{notidata:((p=i==null?void 0:i.unread)==null?void 0:p.rows)||[],baseUrl:e,notiPath:t,brandColors:n,notiUnreadNumber:i.unread.total})}];return l.jsx(l.Fragment,{children:l.jsx("div",{ref:r,style:{position:"absolute",backgroundColor:"#fff",width:"550px",height:"90vh",right:"100px",top:"100%",padding:"32px",boxShadow:"10px 0px 20px #999",borderRadius:"0 0 8px 8px",overflow:"hidden",zIndex:"100"},children:l.jsxs("div",{className:"list-content",children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[l.jsx("h3",{style:{fontSize:"24px",fontWeight:"500",color:g.color.textPrimary},className:"list-title",children:"Notifications"}),l.jsx("button",{onClick:o,children:l.jsx("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M7.05086 6.13616C6.66033 5.74563 6.02717 5.74563 5.63664 6.13616C5.24612 6.52668 5.24612 7.15984 5.63664 7.55037L10.5864 12.5001L5.63664 17.4499C5.24612 17.8404 5.24612 18.4736 5.63664 18.8641C6.02717 19.2546 6.66033 19.2546 7.05086 18.8641L12.0006 13.9143L16.9504 18.8641C17.3409 19.2546 17.974 19.2546 18.3646 18.8641C18.7551 18.4736 18.7551 17.8404 18.3646 17.4499L13.4148 12.5001L18.3646 7.55037C18.7551 7.15984 18.7551 6.52668 18.3646 6.13616C17.974 5.74563 17.3409 5.74563 16.9504 6.13616L12.0006 11.0859L7.05086 6.13616Z",fill:"#85858A"})})})]}),l.jsx(vo,{tabs:u,setCurrentTab:c,currentTab:s,brandColors:n})]})})})};function _o({iconColor:e="#fff",baseUrl:t,notiPath:n,brandColors:r}){var h,p;const{isOpen:o,toggleOpen:i,setShowModalFalse:s}=T.useContext(g.CustomOpenList),{notidata:c,setNotiData:u}=T.useContext(g.CustomOpenList),d=cn({baseUrl:t,notiPath:n,setNotiData:u}),f=async()=>{var b,m;try{await d()}catch(a){g.pushError(((m=(b=a.response)==null?void 0:b.data)==null?void 0:m.errorMessage)||"Have error when get notification list")}};return T.useEffect(()=>{f()},[o]),l.jsxs("div",{children:[l.jsxs("div",{className:"noti-container",style:{position:"relative"},children:[l.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:b=>{b.stopPropagation(),i()},style:{cursor:"pointer",color:e},children:[l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.7968 17.4705C16.5901 17.4705 18.8076 16.8556 19.0218 14.3874C19.0218 11.921 17.4757 12.0796 17.4757 9.05334C17.4757 6.68952 15.2352 4 11.7968 4C8.35833 4 6.1178 6.68952 6.1178 9.05334C6.1178 12.0796 4.57178 11.921 4.57178 14.3874C4.78679 16.8649 7.00428 17.4705 11.7968 17.4705Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M13.8274 20.0286C12.6679 21.3161 10.8591 21.3313 9.68848 20.0286",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),(c==null?void 0:c.unread)&&(c==null?void 0:c.unread.total)!=0&&l.jsx("span",{style:{position:"absolute",top:"-9px",right:"-6px",width:"20px",height:"20px",border:"1px solid #fff",borderRadius:"50%",color:"#fff",fontSize:"12px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:g.color.danger},className:"notification-badge",children:((h=c==null?void 0:c.unread)==null?void 0:h.total)>9?"9+":`${(p=c==null?void 0:c.unread)==null?void 0:p.total}`})]}),l.jsx("div",{className:"noti-list-container",children:o&&l.jsx(wo,{baseUrl:t,notiPath:n,brandColors:r})})]})}const Eo=`.avatar-dropdown-item{padding:.5rem;font-size:.875rem;line-height:1.25rem;cursor:pointer;border-radius:.25rem}.avartarDropdownMenu{background-color:#fff;padding:.5rem;width:13rem;--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);position:absolute;left:-10rem;top:3.2rem}.avartarDropdownMenu ul{list-style:none;padding-inline-start:0;margin-block-end:0}.navbar-wrapper{position:fixed;top:0;left:0;width:100%;height:64px;display:flex;z-index:1000;background:#292929;padding-left:2.5rem}.navbar-container{display:flex;flex-direction:row;align-items:center;width:100%;justify-content:space-between;position:relative}.logo-container{height:100%;display:flex;align-items:center}.right-side-container{display:flex;flex-direction:row;align-items:center;text-align:center;margin-right:2.5rem;gap:1rem}.userContainer{display:flex;align-items:center;gap:.5rem}.userFullName{color:#fff;font-weight:400;font-size:.875rem;line-height:1.25rem;transition:width .3s}.userAvatar{width:2.5rem;height:2.5rem;-o-object-fit:cover;object-fit:cover;border-radius:9999px;border:2px solid #FFFFFF}#userAvatarNull{width:2.5rem;height:2.5rem;background:#DDDDDD;border-radius:100%;color:#fff;font-size:20px;font-weight:400;display:flex;align-items:center;justify-content:center}.relative{position:relative}.cursor-pointer{cursor:pointer}.topbar-search-label{display:flex;position:relative}.topbar-search-input{color:#292929;border-radius:3px;height:40px;outline:none;font-size:14px;text-overflow:ellipsis;max-width:166px}#icon{position:absolute;left:9px;top:8px;width:16px;height:24px}
32
+ `}),l.jsxs("div",{className:"tab-container",children:[l.jsx("div",{style:{display:"flex",width:"100%",height:"50px",borderBottom:`1px solid ${g.color.grey200}`},className:"tab-container__title",children:t.map((i,s)=>l.jsx("button",{id:i.id,disabled:e.currentTab===`${i.id}`,onClick:n,className:`tab-title ${e.currentTab===`${i.id}`?"is-active":""}`,children:i.tabTitle},s))}),l.jsx("div",{className:"tab-content",children:t.map((i,s)=>l.jsx("div",{children:e.currentTab===`${i.id}`&&l.jsx("div",{children:i.children})},s))})]})]})},cn=({baseUrl:e,notiPath:t,setNotiData:n})=>async()=>{var d;const i=e+(t||"/notification-management/api/v1/notifications"),c=(d=(await g.axiosInstance.get(i,{params:{filter:{notificationFilterType:"all"}}})).data)==null?void 0:d.rows,u=c==null?void 0:c.filter(f=>f.isRead===!1);n({all:{rows:c??[],total:(c==null?void 0:c.length)??0},unread:{rows:u??[],total:(u==null?void 0:u.length)??0}})},So=({notification:e,baseUrl:t,notiPath:n,markAllAsReadState:r,brandColors:o})=>{var v;const[i,s]=T.useState(!1),[c,u]=T.useState({id:e.id,isRead:e.isRead}),d=c.isRead===!1?"unread":"read",f={borderColor:c.isRead?"#c5c5c5":(o==null?void 0:o.primary500)||g.color.primary500,backgroundColor:c.isRead?"#c5c5c5":(o==null?void 0:o.primary500)||g.color.primary500},{setNotiData:h}=T.useContext(g.CustomOpenList),p=cn({baseUrl:t,notiPath:n,setNotiData:h}),b=async(w,S)=>{try{const C=n||`/notification-management/api/v1/notifications/${w}`,x=t+C;await g.axiosInstance.put(x,{isRead:S})}catch(C){console.log(C),u({id:e.id,isRead:e.isRead})}await p()},m=(w,S)=>{console.log("specificNotificationID",w);const C=!S;u(x=>({...x,isRead:C})),console.log("newIsReadState",C),b(w,C)};T.useEffect(()=>{u(r?w=>({...w,isRead:!0}):{id:e.id,isRead:e.isRead})},[r,e.id,e.isRead]);const a=()=>{s(!i)},y=w=>{const S=X(),C=X(w),x=S.diff(C,"days"),_=S.diff(C,"minutes"),E=S.diff(C,"months"),I=S.diff(C,"years");if(console.log("diffInMonths",E),_<1)return"Just now";if(x===0){if(_<=60)return`${_} minute${_>1?"s":""} ago`;const j=Math.floor(_/60);return console.log("diffIhours",j),`${j} hour${j>1?"s":""} ago`}if(x===1)return"Yesterday";if(x>=2&&x<7)return`${x} days ago`;if(x<30){const j=Math.floor(x/7);return`${j} week${j>1?"s":""} ago`}return E===0||E===1?"1 month ago":E<12?`${E} months ago`:I===0||I===1?"1 year ago":"Over 1 year ago"};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"notitification-item__container",children:[l.jsx("div",{className:"notification-item__image-container",children:l.jsx("img",{src:!e.actorAvatarUrl||e.actorName==="System"?"https://ukpcsaprod.blob.core.windows.net/account/logo.png":e.actorAvatarUrl,onError:({currentTarget:w})=>{console.log("img on error",w),w.onerror=null,w.src="https://ukpcsaprod.blob.core.windows.net/account/logo.png"},alt:e.actorName})}),l.jsxs("div",{style:{width:"100%"},children:[l.jsxs("div",{className:"notification-item__content-wrapper",children:[l.jsxs("div",{className:"notification-item__content",children:[l.jsx("p",{className:"notification-item__user-name",children:e.actorName}),l.jsxs("a",{href:e==null?void 0:e.contextUrl,style:{cursor:"pointer"},children:[`${e.message} `,l.jsx("span",{className:"notification-item__context-link",children:e==null?void 0:e.context})]}),(e==null?void 0:e.notificationType)==="deleteMultiple"&&l.jsxs("button",{style:{color:g.color.primary400,textDecoration:"underline"},onClick:a,children:[i?"Hide":"Show "," details"]})]}),l.jsx("div",{className:"notification-item__time",children:l.jsx("p",{children:y(e.createdAt)})}),l.jsx("button",{className:`${d} notification-item__read-at`,"aria-label":"Mark as read",style:f,onClick:()=>m(e.id,e.isRead)})]}),i&&l.jsx("div",{style:{background:"#fff",width:"100%",padding:"8px",fontSize:"12px",marginTop:"8px"},children:l.jsx("ul",{children:(v=e==null?void 0:e.data)==null?void 0:v.map((w,S)=>l.jsxs("li",{style:{display:"flex",alignItems:"center",marginBottom:"4px"},children:[l.jsx("span",{style:{backgroundColor:g.color.primary400},className:"list-dot"}),l.jsx("span",{style:{width:"calc(100% - 12px)"},children:w.name})]},S))})})]})]})})},Tn=({notidata:e,baseUrl:t,notiPath:n,brandColors:r,notiUnreadNumber:o})=>{const[i,s]=T.useState(!1);console.log(i);const{setNotiData:c}=T.useContext(g.CustomOpenList),u=cn({baseUrl:t,notiPath:n,setNotiData:c}),d=async()=>{try{const p=t+(n||"/notification-management/api/v1/notifications");await g.axiosInstance.put(p)}catch(h){console.log(h)}await u(),s(!1)},f=()=>{s(!0),d()};return console.log("notiUnreadNumber",o),l.jsxs("div",{children:[l.jsx("div",{className:"mark-all-read",children:l.jsx("button",{onClick:f,style:{visibility:o===0?"hidden":"visible"},children:"Mark all as read"})}),l.jsx("div",{className:"notification-items__wrapper",children:l.jsx("div",{className:"notification-items__content",children:Object.values(e).map((h,p)=>l.jsx(So,{notification:h,baseUrl:t,notiPath:n,markAllAsReadState:i,brandColors:r},p))})})]})},wo=({baseUrl:e,notiPath:t,brandColors:n})=>{var d,f,h,p;const r=T.useRef(null),{setShowModalFalse:o}=T.useContext(g.CustomOpenList),{notidata:i}=T.useContext(g.CustomOpenList);console.log(i),T.useEffect(()=>{const b=a=>{!(!!a.composedPath?a.composedPath():[a.target]).some(S=>{var C;return S===r.current||((C=S==null?void 0:S.classList)==null?void 0:C.contains("noti-container"))})&&o()},m=setTimeout(()=>{document.addEventListener("mousedown",b)},100);return()=>{clearTimeout(m),document.removeEventListener("mousedown",b)}},[o]);const[s,c]=T.useState("all"),u=[{id:"all",tabTitle:`All (${((d=i==null?void 0:i.all)==null?void 0:d.total)||0})`,children:l.jsx(Tn,{notidata:((f=i==null?void 0:i.all)==null?void 0:f.rows)||[],baseUrl:e,notiPath:t,brandColors:n,notiUnreadNumber:i.unread.total})},{id:"unread",tabTitle:`Unread (${((h=i==null?void 0:i.unread)==null?void 0:h.total)||0})`,children:l.jsx(Tn,{notidata:((p=i==null?void 0:i.unread)==null?void 0:p.rows)||[],baseUrl:e,notiPath:t,brandColors:n,notiUnreadNumber:i.unread.total})}];return l.jsx(l.Fragment,{children:l.jsx("div",{ref:r,style:{position:"absolute",backgroundColor:"#fff",width:"550px",height:"90vh",right:"100px",top:"100%",padding:"32px",boxShadow:"10px 0px 20px #999",borderRadius:"0 0 8px 8px",overflow:"hidden",zIndex:"100"},children:l.jsxs("div",{className:"list-content",children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[l.jsx("h3",{style:{fontSize:"24px",fontWeight:"500",color:g.color.textPrimary},className:"list-title",children:"Notifications"}),l.jsx("button",{onClick:o,children:l.jsx("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M7.05086 6.13616C6.66033 5.74563 6.02717 5.74563 5.63664 6.13616C5.24612 6.52668 5.24612 7.15984 5.63664 7.55037L10.5864 12.5001L5.63664 17.4499C5.24612 17.8404 5.24612 18.4736 5.63664 18.8641C6.02717 19.2546 6.66033 19.2546 7.05086 18.8641L12.0006 13.9143L16.9504 18.8641C17.3409 19.2546 17.974 19.2546 18.3646 18.8641C18.7551 18.4736 18.7551 17.8404 18.3646 17.4499L13.4148 12.5001L18.3646 7.55037C18.7551 7.15984 18.7551 6.52668 18.3646 6.13616C17.974 5.74563 17.3409 5.74563 16.9504 6.13616L12.0006 11.0859L7.05086 6.13616Z",fill:"#85858A"})})})]}),l.jsx(vo,{tabs:u,setCurrentTab:c,currentTab:s,brandColors:n})]})})})};function _o({iconColor:e="#fff",baseUrl:t,notiPath:n,brandColors:r}){var h,p;const{isOpen:o,toggleOpen:i,setShowModalFalse:s}=T.useContext(g.CustomOpenList),{notidata:c,setNotiData:u}=T.useContext(g.CustomOpenList),d=cn({baseUrl:t,notiPath:n,setNotiData:u}),f=async()=>{var b,m;try{await d()}catch(a){g.pushError(((m=(b=a.response)==null?void 0:b.data)==null?void 0:m.errorMessage)||"Have error when get notification list")}};return T.useEffect(()=>{f()},[o]),l.jsxs("div",{children:[l.jsxs("div",{className:"noti-container",style:{position:"relative"},children:[l.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:b=>{b.stopPropagation(),i()},style:{cursor:"pointer",color:e},children:[l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.7968 17.4705C16.5901 17.4705 18.8076 16.8556 19.0218 14.3874C19.0218 11.921 17.4757 12.0796 17.4757 9.05334C17.4757 6.68952 15.2352 4 11.7968 4C8.35833 4 6.1178 6.68952 6.1178 9.05334C6.1178 12.0796 4.57178 11.921 4.57178 14.3874C4.78679 16.8649 7.00428 17.4705 11.7968 17.4705Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M13.8274 20.0286C12.6679 21.3161 10.8591 21.3313 9.68848 20.0286",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),(c==null?void 0:c.unread)&&(c==null?void 0:c.unread.total)!=0&&l.jsx("span",{style:{position:"absolute",top:"-9px",right:"-6px",width:"20px",height:"20px",border:"1px solid #fff",borderRadius:"50%",color:"#fff",fontSize:"12px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:g.color.danger},className:"notification-badge",children:((h=c==null?void 0:c.unread)==null?void 0:h.total)>9?"9+":`${(p=c==null?void 0:c.unread)==null?void 0:p.total}`})]}),l.jsx("div",{className:"noti-list-container",children:o&&l.jsx(wo,{baseUrl:t,notiPath:n,brandColors:r})})]})}const Eo=`.avatar-dropdown-item{padding:.5rem;font-size:.875rem;line-height:1.25rem;cursor:pointer;border-radius:.25rem}.avartarDropdownMenu{background-color:#fff;padding:.5rem;width:13rem;--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);position:absolute;left:-10rem;top:3.2rem}.avartarDropdownMenu ul{list-style:none;padding-inline-start:0;margin-block-end:0}.navbar-wrapper{position:fixed;top:0;left:0;width:100%;height:64px;display:flex;z-index:1000;background:#292929;padding-left:2.5rem}.navbar-container{display:flex;flex-direction:row;align-items:center;width:100%;justify-content:space-between;position:relative}.logo-container{height:100%;display:flex;align-items:center}.right-side-container{display:flex;flex-direction:row;align-items:center;text-align:center;margin-right:2.5rem;gap:1rem}.userContainer{display:flex;align-items:center;gap:.5rem}.userFullName{color:#fff;font-weight:400;font-size:.875rem;line-height:1.25rem;transition:width .3s}.userAvatar{width:2.5rem;height:2.5rem;-o-object-fit:cover;object-fit:cover;border-radius:9999px;border:2px solid #FFFFFF}#userAvatarNull{width:2.5rem;height:2.5rem;background:#DDDDDD;border-radius:100%;color:#fff;font-size:20px;font-weight:400;display:flex;align-items:center;justify-content:center}.relative{position:relative}.cursor-pointer{cursor:pointer}.topbar-search-label{display:flex;position:relative}.topbar-search-input{color:#292929;border-radius:3px;height:40px;outline:none;font-size:14px;text-overflow:ellipsis;max-width:166px}#icon{position:absolute;left:9px;top:8px;width:16px;height:24px}
33
33
  `,Co=`::-webkit-scrollbar-track{background:#f1f1f1;border-radius:5px}::-webkit-scrollbar-thumb{background:rgb(194,194,194);border-radius:5px}::-webkit-scrollbar-thumb:hover{background:rgb(117,117,117)}.container{display:flex;width:100%;height:100vh;justify-content:center;align-items:center}.container>div{width:300px;height:40px}.container>div input{width:100%;height:40px;border:1px solid #ccc;border-radius:5px;font-size:14px;color:#000}.container>div input:focus{outline:1px solid rgb(83,172,255)}.list{display:flex;flex-direction:column;max-height:220px;width:inherit;overflow:auto;overflow-x:hidden;box-shadow:#0000001f 0 1px 3px,#0000003d 0 1px 2px;color:#000}.list button{background:none;border:none;width:100%;height:100%;max-height:3em;padding:10px;text-align:left;cursor:pointer;border-bottom:1px solid #ccc}.list button:hover{background:#f8f8f8}.list button:last-child{border-bottom:none}.StyledReactSearchAutocomplete{position:relative;height:46px}.StyledReactSearchAutocomplete .wrapper{position:absolute;display:flex;flex-direction:column;width:100%;border:1px solid #dfe1e5;background-color:#fff;color:#212121;font-size:14px;font-family:inherit;z-index:0;margin-top:2px;border-radius:3px}.StyledReactSearchAutocomplete .wrapper:hover,.StyledReactSearchAutocomplete .wrapper:active,.StyledReactSearchAutocomplete .wrapper:focus-within{box-shadow:#20212447 0 1px 6px}.StyledResults{position:absolute;display:flex;flex-direction:column;border:1px solid #dfe1e5;background-color:#fff;color:#212121;font-size:14px;font-family:inherit;z-index:0;min-width:250px;max-width:400px;top:calc(100% - 2px);left:0}.StyledResults>div.line{border-top-color:#e8eaed;border-top-style:solid;border-top-width:1px;margin:0 20px 0 14px;padding-bottom:4px}.StyledResults>ul{list-style-type:none;margin:0;padding:0 0 16px;max-height:300px;max-width:450px}#autocomplete-results strong,#autocomplete-results li strong,#autocomplete-results li div strong{font-weight:700!important}.StyledResults>ul>li{display:flex;align-items:center;padding:4px 10px 4px 0;font-size:14px;width:100%}.StyledResults>ul>li>div{margin-left:13px;font-size:14px}.StyledResults .ellipsis{text-align:left;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.StyledResults .selectedSearch{color:#fff;text-decoration:none;background-color:#0d6efd}.StyledSearchInput{min-height:40px;width:100%;display:flex;align-items:center}.StyledSearchInput>input::-moz-placeholder{color:gray;opacity:1}.StyledSearchInput>input::placeholder{color:gray;opacity:1}.StyledSearchInput>input:-ms-input-placeholder{color:gray}.StyledSearchInput>input::-ms-input-placeholder{color:gray}.StyledClearIcon{margin:0 0 0 5px}.StyledClearIcon:hover{cursor:pointer}.StyledClearIcon>svg{fill:gray}.StyledSearchIcon{flex-shrink:0;margin:0 0 0 10px;fill:gray}.search-icon{position:unset!important;float:left;margin-right:5px;margin-left:5px}
34
34
  `,To=`:root{--textPrimary: #292929;--textWhite: #fff;--primary500: #2E7D32;--grey100: #FAFAFA;--gray200: #EEEEEE;--gray600: #85858A;--link: #007BFF }.list-content{overflow-y:auto;overflow-x:hidden}.mark-all-read{text-align:right;color:#007bff;margin-bottom:12px;font-size:12px}.notification-items__wrapper{overflow:hidden}.notification-items__content{height:calc(100vh - 275px);overflow-x:hidden;overflow-y:auto;color:#292929}.notitification-item__container{display:flex;justify-content:space-between;padding:16px;border-bottom:#FAFAFA 1px solid;text-align:left;font-size:12px;position:relative;z-index:10;border-radius:4px;margin-bottom:8px}.notitification-item__container:hover{background-color:#fafafa}.notification-item__image-container{width:46px;height:40px;display:flex;justify-content:center;align-items:center;border-radius:50%;overflow:hidden;margin-right:16px}.notification-item__image-container img{width:100%;height:100%;text-align:center;-o-object-fit:cover;object-fit:cover;color:transparent;text-indent:10000px}.notification-item__content-wrapper{width:100%;display:flex;align-items:center;justify-content:space-between}.notification-item__context-link{color:#007bff}.notification-item__content{width:68%;padding-right:16px}.notification-item__user-name{margin-bottom:2px;font-size:14px}.notification-item__time{margin-right:15px;text-align:right}.notification-item__read-at{border-width:2px;border-style:solid;border-radius:50%;width:10px;height:10px;display:block;position:relative}.notification-item__read-at:before{position:absolute;top:-30px;right:0;width:91px;background-color:#85858a;color:#fff;border-radius:4px;font-size:10px;text-align:center;padding:4px;opacity:0;visibility:hidden;transition:all .3s cubic-bezier(.39,.575,.565,1)}.notification-item__read-at:hover:before{opacity:1;visibility:visible}.notification-item__read-at.read:before{content:"Mark as unread"}.notification-item__read-at.unread:before{content:"Mark as read"}.notification-item__read-at.read{border-color:#eee}.notification-item__read-at.unread{border-color:#2e7d32;background-color:#2e7d32}.list-dot{border-radius:50%;width:8px;height:8px;margin-right:4px;display:block}
35
35
  `,Io=`._subscription-diaglog_1bysb_2{position:fixed;width:100vw;height:100vh;top:0;left:0;background-color:#0006;z-index:10000;display:flex;align-items:center;justify-content:center}._subscription-container_1bysb_15{width:610px;height:222px;border-radius:8px;padding:32px 24px 40px;background:#fff;color:#292929}._subscription-title_1bysb_25{font-size:20px;font-weight:500;text-align:center;color:#292929}._subscription-title_1bysb_25,._subscription-text_1bysb_34{margin-bottom:24px}._subscription-btn__container_1bysb_38{display:flex;justify-content:space-between;align-items:center}._btn-success_1bysb_44,._btn-cancel_1bysb_45{width:150px;height:40px;display:flex;align-items:center;justify-content:center;padding:8px;color:#292929;border-radius:1px;transition:background-color .25s cubic-bezier(.4,0,.2,1) 0ms,box-shadow .25s cubic-bezier(.4,0,.2,1) 0ms,border-color .25s cubic-bezier(.4,0,.2,1) 0ms,color .25s cubic-bezier(.4,0,.2,1) 0ms}._btn-cancel_1bysb_45{background-color:#ddd}._btn-cancel_1bysb_45:hover{background-color:#c5c5c5}._btn-success_1bysb_44{background-color:#93d500}._btn-success_1bysb_44:hover{background-color:#2e7d32}
@@ -291,7 +291,12 @@ const xi = (e) => {
291
291
  const r = ve(null), { setShowModalFalse: o } = Ae(Fe), { notidata: i } = Ae(Fe);
292
292
  console.log(i), q(() => {
293
293
  const b = (s) => {
294
- r.current && !r.current.contains(s.target) && !s.target.closest(".noti-container") && o();
294
+ !(!!s.composedPath ? s.composedPath() : [s.target]).some(
295
+ (x) => {
296
+ var E;
297
+ return x === r.current || ((E = x == null ? void 0 : x.classList) == null ? void 0 : E.contains("noti-container"));
298
+ }
299
+ ) && o();
295
300
  }, m = setTimeout(() => {
296
301
  document.addEventListener("mousedown", b);
297
302
  }, 100);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ukpc-lib/react",
3
3
  "private": false,
4
- "version": "0.10.18",
4
+ "version": "0.10.20-dev.2",
5
5
  "type": "module",
6
6
  "main": "./dist/",
7
7
  "module": "./dist/",
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-d5889290.js";
2
- import { F as a, u as s } from "../index-58f4ad32.js";
2
+ import { F as a, u as s } from "../index-07a28114.js";
3
3
  import "../index-c91ec106.js";
4
4
  import "../react-toastify.esm-d8df41b8.js";
5
5
  import "../toast-config/index.js";
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-d5889290.js";
2
- import { G as e } from "../index-58f4ad32.js";
2
+ import { G as e } from "../index-07a28114.js";
3
3
  import "../index-c91ec106.js";
4
4
  import "../react-toastify.esm-d8df41b8.js";
5
5
  import "../toast-config/index.js";
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-d5889290.js";
2
- import { L as e, T as g } from "../index-58f4ad32.js";
2
+ import { L as e, T as g } from "../index-07a28114.js";
3
3
  import "../index-c91ec106.js";
4
4
  import "../react-toastify.esm-d8df41b8.js";
5
5
  import "../toast-config/index.js";
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-d5889290.js";
2
- import { H as e, g as a } from "../index-58f4ad32.js";
2
+ import { H as e, g as a } from "../index-07a28114.js";
3
3
  import "../index-c91ec106.js";
4
4
  import "../react-toastify.esm-d8df41b8.js";
5
5
  import "../toast-config/index.js";