{"version":3,"file":"SmoothCollapse.DHFlZXWQ.mjs","names":["useState","useRef","Children"],"sources":["https:/framerusercontent.com/modules/pDOPDRwvTmdmvqgIs0mU/kWlJb24T7ZlLaEReVmxo/SmoothCollapse.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{Children,cloneElement,isValidElement,useEffect,useRef,useState}from\"react\";const EASE=\"cubic-bezier(0.32, 0.72, 0, 1)\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function SmoothCollapse(props){const{open,content,duration,fade,paddingTop,paddingBottom,style}=props;// Skip the transition on first paint so rows don't animate on page load\nconst[ready,setReady]=useState(false);const innerRef=useRef(null);useEffect(()=>{const id=requestAnimationFrame(()=>setReady(true));return()=>cancelAnimationFrame(id);},[]);// Closed content shouldn't be reachable by keyboard or screen readers\nuseEffect(()=>{const el=innerRef.current;if(!el)return;if(open)el.removeAttribute(\"inert\");else el.setAttribute(\"inert\",\"\");},[open]);const t=ready?`${duration}s ${EASE}`:\"0s\";const items=Children.toArray(content).map((child,i)=>/*#__PURE__*/isValidElement(child)?/*#__PURE__*/cloneElement(child,{key:i,style:{...child.props.style||{},width:\"100%\",position:\"relative\"}}):child);return /*#__PURE__*/_jsx(\"div\",{style:{...style,display:\"grid\",gridTemplateRows:open?\"1fr\":\"0fr\",transition:`grid-template-rows ${t}`,width:\"100%\"},children:/*#__PURE__*/_jsx(\"div\",{style:{overflow:\"hidden\",minHeight:0},children:/*#__PURE__*/_jsx(\"div\",{ref:innerRef,\"aria-hidden\":!open,style:{paddingTop,paddingBottom,opacity:fade?open?1:0:1,transform:fade?open?\"none\":\"translateY(-4px)\":\"none\",transition:ready?`opacity ${duration*(open?.9:.5)}s ease ${open?duration*.15:0}s, transform ${duration}s ${EASE}`:\"none\",display:\"flex\",flexDirection:\"column\",width:\"100%\"},children:items})})});}SmoothCollapse.displayName=\"Smooth Collapse\";addPropertyControls(SmoothCollapse,{open:{type:ControlType.Boolean,title:\"Open\",defaultValue:false},content:{type:ControlType.Slot,title:\"Content\",maxCount:1},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:.45,min:.1,max:1.5,step:.05,unit:\"s\"},fade:{type:ControlType.Boolean,title:\"Fade\",defaultValue:true},paddingTop:{type:ControlType.Number,title:\"Padding Top\",defaultValue:0,min:0,max:64,step:1,unit:\"px\"},paddingBottom:{type:ControlType.Number,title:\"Padding Bottom\",defaultValue:0,min:0,max:64,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SmoothCollapse\",\"slots\":[\"content\"],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SmoothCollapse.map"],"mappings":"wMAGG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,OAAK,UAAQ,WAAS,OAAK,aAAW,gBAAc,SAAO,EAC7G,CAAC,EAAM,GAAUA,EAAS,EAAK,EAAQ,EAASC,EAAO,IAAI,EAAE,MAAc,CAAC,IAAM,EAAG,0BAA0B,EAAS,EAAI,CAAC,EAAE,UAAU,qBAAqB,CAAE,CAAE,EAAE,CAAC,CAAC,EAC3K,MAAc,CAAC,IAAM,EAAG,EAAS,QAAY,IAAa,EAAK,EAAG,gBAAgB,OAAO,EAAO,EAAG,aAAa,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAI,CAAC,EAAE,IAAM,EAAE,EAAM,GAAG,EAAS,IAAI,IAAO,KAAW,EAAMC,EAAS,QAAQ,CAAO,CAAC,CAAC,KAAK,EAAM,IAAiB,EAAe,CAAK,EAAe,EAAa,EAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,EAAM,MAAM,OAAO,CAAC,EAAE,MAAM,OAAO,SAAS,UAAU,CAAC,CAAC,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