Module 430993

2,030 characters · in no known chunk
Dependencies
Source Raw
function(e,t,n){"use strict";n.d(t,{c:()=>E,y:()=>p});var i=n(627968),r=n(64700),s=n(503698),a=n.n(s),o=n(879378),l=n.n(o),u=n(612324),c=n(707554),d=n(475825),_=n(689175),f=n(834730),h=n(967744);function p(e){return r.Children.toArray(e).filter(Boolean).length>0}function E(e){let{controls:t,children:n,listProps:r,onScroll:s,scrollerRef:a}=e;if(!p(n)&&null==t&&null==r)return null;let o="string"==typeof n?(0,i.jsx)(f.E,{variant:"text-md/normal",color:"text-subtle",children:n}):n;return(0,i.jsx)(m,{controls:t,children:o,listProps:r,onScroll:s,scrollerRef:a})}function m(e){let{controls:t,children:n,listProps:s,onScroll:o,scrollerRef:f}=e,[p,E]=r.useState(!1),[m,g]=r.useState(null!=s),A=r.useRef(null),I=(0,u.A)(A,s?.ref,f),T=r.useRef(null),S=r.useRef(void 0);r.useEffect(()=>(S.current=l()(()=>{A?.current!=null&&null!=t&&E(A.current?.getDistanceFromTop()>12)},200),()=>{S.current?.cancel()}),[t]);let N=r.useCallback(()=>{null!=S.current&&S.current(),null!=o&&o()},[S,o]),y=null!=s;return r.useLayoutEffect(()=>{let e=new ResizeObserver(()=>{if(y)return void g(!0);let e=A?.current?.getScrollerNode()??null;if(null==e||T?.current==null)return;let t=e.getBoundingClientRect();g(T.current.getBoundingClientRect().height>t.height)}),t=A?.current?.getScrollerNode()??null;return null!=t&&e.observe(t),T?.current!=null&&e.observe(T.current),()=>e.disconnect()},[y]),(0,i.jsxs)(c.F,{children:[(0,i.jsx)("div",{className:a()(h.bodySpacerTop,{[h.bodySpacerTopBorder]:m&&null==t})}),null!=t&&(0,i.jsx)("header",{className:a()(h.bodyControls,{[h.bodyControlsWithFade]:p}),children:t}),null!=s?(0,i.jsx)(d.Ei,{...s,className:h.bodyList,innerAriaOrientation:s.innerAriaOrientation??"vertical",innerRole:s.innerRole??"listbox",ref:I,onScroll:e=>{N(),s.onScroll?.(e)}}):(0,i.jsx)(_.Gt,{ref:I,className:h.body,onScroll:N,disableFocusRingScope:!0,children:(0,i.jsx)("main",{ref:T,className:a()(h.bodyInner,{[h.bodyInnerShouldScroll]:m}),children:n})}),(0,i.jsx)("div",{className:a()(h.bodySpacerBottom,{[h.bodySpacerBottomBorder]:m})})]})}}