@worldresources/wri-design-systems 2.130.0 → 2.130.1
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.js +1 -0
- package/dist/index.esm.js +1 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
package/dist/index.esm.js
CHANGED
@@ -1913,6 +1913,7 @@ import{createSystem as e,defaultConfig as t,Button as r,Box as n,Spinner as o,Ic
|
|
1913
1913
|
bottom: 0;
|
1914
1914
|
left: 0;
|
1915
1915
|
border-top: 1px solid ${ne("neutral",300)};
|
1916
|
+
background-color: ${ne("neutral",100)};
|
1916
1917
|
`,Lo=({header:e,content:t,footer:r,open:n=!1,onClose:o,minimizedHeight:i=50,midHeight:a=200,maxFullHeight:l=1e3,defaultSnap:s="minimized"})=>{const[c,d]=Y(void 0),[p,u]=Y(void 0),h=q(null),f=q(null);U((()=>{d(h?.current?.getBoundingClientRect()?.height),u(f?.current?.getBoundingClientRect()?.height)}),[e,r]);const x=G((()=>{if("undefined"==typeof window)return 0;const e=document.createElement("div");e.style.cssText="position:fixed;bottom:0;height:env(safe-area-inset-bottom);",document.body.appendChild(e);const t=e.getBoundingClientRect().height||0;return document.body.removeChild(e),t}),[]),g=G((()=>{const e=(()=>{if("undefined"!=typeof window){const e=.9*(window?.screen?.height||0);return e>l?l:e}return 0})(),t=Math.max(0,e-x);return l?Math.min(t,l):t}),[x,l]),m=G((()=>({closed:18,minimized:Math.min(i,g),mid:Math.min(Math.max(i,a),g),fullHeight:g,full:g})),[i,a,g]),[b,C]=Y(s),[v,w]=Y(0);U((()=>{if(n){const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}}),[n]),U((()=>{n?w(m[b]):(w(0),C(s))}),[b,m,n]);const y=q(null),$=q(null),k=q(0),L=q(0),S=q(0),M=q(0),R=q(0),E=q(!1);return U((()=>{const e=y.current;if(!e)return;const t=t=>{n&&(E.current=!0,e.setPointerCapture(t.pointerId),k.current=t.clientY,L.current=v,S.current=t.clientY,M.current=performance.now(),R.current=0,$.current&&($.current.style.transition="none"))},r=e=>{if(!E.current)return;const t=e.clientY-k.current,r=Math.max(0,Math.min(g,L.current-t));w(r);const n=performance.now(),o=Math.max(1,n-M.current),i=(e.clientY-S.current)/(o/1e3);R.current=i,S.current=e.clientY,M.current=n},i=()=>{if(!E.current)return;E.current=!1,$.current&&($.current.style.transition="height 300ms ease, transform 300ms ease");const e=R.current,t=v,{closed:r,minimized:n,mid:i,full:a}=m;if(e>900&&t<=i||t<=.6*n)return w(0),void window.setTimeout((()=>o&&o()),260);const l=[{k:"closed",v:r},{k:"minimized",v:n},{k:"mid",v:i},{k:"full",v:a}];let s=b;Math.abs(e)>900?s=e<0?t<(i+a)/2?"mid":"full":t>(n+i)/2?"mid":"minimized":(l.sort(((e,r)=>Math.abs(t-e.v)-Math.abs(t-r.v))),s=l[0].k),C(s);w("full"===s?a:"mid"===s?i:n)};return e.addEventListener("pointerdown",t),window.addEventListener("pointermove",r),window.addEventListener("pointerup",i),window.addEventListener("pointercancel",i),()=>{e.removeEventListener("pointerdown",t),window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",i),window.removeEventListener("pointercancel",i)}}),[n,v,g,m,b]),U((()=>{if(n){w(0);const e=window.setTimeout((()=>w(m[b])),10);return()=>window.clearTimeout(e)}w(0)}),[n,b,m]),H("div",{css:bo,"aria-hidden":!n,children:O("div",{ref:$,role:"dialog","aria-modal":"true",css:Co,style:{height:`${v}px`,transform:n?"translateY(0)":"translateY(100%)"},children:[H("div",{ref:y,css:vo,role:"button","aria-label":"Drag to expand or collapse",tabIndex:0,children:H("span",{css:wo})}),e?H("div",{css:yo,ref:h,children:e}):null,H("div",{css:$o(c,p),children:t}),r&&"full"===b?H("div",{css:ko,ref:f,children:r}):null]})})},So=B`
|
1917
1918
|
a,
|
1918
1919
|
p {
|