@lifesg/react-design-system 1.0.0-alpha.7 → 1.0.0-alpha.8

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/navbar/index.js CHANGED
@@ -165,7 +165,7 @@ import e,{css as t,keyframes as n}from"styled-components";import{jsxs as r,jsx a
165
165
  `,e.$disableTransition&&(n+=t`
166
166
  transition: none;
167
167
  `),n}}
168
- `,wr=({show:e=!1,rootId:t,onOverlayClick:n,children:r,backgroundOpacity:i,backgroundBlur:l=!0,disableTransition:u=!1,enableOverlayClick:f=!1,zIndex:p,id:h})=>{const[g,m]=c(null),[L,v]=c(),y=C(),$=C(null),b=r&&a.cloneElement(r,{ref:$}),H=h?`lifesg-ds-overlay-root-${h}`:"lifesg-ds-overlay-root";s((()=>{if(e){const e=M();if(w(e),!e){const e=setTimeout((()=>{Z("add")}),200);return()=>clearTimeout(e)}}else if(!y.current){const e=setTimeout((()=>{Z("add")}),200);return()=>clearTimeout(e)}}),[e]),s((()=>{m(V());const e=M();return w(e),e||S(),()=>{Z("remove")}}),[]);const w=e=>{y.current=e,v(e)},V=()=>document&&t?document.getElementById(t):document?document.body:null,M=()=>document.body.classList.contains(Mr),S=()=>{if(!document.getElementById(Vr)){const e=document.createElement("style");e.id=Vr;const t=document.documentElement.clientWidth,n=window.innerWidth-t;e.innerHTML=`\n\t\t\t\t.${Mr} {\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\tpadding-right: ${n}px !important;\n\t\t\t\t\t-ms-overflow-style: none;\n\t\t\t\t\tscrollbar-width: none;\n\t\t\t\t}\n\n\t\t\t\t.${Mr}::-webkit-scrollbar {\n\t\t\t\t\tdisplay: none;\n\t\t\t\t}\n\t\t\t`,document.body.appendChild(e)}},Z=e=>{const t=document.body.classList.contains(Mr);"add"!==e||t?"remove"===e&&t&&document.body.classList.remove(Mr):document.body.classList.add(Mr)},x=e=>{e.preventDefault();const t=$.current?.firstChild;t&&t.contains(e.target)||n&&f&&n()};return g?d.createPortal(o(br,{id:H,"data-testid":H,$show:e,zIndex:p,$stacked:L,children:r&&o(Hr,{"data-testid":"overlay-wrapper",$show:e,$backgroundOpacity:i||(L?.5:.8),$backgroundBlur:l,$disableTransition:u,$enableOverlayClick:f,onClick:x,children:b})}),g):null},Vr="lifesg-ds-overlay-stylesheet",Mr="lifesg-ds-overlay-open",Sr=e.a`
168
+ `,wr=({show:e=!1,rootId:t,onOverlayClick:n,children:r,backgroundOpacity:i,backgroundBlur:l=!0,disableTransition:u=!1,enableOverlayClick:f=!1,zIndex:p,id:h})=>{const[g,m]=c(null),[L,v]=c(),y=C(),$=C(null),b=r&&a.cloneElement(r,{ref:$}),H=h?`lifesg-ds-overlay-root-${h}`:"lifesg-ds-overlay-root";s((()=>{if(e){const e=M();if(w(e),!e){const e=setTimeout((()=>{Z("add")}),200);return()=>clearTimeout(e)}}else if(!y.current){const e=setTimeout((()=>{Z("remove")}),200);return()=>clearTimeout(e)}}),[e]),s((()=>{m(V());const e=M();return w(e),e||S(),()=>{Z("remove")}}),[]);const w=e=>{y.current=e,v(e)},V=()=>document&&t?document.getElementById(t):document?document.body:null,M=()=>document.body.classList.contains(Mr),S=()=>{if(!document.getElementById(Vr)){const e=document.createElement("style");e.id=Vr;const t=document.documentElement.clientWidth,n=window.innerWidth-t;e.innerHTML=`\n\t\t\t\t.${Mr} {\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\tpadding-right: ${n}px !important;\n\t\t\t\t\t-ms-overflow-style: none;\n\t\t\t\t\tscrollbar-width: none;\n\t\t\t\t}\n\n\t\t\t\t.${Mr}::-webkit-scrollbar {\n\t\t\t\t\tdisplay: none;\n\t\t\t\t}\n\t\t\t`,document.body.appendChild(e)}},Z=e=>{const t=document.body.classList.contains(Mr);"add"!==e||t?"remove"===e&&t&&document.body.classList.remove(Mr):document.body.classList.add(Mr)},x=e=>{e.preventDefault();const t=$.current?.firstChild;t&&t.contains(e.target)||n&&f&&n()};return g?d.createPortal(o(br,{id:H,"data-testid":H,$show:e,zIndex:p,$stacked:L,children:r&&o(Hr,{"data-testid":"overlay-wrapper",$show:e,$backgroundOpacity:i||(L?.5:.8),$backgroundBlur:l,$disableTransition:u,$enableOverlayClick:f,onClick:x,children:b})}),g):null},Vr="lifesg-ds-overlay-stylesheet",Mr="lifesg-ds-overlay-open",Sr=e.a`
169
169
  display: flex;
170
170
  justify-content: center;
171
171
  margin-right: 2rem;