Build 606747stable
Module 99018
3,885 characters · in e550e7de31f8cc77.jsDependencies
Source Raw
function(e,t,s){s.d(t,{kS:()=>m,EN:()=>E});var i=s(160844),l=s(407815),n=s(924949),a=s(295551),r=s(447502),d=s(361854),o=s(333007),u=s(582128),p=s(526739),c=s(961082),h=s(184093),x=s(814204),b=s(288378);let f=(0,u.createContext)(null),y=(0,u.createContext)(null),g=(0,u.createContext)(null),P=(0,u.createContext)(null),E=(0,u.forwardRef)(function(e,t){[e,t]=(0,l.JT)(e,t,y);let s=(0,u.useContext)(f),{id:x,...E}=e,m=(0,a.Bi)();x||=m;let v=s?s.expandedKeys.has(x):e.isExpanded,C=function(e){let[t,s]=(0,p.P)(e.isExpanded,e.defaultExpanded||!1,e.onExpandedChange),i=(0,u.useCallback)(()=>{s(!0)},[s]),l=(0,u.useCallback)(()=>{s(!1)},[s]),n=(0,u.useCallback)(()=>{s(!t)},[s,t]);return{isExpanded:t,setExpanded:s,expand:i,collapse:l,toggle:n}}({...e,isExpanded:v,onExpandedChange(t){s&&s.toggleKey(x),e.onExpandedChange?.(t)}}),w=u.useRef(null),k=e.isDisabled||s?.isDisabled||!1,{buttonProps:A,panelProps:D}=function(e,t,s){let{isDisabled:i}=e,l=(0,a.Bi)(),p=(0,a.Bi)(),c=(0,r.wR)(),h=(0,u.useRef)(null),x=(0,u.useCallback)(()=>{h.current=requestAnimationFrame(()=>{s.current&&s.current.setAttribute("hidden","until-found")}),(0,o.flushSync)(()=>{t.toggle()})},[s,t]);(0,n._)(s,"beforematch",x);let b=(0,u.useRef)(null);return(0,d.N)(()=>{if(h.current&&cancelAnimationFrame(h.current),s.current&&!c){let e=s.current;null==b.current||"function"!=typeof e.getAnimations?t.isExpanded?(e.removeAttribute("hidden"),e.style.setProperty("--disclosure-panel-width","auto"),e.style.setProperty("--disclosure-panel-height","auto")):(e.setAttribute("hidden","until-found"),e.style.setProperty("--disclosure-panel-width","0px"),e.style.setProperty("--disclosure-panel-height","0px")):t.isExpanded!==b.current&&(t.isExpanded?(e.removeAttribute("hidden"),e.style.setProperty("--disclosure-panel-width",e.scrollWidth+"px"),e.style.setProperty("--disclosure-panel-height",e.scrollHeight+"px"),Promise.all(e.getAnimations().map(e=>e.finished)).then(()=>{e.style.setProperty("--disclosure-panel-width","auto"),e.style.setProperty("--disclosure-panel-height","auto")}).catch(()=>{})):(e.style.setProperty("--disclosure-panel-width",e.scrollWidth+"px"),e.style.setProperty("--disclosure-panel-height",e.scrollHeight+"px"),window.getComputedStyle(e).height,e.style.setProperty("--disclosure-panel-width","0px"),e.style.setProperty("--disclosure-panel-height","0px"),Promise.all(e.getAnimations().map(e=>e.finished)).then(()=>e.setAttribute("hidden","until-found")).catch(()=>{}))),b.current=t.isExpanded}},[i,s,t.isExpanded,c]),(0,u.useEffect)(()=>()=>{h.current&&cancelAnimationFrame(h.current)},[]),{buttonProps:{id:l,"aria-expanded":t.isExpanded,"aria-controls":p,onPress:e=>{i||"keyboard"===e.pointerType||t.toggle()},isDisabled:i,onPressStart(e){"keyboard"!==e.pointerType||i||t.toggle()}},panelProps:{id:p,role:"group","aria-labelledby":l,"aria-hidden":!t.isExpanded,hidden:c?!t.isExpanded:void 0}}}({...e,isExpanded:v,isDisabled:k},C,w),{isFocusVisible:R,focusProps:F}=(0,b.o)({within:!0}),S=(0,l.Sl)({...e,id:void 0,defaultClassName:"react-aria-Disclosure",values:{isExpanded:C.isExpanded,isDisabled:k,isFocusVisibleWithin:R,state:C}}),T=(0,c.$)(E,{global:!0});return u.createElement(l.Kq,{values:[[i.k,{slots:{[l.P_]:{},trigger:A}}],[P,{panelProps:D,panelRef:w}],[g,C]]},u.createElement(l.tT.div,{...(0,h.v)(T,S,F),ref:t,"data-expanded":C.isExpanded||void 0,"data-disabled":k||void 0,"data-focus-visible-within":R||void 0},S.children))}),m=(0,u.forwardRef)(function(e,t){let{role:s="group"}=e,{panelProps:n,panelRef:a}=(0,u.useContext)(P),{isFocusVisible:r,focusProps:d}=(0,b.o)({within:!0}),o=(0,l.Sl)({...e,defaultClassName:"react-aria-DisclosurePanel",values:{isFocusVisibleWithin:r}}),p=(0,c.$)(e,{global:!0,labelable:!0});return u.createElement(l.tT.div,{...(0,h.v)(p,o,n,d),ref:(0,x.P)(t,a),role:s,"data-focus-visible-within":r||void 0},u.createElement(l.Kq,{values:[[i.k,null]]},e.children))})}