Module 353068

3,929 characters · in no known chunk
Dependencies
Required by (3)
Lazily required by (0)none
Lazily requires (0)none
Source Raw
function(e,t,n){"use strict";n.d(t,{kS:()=>T,EN:()=>I});var i=n(650682),r=n(825913),s=n(340287),a=n(64700),o=n(985620),l=n(248215),u=n(3388),c=n(341221),d=n(498430),_=n(492313),h=n(290424),f=n(318473),p=n(561514);let E=(0,a.createContext)(null),m=(0,a.createContext)(null),g=(0,a.createContext)(null),A=(0,a.createContext)(null),I=(0,a.forwardRef)(function(e,t){[e,t]=(0,r.JT)(e,t,m);let n=(0,a.useContext)(E),{id:p,...I}=e,T=(0,o.Bi)();p||(p=T);let S=n?n.expandedKeys.has(p):e.isExpanded,y=function(e){let[t,n]=(0,_.P)(e.isExpanded,e.defaultExpanded||!1,e.onExpandedChange),i=(0,a.useCallback)(()=>{n(!0)},[n]),r=(0,a.useCallback)(()=>{n(!1)},[n]),s=(0,a.useCallback)(()=>{n(!t)},[n,t]);return{isExpanded:t,setExpanded:n,expand:i,collapse:r,toggle:s}}({...e,isExpanded:S,onExpandedChange(t){var i;n&&n.toggleKey(p),null==(i=e.onExpandedChange)||i.call(e,t)}}),C=a.useRef(null),N=e.isDisabled||(null==n?void 0:n.isDisabled)||!1,{buttonProps:v,panelProps:R}=function(e,t,n){let{isDisabled:i}=e,r=(0,o.Bi)(),d=(0,o.Bi)(),_=(0,c.wR)(),h=(0,a.useRef)(null),f=(0,a.useCallback)(()=>{h.current=requestAnimationFrame(()=>{n.current&&n.current.setAttribute("hidden","until-found")}),(0,s.flushSync)(()=>{t.toggle()})},[n,t]);(0,l._)(n,"beforematch",f);let p=(0,a.useRef)(null);return(0,u.N)(()=>{if(h.current&&cancelAnimationFrame(h.current),n.current&&!i&&!_){let e=n.current;null==p.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!==p.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(()=>{}))),p.current=t.isExpanded}},[i,n,t.isExpanded,_]),(0,a.useEffect)(()=>()=>{h.current&&cancelAnimationFrame(h.current)},[]),{buttonProps:{id:r,"aria-expanded":t.isExpanded,"aria-controls":d,onPress:e=>{i||"keyboard"===e.pointerType||t.toggle()},isDisabled:i,onPressStart(e){"keyboard"!==e.pointerType||i||t.toggle()}},panelProps:{id:d,role:"group","aria-labelledby":r,"aria-hidden":!t.isExpanded,hidden:_||i?i||!t.isExpanded:void 0}}}({...e,isExpanded:S,isDisabled:N},y,C),{isFocusVisible:O,focusProps:b}=(0,d.o)({within:!0}),D=(0,r.Sl)({...e,id:void 0,defaultClassName:"react-aria-Disclosure",values:{isExpanded:y.isExpanded,isDisabled:N,isFocusVisibleWithin:O,state:y}}),L=(0,h.$)(I,{global:!0});return a.createElement(r.Kq,{values:[[i.k,{slots:{[r.P_]:{},trigger:v}}],[A,{panelProps:R,panelRef:C}],[g,y]]},a.createElement("div",{...(0,f.v)(L,D,b),ref:t,"data-expanded":y.isExpanded||void 0,"data-disabled":N||void 0,"data-focus-visible-within":O||void 0},D.children))}),T=(0,a.forwardRef)(function(e,t){let{role:n="group"}=e,{panelProps:s,panelRef:o}=(0,a.useContext)(A),{isFocusVisible:l,focusProps:u}=(0,d.o)({within:!0}),c=(0,r.Sl)({...e,defaultClassName:"react-aria-DisclosurePanel",values:{isFocusVisibleWithin:l}}),_=(0,h.$)(e,{global:!0});return a.createElement("div",{...(0,f.v)(_,c,s,u),ref:(0,p.P)(t,o),role:n,"data-focus-visible-within":l||void 0},a.createElement(r.Kq,{values:[[i.k,null]]},e.children))})}