@ukpc-lib/react 0.1.13 → 0.1.14

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.
@@ -1,2 +1 @@
1
- declare const UnauthorizedPage: () => import("react/jsx-runtime").JSX.Element;
2
- export default UnauthorizedPage;
1
+ export declare const UnauthorizedPage: () => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ukpc-lib/react",
3
3
  "private": false,
4
- "version": "0.1.13",
4
+ "version": "0.1.14",
5
5
  "type": "module",
6
6
  "main": "./dist/",
7
7
  "module": "./dist/",
@@ -35,7 +35,7 @@
35
35
  * Copyright(c) 2015 Douglas Christopher Wilson
36
36
  * MIT Licensed
37
37
  */var _g=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,qP=/\\([\u000b\u0020-\u00ff])/g,GP=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,$P=XP;function XP(e){if(!e)throw new TypeError("argument string is required");var t=typeof e=="object"?KP(e):e;if(typeof t!="string")throw new TypeError("argument string is required to be a string");var n=t.indexOf(";"),i=n!==-1?t.slice(0,n).trim():t.trim();if(!GP.test(i))throw new TypeError("invalid media type");var a=new ZP(i.toLowerCase());if(n!==-1){var l,f,d;for(_g.lastIndex=n;f=_g.exec(t);){if(f.index!==n)throw new TypeError("invalid parameter format");n+=f[0].length,l=f[1].toLowerCase(),d=f[2],d.charCodeAt(0)===34&&(d=d.slice(1,-1),d.indexOf("\\")!==-1&&(d=d.replace(qP,"$1"))),a.parameters[l]=d}if(n!==t.length)throw new TypeError("invalid parameter format")}return a}function KP(e){var t;if(typeof e.getHeader=="function"?t=e.getHeader("content-type"):typeof e.headers=="object"&&(t=e.headers&&e.headers["content-type"]),typeof t!="string")throw new TypeError("content-type header is missing from object");return t}function ZP(e){this.parameters=Object.create(null),this.type=e}var Fs=new Map,Gv=function(t){return t.cloneNode(!0)},Sg=function(){return window.location.protocol==="file:"},$v=function(t,n,i){var a=new XMLHttpRequest;a.onreadystatechange=function(){try{if(!/\.svg/i.test(t)&&a.readyState===2){var l=a.getResponseHeader("Content-Type");if(!l)throw new Error("Content type not found");var f=$P(l).type;if(!(f==="image/svg+xml"||f==="text/plain"))throw new Error("Invalid content type: ".concat(f))}if(a.readyState===4){if(a.status===404||a.responseXML===null)throw new Error(Sg()?"Note: SVG injection ajax calls do not work locally without adjusting security settings in your browser. Or consider using a local webserver.":"Unable to load SVG file: "+t);if(a.status===200||Sg()&&a.status===0)i(null,a);else throw new Error("There was a problem injecting the SVG: "+a.status+" "+a.statusText)}}catch(d){if(a.abort(),d instanceof Error)i(d,a);else throw d}},a.open("GET",t),a.withCredentials=n,a.overrideMimeType&&a.overrideMimeType("text/xml"),a.send()},Pi={},Eg=function(t,n){Pi[t]=Pi[t]||[],Pi[t].push(n)},JP=function(t){for(var n=function(f,d){setTimeout(function(){if(Array.isArray(Pi[t])){var y=Fs.get(t),v=Pi[t][f];y instanceof SVGSVGElement&&v(null,Gv(y)),y instanceof Error&&v(y),f===Pi[t].length-1&&delete Pi[t]}},0)},i=0,a=Pi[t].length;i<a;i++)n(i)},QP=function(t,n,i){if(Fs.has(t)){var a=Fs.get(t);if(a===void 0){Eg(t,i);return}if(a instanceof SVGSVGElement){i(null,Gv(a));return}}Fs.set(t,void 0),Eg(t,i),$v(t,n,function(l,f){var d;l?Fs.set(t,l):((d=f.responseXML)===null||d===void 0?void 0:d.documentElement)instanceof SVGSVGElement&&Fs.set(t,f.responseXML.documentElement),JP(t)})},eO=function(t,n,i){$v(t,n,function(a,l){var f;a?i(a):((f=l.responseXML)===null||f===void 0?void 0:f.documentElement)instanceof SVGSVGElement&&i(null,l.responseXML.documentElement)})},tO=0,nO=function(){return++tO},wr=[],Dg={},rO="http://www.w3.org/2000/svg",Df="http://www.w3.org/1999/xlink",Tg=function(t,n,i,a,l,f,d){var y=t.getAttribute("data-src")||t.getAttribute("src");if(!y){d(new Error("Invalid data-src or src attribute"));return}if(wr.indexOf(t)!==-1){wr.splice(wr.indexOf(t),1),t=null;return}wr.push(t),t.setAttribute("src","");var v=a?QP:eO;v(y,l,function(_,x){if(!x){wr.splice(wr.indexOf(t),1),t=null,d(_);return}var k=t.getAttribute("id");k&&x.setAttribute("id",k);var P=t.getAttribute("title");P&&x.setAttribute("title",P);var M=t.getAttribute("width");M&&x.setAttribute("width",M);var R=t.getAttribute("height");R&&x.setAttribute("height",R);var H=Array.from(new Set(Ef(Ef(Ef([],(x.getAttribute("class")||"").split(" "),!0),["injected-svg"],!1),(t.getAttribute("class")||"").split(" "),!0))).join(" ").trim();x.setAttribute("class",H);var F=t.getAttribute("style");F&&x.setAttribute("style",F),x.setAttribute("data-src",y);var Z=[].filter.call(t.attributes,function(Me){return/^data-\w[\w-]*$/.test(Me.name)});if(Array.prototype.forEach.call(Z,function(Me){Me.name&&Me.value&&x.setAttribute(Me.name,Me.value)}),i){var G={clipPath:["clip-path"],"color-profile":["color-profile"],cursor:["cursor"],filter:["filter"],linearGradient:["fill","stroke"],marker:["marker","marker-start","marker-mid","marker-end"],mask:["mask"],path:[],pattern:["fill","stroke"],radialGradient:["fill","stroke"]},oe,re,se,p,ce;Object.keys(G).forEach(function(Me){oe=Me,se=G[Me],re=x.querySelectorAll(oe+"[id]");for(var xt=function(Ft,Mn){p=re[Ft].id,ce=p+"-"+nO();var Ct;Array.prototype.forEach.call(se,function(Xn){Ct=x.querySelectorAll("["+Xn+'*="'+p+'"]');for(var kt=0,Pr=Ct.length;kt<Pr;kt++){var ai=Ct[kt].getAttribute(Xn);ai&&!ai.match(new RegExp('url\\("?#'+p+'"?\\)'))||Ct[kt].setAttribute(Xn,"url(#"+ce+")")}});for(var Wt=x.querySelectorAll("[*|href]"),Rn=[],rn=0,sn=Wt.length;rn<sn;rn++){var Et=Wt[rn].getAttributeNS(Df,"href");Et&&Et.toString()==="#"+re[Ft].id&&Rn.push(Wt[rn])}for(var Lt=0,an=Rn.length;Lt<an;Lt++)Rn[Lt].setAttributeNS(Df,"href","#"+ce);re[Ft].id=ce},St=0,Oe=re.length;St<Oe;St++)xt(St)})}x.removeAttribute("xmlns:a");for(var ae=x.querySelectorAll("script"),et=[],gt,Ze,_e=0,tt=ae.length;_e<tt;_e++)Ze=ae[_e].getAttribute("type"),(!Ze||Ze==="application/ecmascript"||Ze==="application/javascript"||Ze==="text/javascript")&&(gt=ae[_e].innerText||ae[_e].textContent,gt&&et.push(gt),x.removeChild(ae[_e]));if(et.length>0&&(n==="always"||n==="once"&&!Dg[y])){for(var Bt=0,at=et.length;Bt<at;Bt++)new Function(et[Bt])(window);Dg[y]=!0}var Ge=x.querySelectorAll("style");if(Array.prototype.forEach.call(Ge,function(Me){Me.textContent+=""}),x.setAttribute("xmlns",rO),x.setAttribute("xmlns:xlink",Df),f(x),!t.parentNode){wr.splice(wr.indexOf(t),1),t=null,d(new Error("Parent node is null"));return}t.parentNode.replaceChild(x,t),wr.splice(wr.indexOf(t),1),t=null,d(null,x)})},iO=function(t,n){var i=n===void 0?{}:n,a=i.afterAll,l=a===void 0?function(){}:a,f=i.afterEach,d=f===void 0?function(){}:f,y=i.beforeEach,v=y===void 0?function(){}:y,_=i.cacheRequests,x=_===void 0?!0:_,k=i.evalScripts,P=k===void 0?"never":k,M=i.httpRequestWithCredentials,R=M===void 0?!1:M,H=i.renumerateIRIElements,F=H===void 0?!0:H;if(t&&"length"in t)for(var Z=0,G=0,oe=t.length;G<oe;G++)Tg(t[G],P,F,x,R,v,function(re,se){d(re,se),t&&"length"in t&&t.length===++Z&&l(Z)});else t?Tg(t,P,F,x,R,v,function(re,se){d(re,se),l(1),t=null}):l(0)},sO=function(t){var n=(t==null?void 0:t.ownerDocument)||document;return n.defaultView||window},aO=function(t,n){for(var i in t)if(!(i in n))return!0;for(var a in n)if(t[a]!==n[a])return!0;return!1},oO=["afterInjection","beforeInjection","desc","evalScripts","fallback","httpRequestWithCredentials","loading","renumerateIRIElements","src","title","useRequestCache","wrapper"],Il="http://www.w3.org/2000/svg",Cg="http://www.w3.org/1999/xlink",Ih=function(e){zP(t,e);function t(){for(var i,a=arguments.length,l=new Array(a),f=0;f<a;f++)l[f]=arguments[f];return i=e.call.apply(e,[this].concat(l))||this,i.initialState={hasError:!1,isLoading:!0},i.state=i.initialState,i._isMounted=!1,i.reactWrapper=void 0,i.nonReactWrapper=void 0,i.refCallback=function(d){i.reactWrapper=d},i}var n=t.prototype;return n.renderSVG=function(){var a=this;if(this.reactWrapper instanceof sO(this.reactWrapper).Node){var l=this.props,f=l.desc,d=l.evalScripts,y=l.httpRequestWithCredentials,v=l.renumerateIRIElements,_=l.src,x=l.title,k=l.useRequestCache,P=this.props.onError,M=this.props.beforeInjection,R=this.props.afterInjection,H=this.props.wrapper,F,Z;H==="svg"?(F=document.createElementNS(Il,H),F.setAttribute("xmlns",Il),F.setAttribute("xmlns:xlink",Cg),Z=document.createElementNS(Il,H)):(F=document.createElement(H),Z=document.createElement(H)),F.appendChild(Z),Z.dataset.src=_,this.nonReactWrapper=this.reactWrapper.appendChild(F);var G=function(p){if(a.removeSVG(),!a._isMounted){P(p);return}a.setState(function(){return{hasError:!0,isLoading:!1}},function(){P(p)})},oe=function(p,ce){if(p){G(p);return}a._isMounted&&a.setState(function(){return{isLoading:!1}},function(){try{R(ce)}catch(ae){G(ae)}})},re=function(p){if(p.setAttribute("role","img"),f){var ce=p.querySelector(":scope > desc");ce&&p.removeChild(ce);var ae=document.createElement("desc");ae.innerHTML=f,p.prepend(ae)}if(x){var et=p.querySelector(":scope > title");et&&p.removeChild(et);var gt=document.createElement("title");gt.innerHTML=x,p.prepend(gt)}try{M(p)}catch(Ze){G(Ze)}};iO(Z,{afterEach:oe,beforeEach:re,cacheRequests:k,evalScripts:d,httpRequestWithCredentials:y,renumerateIRIElements:v})}},n.removeSVG=function(){var a;(a=this.nonReactWrapper)!=null&&a.parentNode&&(this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper),this.nonReactWrapper=null)},n.componentDidMount=function(){this._isMounted=!0,this.renderSVG()},n.componentDidUpdate=function(a){var l=this;aO(ou({},a),this.props)&&this.setState(function(){return l.initialState},function(){l.removeSVG(),l.renderSVG()})},n.componentWillUnmount=function(){this._isMounted=!1,this.removeSVG()},n.render=function(){var a=this.props;a.afterInjection,a.beforeInjection,a.desc,a.evalScripts;var l=a.fallback;a.httpRequestWithCredentials;var f=a.loading;a.renumerateIRIElements,a.src,a.title,a.useRequestCache;var d=a.wrapper,y=HP(a,oO),v=d;return B.reactExports.createElement(v,ou({},y,{ref:this.refCallback},d==="svg"?{xmlns:Il,xmlnsXlink:Cg}:{}),this.state.isLoading&&f&&B.reactExports.createElement(f,null),this.state.hasError&&l&&B.reactExports.createElement(l,null))},t}(B.reactExports.Component);Ih.defaultProps={afterInjection:function(){},beforeInjection:function(){},desc:"",evalScripts:"never",fallback:null,httpRequestWithCredentials:!1,loading:null,onError:function(){},renumerateIRIElements:!0,title:"",useRequestCache:!0,wrapper:"div"};Ih.propTypes={afterInjection:B.propTypesExports.func,beforeInjection:B.propTypesExports.func,desc:B.propTypesExports.string,evalScripts:B.propTypesExports.oneOf(["always","once","never"]),fallback:B.propTypesExports.oneOfType([B.propTypesExports.func,B.propTypesExports.object,B.propTypesExports.string]),httpRequestWithCredentials:B.propTypesExports.bool,loading:B.propTypesExports.oneOfType([B.propTypesExports.func,B.propTypesExports.object,B.propTypesExports.string]),onError:B.propTypesExports.func,renumerateIRIElements:B.propTypesExports.bool,src:B.propTypesExports.string.isRequired,title:B.propTypesExports.string,useRequestCache:B.propTypesExports.bool,wrapper:B.propTypesExports.oneOf(["div","span","svg"])};function lO(e){return B.jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16",...e,children:B.jsxRuntimeExports.jsx("path",{fill:"currenColor",d:"M4.427 7.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 7H4.604a.25.25 0 00-.177.427z"})})}function uO(e){const{children:t,parentRef:n,onlyChild:i}=e,[a,l]=B.reactExports.useState({top:0,left:0});return B.reactExports.useLayoutEffect(()=>{if(n.current){const f=n.current.getBoundingClientRect();l({top:f.top,left:f.left+f.width})}},[n]),i?t:B.reactDomExports.createPortal(B.jsxRuntimeExports.jsx(Nv.div,{style:{position:"fixed",top:a.top,left:a.left,zIndex:1200},children:t}),n.current)}function Xv({item:e,level:t=0,...n}){var p;const{isActive:i,isCollapsed:a,expanded:l,toggleExpand:f}=n,d=`level-${t}`,y=a?"collapsed":"expanded",v=i(e.id)?"active":"",_=(ce,ae=d)=>`${ce} ${ae} ${y} ${v}`,x=!!((p=e.children)!=null&&p.length),[k,P]=B.reactExports.useState(!1),M=B.reactExports.useRef();function R(ce){var Ze;const{level:ae,hovered:et,parentRef:gt}=ce;return!x||a&&ae>=2&&!et?null:B.jsxRuntimeExports.jsx(uO,{parentRef:gt,onlyChild:!a||a&&ae<2,children:B.jsxRuntimeExports.jsx(Nv.div,{className:_("menu-item__dropdown",`level-${ae}`),initial:{height:a?"auto":0},animate:{height:a||l(e.id)?"auto":0},transition:{duration:.2},children:(Ze=e.children)==null?void 0:Ze.map(_e=>B.reactExports.createElement(Xv,{...n,key:_e.id,item:_e,level:ae}))},+a)})}const H=window.location.origin,F=e.path&&e.path.includes("http")?new URL(e.path):{origin:"",pathname:""},Z=window.location.pathname.split("/")[1],G=F.pathname.split("/")[1],oe=n.ssr||!H.includes("local")&&H!==F.origin||G!==Z,re=x?"div":oe?"a":YP,se=e.path||"#";return B.jsxRuntimeExports.jsxs("div",{ref:M,className:_("menu-item__wrapper"),onMouseEnter:()=>a&&P(!0),onMouseLeave:()=>a&&P(!1),children:[B.jsxRuntimeExports.jsxs(re,{to:se,href:se,style:{paddingLeft:`${a?"0.5rem":`${t*1}rem`}`},className:_("menu-item__link"),onClick:ce=>{x&&(ce.preventDefault(),a||f(e.id))},children:[t!==0&&B.jsxRuntimeExports.jsx(cO,{cls:_,item:e}),B.jsxRuntimeExports.jsx("span",{className:_("menu-item__label"),children:e.name}),x&&B.jsxRuntimeExports.jsx("div",{className:_("menu-item__icon-arrow__wrapper"),children:B.jsxRuntimeExports.jsx(lO,{className:_(`menu-item__icon-arrow__icon ${l(e.id)?"open":"close"}`)})})]}),R({level:t+1,hovered:k,parentRef:M})]},e.id)}function cO({item:e,cls:t}){var f,d;const[n,i]=B.reactExports.useState(!1),a=()=>{i(!0)},l=(f=e.icon)==null?void 0:f.endsWith(".svg");return B.jsxRuntimeExports.jsx("div",{className:t("menu-item__icon"),children:n?B.jsxRuntimeExports.jsx("div",{style:{width:24,height:24,backgroundColor:"#dadada",borderRadius:"5px",display:"flex",justifyContent:"center",alignItems:"center"},children:(d=e.name.trim().at(0))==null?void 0:d.toUpperCase()}):l?B.jsxRuntimeExports.jsx(Ih,{src:e.icon,beforeInjection:y=>{y.setAttribute("style","margin: 0 auto;"),y.querySelectorAll("path").forEach(_=>{_.setAttribute("stroke","currentColor")})}}):B.jsxRuntimeExports.jsx("img",{src:e.icon||"/",alt:" ",style:{height:24,maxHeight:24},onError:a})})}function fO(){return B.jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",children:B.jsxRuntimeExports.jsx("path",{d:"M21 18v2H3v-2h18zM6.596 3.903L8.01 5.318 4.828 8.5 8.01 11.68l-1.414 1.415L2 8.5l4.596-4.597zM21 11v2h-9v-2h9zm0-7v2h-9V4h9z"})})}function hO(){return B.jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",children:B.jsxRuntimeExports.jsx("path",{d:"M3 4h18v2H3V4zm0 7h18v2H3v-2zm0 7h18v2H3v-2z"})})}function dO(e){return B.jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"20",fill:"none",viewBox:"0 0 18 20",...e,children:B.jsxRuntimeExports.jsx("path",{fill:"#E01B00",fillRule:"evenodd",d:"M.179 2.875A2.375 2.375 0 012.554.5h3.393a1.018 1.018 0 010 2.036H2.554a.34.34 0 00-.34.339v14.25c0 .187.152.34.34.34h3.393a1.018 1.018 0 110 2.035H2.554a2.375 2.375 0 01-2.375-2.375V2.875zm14.167 6.107h-7.72a1.018 1.018 0 000 2.036h7.72l-2.673 2.673a1.018 1.018 0 101.44 1.44l4.41-4.411a1.018 1.018 0 000-1.44l-4.41-4.41a1.018 1.018 0 10-1.44 1.439l2.673 2.673z",clipRule:"evenodd"})})}const pO=`.side-bar{display:flex;flex-direction:column;max-width:18rem;height:calc(100vh - 64px);border-right:1px solid #ddd;background-color:#fafafa;transition:all .3s;padding:0 8px}.side-bar.expanded{width:18rem}.side-bar.collapsed{width:64px;padding-left:4px;padding-right:4px}.side-bar__menu{margin-left:-8px;margin-right:-8px;padding-left:8px;padding-right:8px}.side-bar__menu.collapsed{margin-left:-4px;margin-right:-4px;padding-left:4px;padding-right:4px}.side-bar__wrap-btn-logout,.side-bar__btn-logout{margin:40px 0}.side-bar__logout-btn__text{margin-left:12px}.side-bar__logout-btn__text.collapsed{display:none}.side-bar__wrapper-toggle-btn{display:flex;flex-direction:row;justify-content:flex-end;transition:all .3s;margin-right:-8px;margin-top:40px}.side-bar__wrapper-toggle-btn.collapsed{justify-content:center;width:100%}.side-bar__toggle-btn{margin-top:-6px;color:#85858a}.side-bar__logout-btn{width:100%;text-align:left;display:flex;flex-direction:row;align-items:center;padding:0 16px;min-height:48px;border-radius:.375rem}.side-bar__logout-btn:hover{background-color:#919eab14}.side-bar__logout-btn.collapsed{justify-content:center}.menu-item__wrapper{display:flex;flex-direction:column;position:relative;width:100%;margin-top:4px}.menu-item__wrapper:first-child,.menu-item__wrapper.collapsed{margin-top:0}.menu-item__wrapper.collapsed.level-1{margin-top:4px}.menu-item__link{display:flex;flex-direction:row;border-radius:.375rem;align-items:center;padding:.5rem;position:relative;height:48px;cursor:pointer;color:#85858a}.menu-item__link:hover{background-color:#919eab14}.menu-item__link.active{background-color:#009d4f1a!important;color:#009d4f!important}.menu-item__link.level-0{height:auto}.menu-item__link.menu-item__link.collapsed.level-0{display:none}.menu-item__icon{width:1.5rem;height:1.5rem;flex-shrink:0}.menu-item__icon.collapsed.level-1{width:100%}.menu-item__icon.collapsed.level-1>*{margin:0 auto}.menu-item__label{font-size:.875rem;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:100%;flex-shrink:1;margin-left:12px;padding-right:12px;color:#292929}.menu-item__label.active{color:inherit}.menu-item__label.collapsed{margin-left:8px;font-size:.75rem;line-height:1rem}.menu-item__label.collapsed.level-1{text-align:center;margin-left:0;display:none}.menu-item__label.level-0{color:#85858a}.menu-item__icon-arrow__wrapper{display:grid;place-items:center;position:absolute;top:50%;transform:translateY(-50%);right:-3px}.menu-item__icon-arrow__wrapper.expanded{right:0}.menu-item__icon-arrow__icon{transition:all .3s!important;transform:rotate(-90deg)!important}.menu-item__icon-arrow__icon.active{color:inherit}.menu-item__icon-arrow__icon.expanded.open{transform:rotate(0)!important}.menu-item__dropdown.collapsed{background-color:#fafafa;border:1px solid #ddd;box-shadow:#0000001a 0 10px 15px -3px,#0000000d 0 4px 6px -2px;border-radius:4px;width:180px;max-width:180px;padding:4px;z-index:1200}.menu-item__dropdown.collapsed .menu-item__link{height:40px}.menu-item__dropdown.collapsed .menu-item__link.level-1{height:48px}.menu-item__dropdown.collapsed.level-1{width:auto;max-width:unset;box-shadow:none;border:none;padding:0;background-color:unset}.menu-item__dropdown.expanded{margin-top:4px;overflow:hidden}.icon-btn{display:inline-flex;align-items:center;justify-content:center;padding:8px;border-radius:50%;background-color:transparent;transition:background-color .3s ease;border:none}.icon-btn:hover{background-color:var(--btn-bg-hover)}.simplebar-scrollbar:before{background-color:#0000002d}
38
- `,mO="@ukpc-lib/react",gO="0.1.13",yO="module",vO="./dist/",xO="./dist/",bO={"./components":{import:"./dist/components/index.js",require:"./dist/components/index.cjs",types:"./dist/components/index.d.ts"},"./share":{import:"./dist/share/index.js",require:"./dist/share/index.cjs",types:"./dist/share/index.d.ts"}},wO={"*":{"*":["./dist/*/index.d.ts"]}},_O=["dist","web-components-bundle"],SO={dev:"vite --open --port 3000",build:"npm run build-react && npm run build-wc","build-react":"tsc && vite build --config vite.config.react.ts","build-wc":"tsc && vite build --config vite.config.wc.ts --mode production",lint:"eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",preview:"vite preview",publish:"npm publish --access public","build-publish":"npm run build && npm version patch && npm run build && npm run publish && git push"},EO={"@emotion/react":"^11.11.3","@emotion/styled":"^11.11.0","@mui/icons-material":"^5.15.4","@mui/material":"^5.15.4","@r2wc/react-to-web-component":"^2.0.3","@rollup/plugin-replace":"^5.0.5",axios:"^1.6.5","bootstrap-daterangepicker":"^3.1.0",cssnano:"^6.0.3","framer-motion":"^10.18.0",jquery:"^3.7.1",moment:"^2.30.1","react-bootstrap-daterangepicker":"^8.0.0","react-query":"^3.39.3","react-router-dom":"^6.21.3","react-shadow":"^20.4.0","react-svg":"^16.1.32","react-toastify":"^10.0.4","react-window":"^1.8.10","react-window-infinite-loader":"^1.0.9","simplebar-react":"^3.2.4","usehooks-ts":"^2.15.1","vite-plugin-css-injected-by-js":"^3.3.1"},DO={"@types/node":"^20.8.10","@types/react":"^18.2.15","@types/react-dom":"^18.2.7","@types/react-window-infinite-loader":"^1.0.9","@typescript-eslint/eslint-plugin":"^6.0.0","@typescript-eslint/parser":"^6.0.0","@vitejs/plugin-react-swc":"^3.3.2",autoprefixer:"^10.4.16",eslint:"^8.45.0","eslint-plugin-react-hooks":"^4.6.0","eslint-plugin-react-refresh":"^0.4.3",postcss:"^8.4.33",prettier:"^3.0.3",react:"^18.2.0","react-dom":"^18.2.0",tailwindcss:"^3.4.1",typescript:"^5.0.2",vite:"^4.5.1","vite-plugin-css-injected-by-js":"^3.3.1","vite-plugin-dts":"^3.7.0","vite-plugin-lib-inject-css":"^1.3.0"},TO={"@mui/material":"^5.15.4",react:"^18.2.0","react-dom":"^18.2.0","react-query":"^3.39.3","react-router-dom":"^6.21.3",tailwindcss:"^3.4.1"},CO="Thinh Phung",kO="![Screenshot 2024-01-22 at 11 40 08](https://github.com/UKParkingControl/LibShareJS/assets/153060345/99004010-67a2-436b-a5b7-317992137205)",AO="ISC",PO={name:mO,private:!1,version:gO,type:yO,main:vO,module:xO,exports:bO,typesVersions:wO,files:_O,scripts:SO,dependencies:EO,devDependencies:DO,peerDependencies:TO,author:CO,description:kO,license:AO};function OO(e){return B.jsxRuntimeExports.jsx(B.ShadowDomWrapper,{styles:[KD,pO],style:{zIndex:1200},children:B.jsxRuntimeExports.jsx(MO,{...e})})}function MO(e){const{baseUrl:t,menuPath:n}=e,i=Au(),[a,l]=B.reactExports.useState([]),[f,d]=B.reactExports.useState(!1),[y,v]=B.reactExports.useState({}),_=Kv(a),x=window.location.origin+i.pathname,k=RO(_,x).filter(G=>G.parentKey!==0);console.log("matchPaths:",k);const P=G=>{v({...y,[G]:!y[G]})},M=()=>{d(!f)};B.reactExports.useEffect(()=>{(async()=>{const oe=t+(n||"/global-menu-config/api/v1/menu-items/user"),re=await dD.get(oe,{withCredentials:!0}).then(ce=>ce.data).catch(ce=>{var ae,et;sT(((et=(ae=ce.response)==null?void 0:ae.data)==null?void 0:et.errorMessage)||"Have error when get menu items")}),se={};re.forEach(ce=>{ce.children&&(se[ce.id]=!0)}),v(se);let p=re.map(ce=>({...ce,parentKey:0}));e.replacePath&&(p=Zv(p,e.replacePath)),l(p)})()},[t,n,e.replacePath]);const[R,H]=B.reactExports.useState(!1),F=f?"collapsed":"expanded",Z=G=>`${G} ${F}`;return B.jsxRuntimeExports.jsxs("div",{className:Z("side-bar"),children:[B.jsxRuntimeExports.jsxs("div",{style:{display:"none"},children:["Version: ",PO.version]}),B.jsxRuntimeExports.jsx("div",{className:Z("side-bar__wrapper-toggle-btn"),children:B.jsxRuntimeExports.jsx("button",{className:"icon-btn side-bar__toggle-btn",onClick:M,children:f?B.jsxRuntimeExports.jsx(hO,{}):B.jsxRuntimeExports.jsx(fO,{})})}),B.jsxRuntimeExports.jsx(fy,{className:Z("side-bar__menu"),style:{marginTop:24,flex:1,overflow:"auto",height:"100%",overflowX:"hidden"},children:a.map(G=>{const oe=re=>k.some(se=>se.id===re);return B.jsxRuntimeExports.jsx(Xv,{item:G,isActive:oe,isCollapsed:f,expanded:re=>y[re],toggleExpand:P,replacePath:e.replacePath,ssr:e.ssr},G.id)})}),B.jsxRuntimeExports.jsxs("div",{className:Z("side-bar__wrap-btn-logout"),children:[B.jsxRuntimeExports.jsxs("button",{className:Z("side-bar__logout-btn"),onClick:()=>H(!0),children:[B.jsxRuntimeExports.jsx(dO,{}),B.jsxRuntimeExports.jsx("span",{className:Z("side-bar__logout-btn__text"),children:"Logout"})]}),B.jsxRuntimeExports.jsx(B.LogoutConfirmModal,{isOpen:R,onClose:()=>H(!1),onConfirm:()=>e.logout?e.logout():ZD(e.baseUrl)})]})]})}function Kv(e){let t=[];for(const n of e)t.push(n),n.children&&(t=t.concat(Kv(n.children)));return t}function RO(e,t){let n=e.find(a=>a.path&&t.includes(a.path)),i=[];for(;n;)i=[n,...i],n=e.find(a=>a.id===n.parentKey);return i}function Zv(e,t){return e.map(n=>(n.path&&(n.path=t(n.path)),n.children&&n.children.length>0&&(n.children=Zv(n.children,t)),n))}var lu={exports:{}};/**
38
+ `,mO="@ukpc-lib/react",gO="0.1.14",yO="module",vO="./dist/",xO="./dist/",bO={"./components":{import:"./dist/components/index.js",require:"./dist/components/index.cjs",types:"./dist/components/index.d.ts"},"./share":{import:"./dist/share/index.js",require:"./dist/share/index.cjs",types:"./dist/share/index.d.ts"}},wO={"*":{"*":["./dist/*/index.d.ts"]}},_O=["dist","web-components-bundle"],SO={dev:"vite --open --port 3000",build:"npm run build-react && npm run build-wc","build-react":"tsc && vite build --config vite.config.react.ts","build-wc":"tsc && vite build --config vite.config.wc.ts --mode production",lint:"eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",preview:"vite preview",publish:"npm publish --access public","build-publish":"npm run build && npm version patch && npm run build && npm run publish && git push"},EO={"@emotion/react":"^11.11.3","@emotion/styled":"^11.11.0","@mui/icons-material":"^5.15.4","@mui/material":"^5.15.4","@r2wc/react-to-web-component":"^2.0.3","@rollup/plugin-replace":"^5.0.5",axios:"^1.6.5","bootstrap-daterangepicker":"^3.1.0",cssnano:"^6.0.3","framer-motion":"^10.18.0",jquery:"^3.7.1",moment:"^2.30.1","react-bootstrap-daterangepicker":"^8.0.0","react-query":"^3.39.3","react-router-dom":"^6.21.3","react-shadow":"^20.4.0","react-svg":"^16.1.32","react-toastify":"^10.0.4","react-window":"^1.8.10","react-window-infinite-loader":"^1.0.9","simplebar-react":"^3.2.4","usehooks-ts":"^2.15.1","vite-plugin-css-injected-by-js":"^3.3.1"},DO={"@types/node":"^20.8.10","@types/react":"^18.2.15","@types/react-dom":"^18.2.7","@types/react-window-infinite-loader":"^1.0.9","@typescript-eslint/eslint-plugin":"^6.0.0","@typescript-eslint/parser":"^6.0.0","@vitejs/plugin-react-swc":"^3.3.2",autoprefixer:"^10.4.16",eslint:"^8.45.0","eslint-plugin-react-hooks":"^4.6.0","eslint-plugin-react-refresh":"^0.4.3",postcss:"^8.4.33",prettier:"^3.0.3",react:"^18.2.0","react-dom":"^18.2.0",tailwindcss:"^3.4.1",typescript:"^5.0.2",vite:"^4.5.1","vite-plugin-css-injected-by-js":"^3.3.1","vite-plugin-dts":"^3.7.0","vite-plugin-lib-inject-css":"^1.3.0"},TO={"@mui/material":"^5.15.4",react:"^18.2.0","react-dom":"^18.2.0","react-query":"^3.39.3","react-router-dom":"^6.21.3",tailwindcss:"^3.4.1"},CO="Thinh Phung",kO="![Screenshot 2024-01-22 at 11 40 08](https://github.com/UKParkingControl/LibShareJS/assets/153060345/99004010-67a2-436b-a5b7-317992137205)",AO="ISC",PO={name:mO,private:!1,version:gO,type:yO,main:vO,module:xO,exports:bO,typesVersions:wO,files:_O,scripts:SO,dependencies:EO,devDependencies:DO,peerDependencies:TO,author:CO,description:kO,license:AO};function OO(e){return B.jsxRuntimeExports.jsx(B.ShadowDomWrapper,{styles:[KD,pO],style:{zIndex:1200},children:B.jsxRuntimeExports.jsx(MO,{...e})})}function MO(e){const{baseUrl:t,menuPath:n}=e,i=Au(),[a,l]=B.reactExports.useState([]),[f,d]=B.reactExports.useState(!1),[y,v]=B.reactExports.useState({}),_=Kv(a),x=window.location.origin+i.pathname,k=RO(_,x).filter(G=>G.parentKey!==0);console.log("matchPaths:",k);const P=G=>{v({...y,[G]:!y[G]})},M=()=>{d(!f)};B.reactExports.useEffect(()=>{(async()=>{const oe=t+(n||"/global-menu-config/api/v1/menu-items/user"),re=await dD.get(oe,{withCredentials:!0}).then(ce=>ce.data).catch(ce=>{var ae,et;sT(((et=(ae=ce.response)==null?void 0:ae.data)==null?void 0:et.errorMessage)||"Have error when get menu items")}),se={};re.forEach(ce=>{ce.children&&(se[ce.id]=!0)}),v(se);let p=re.map(ce=>({...ce,parentKey:0}));e.replacePath&&(p=Zv(p,e.replacePath)),l(p)})()},[t,n,e.replacePath]);const[R,H]=B.reactExports.useState(!1),F=f?"collapsed":"expanded",Z=G=>`${G} ${F}`;return B.jsxRuntimeExports.jsxs("div",{className:Z("side-bar"),children:[B.jsxRuntimeExports.jsxs("div",{style:{display:"none"},children:["Version: ",PO.version]}),B.jsxRuntimeExports.jsx("div",{className:Z("side-bar__wrapper-toggle-btn"),children:B.jsxRuntimeExports.jsx("button",{className:"icon-btn side-bar__toggle-btn",onClick:M,children:f?B.jsxRuntimeExports.jsx(hO,{}):B.jsxRuntimeExports.jsx(fO,{})})}),B.jsxRuntimeExports.jsx(fy,{className:Z("side-bar__menu"),style:{marginTop:24,flex:1,overflow:"auto",height:"100%",overflowX:"hidden"},children:a.map(G=>{const oe=re=>k.some(se=>se.id===re);return B.jsxRuntimeExports.jsx(Xv,{item:G,isActive:oe,isCollapsed:f,expanded:re=>y[re],toggleExpand:P,replacePath:e.replacePath,ssr:e.ssr},G.id)})}),B.jsxRuntimeExports.jsxs("div",{className:Z("side-bar__wrap-btn-logout"),children:[B.jsxRuntimeExports.jsxs("button",{className:Z("side-bar__logout-btn"),onClick:()=>H(!0),children:[B.jsxRuntimeExports.jsx(dO,{}),B.jsxRuntimeExports.jsx("span",{className:Z("side-bar__logout-btn__text"),children:"Logout"})]}),B.jsxRuntimeExports.jsx(B.LogoutConfirmModal,{isOpen:R,onClose:()=>H(!1),onConfirm:()=>e.logout?e.logout():ZD(e.baseUrl)})]})]})}function Kv(e){let t=[];for(const n of e)t.push(n),n.children&&(t=t.concat(Kv(n.children)));return t}function RO(e,t){let n=e.find(a=>a.path&&t.includes(a.path)),i=[];for(;n;)i=[n,...i],n=e.find(a=>a.id===n.parentKey);return i}function Zv(e,t){return e.map(n=>(n.path&&(n.path=t(n.path)),n.children&&n.children.length>0&&(n.children=Zv(n.children,t)),n))}var lu={exports:{}};/**
39
39
  * @license
40
40
  * Lodash <https://lodash.com/>
41
41
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
@@ -7488,7 +7488,7 @@ var sN = nD((uN, Kl) => {
7488
7488
  );
7489
7489
  }
7490
7490
  const EO = `.side-bar{display:flex;flex-direction:column;max-width:18rem;height:calc(100vh - 64px);border-right:1px solid #ddd;background-color:#fafafa;transition:all .3s;padding:0 8px}.side-bar.expanded{width:18rem}.side-bar.collapsed{width:64px;padding-left:4px;padding-right:4px}.side-bar__menu{margin-left:-8px;margin-right:-8px;padding-left:8px;padding-right:8px}.side-bar__menu.collapsed{margin-left:-4px;margin-right:-4px;padding-left:4px;padding-right:4px}.side-bar__wrap-btn-logout,.side-bar__btn-logout{margin:40px 0}.side-bar__logout-btn__text{margin-left:12px}.side-bar__logout-btn__text.collapsed{display:none}.side-bar__wrapper-toggle-btn{display:flex;flex-direction:row;justify-content:flex-end;transition:all .3s;margin-right:-8px;margin-top:40px}.side-bar__wrapper-toggle-btn.collapsed{justify-content:center;width:100%}.side-bar__toggle-btn{margin-top:-6px;color:#85858a}.side-bar__logout-btn{width:100%;text-align:left;display:flex;flex-direction:row;align-items:center;padding:0 16px;min-height:48px;border-radius:.375rem}.side-bar__logout-btn:hover{background-color:#919eab14}.side-bar__logout-btn.collapsed{justify-content:center}.menu-item__wrapper{display:flex;flex-direction:column;position:relative;width:100%;margin-top:4px}.menu-item__wrapper:first-child,.menu-item__wrapper.collapsed{margin-top:0}.menu-item__wrapper.collapsed.level-1{margin-top:4px}.menu-item__link{display:flex;flex-direction:row;border-radius:.375rem;align-items:center;padding:.5rem;position:relative;height:48px;cursor:pointer;color:#85858a}.menu-item__link:hover{background-color:#919eab14}.menu-item__link.active{background-color:#009d4f1a!important;color:#009d4f!important}.menu-item__link.level-0{height:auto}.menu-item__link.menu-item__link.collapsed.level-0{display:none}.menu-item__icon{width:1.5rem;height:1.5rem;flex-shrink:0}.menu-item__icon.collapsed.level-1{width:100%}.menu-item__icon.collapsed.level-1>*{margin:0 auto}.menu-item__label{font-size:.875rem;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:100%;flex-shrink:1;margin-left:12px;padding-right:12px;color:#292929}.menu-item__label.active{color:inherit}.menu-item__label.collapsed{margin-left:8px;font-size:.75rem;line-height:1rem}.menu-item__label.collapsed.level-1{text-align:center;margin-left:0;display:none}.menu-item__label.level-0{color:#85858a}.menu-item__icon-arrow__wrapper{display:grid;place-items:center;position:absolute;top:50%;transform:translateY(-50%);right:-3px}.menu-item__icon-arrow__wrapper.expanded{right:0}.menu-item__icon-arrow__icon{transition:all .3s!important;transform:rotate(-90deg)!important}.menu-item__icon-arrow__icon.active{color:inherit}.menu-item__icon-arrow__icon.expanded.open{transform:rotate(0)!important}.menu-item__dropdown.collapsed{background-color:#fafafa;border:1px solid #ddd;box-shadow:#0000001a 0 10px 15px -3px,#0000000d 0 4px 6px -2px;border-radius:4px;width:180px;max-width:180px;padding:4px;z-index:1200}.menu-item__dropdown.collapsed .menu-item__link{height:40px}.menu-item__dropdown.collapsed .menu-item__link.level-1{height:48px}.menu-item__dropdown.collapsed.level-1{width:auto;max-width:unset;box-shadow:none;border:none;padding:0;background-color:unset}.menu-item__dropdown.expanded{margin-top:4px;overflow:hidden}.icon-btn{display:inline-flex;align-items:center;justify-content:center;padding:8px;border-radius:50%;background-color:transparent;transition:background-color .3s ease;border:none}.icon-btn:hover{background-color:var(--btn-bg-hover)}.simplebar-scrollbar:before{background-color:#0000002d}
7491
- `, kO = "@ukpc-lib/react", AO = "0.1.13", PO = "module", OO = "./dist/", MO = "./dist/", RO = {
7491
+ `, kO = "@ukpc-lib/react", AO = "0.1.14", PO = "module", OO = "./dist/", MO = "./dist/", RO = {
7492
7492
  "./components": {
7493
7493
  import: "./dist/components/index.js",
7494
7494
  require: "./dist/components/index.cjs",