{"version":3,"file":"ScrollBlocker.PiYQvd4T.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/VafF7Z7E5YQoksbLIC87/q9t3tZ72Qw71Il88J8KL/ScrollBlocker.js"],"sourcesContent":["// Component to block page scrolling with a toggle control\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,startTransition,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function ScrollBlocker(props){const{enabled,showIndicator,indicatorText,backgroundColor,textColor,font}=props;const[isBlocking,setIsBlocking]=useState(enabled);useEffect(()=>{startTransition(()=>setIsBlocking(enabled));},[enabled]);useEffect(()=>{if(typeof window===\"undefined\")return;if(isBlocking){const scrollY=window.scrollY;document.body.style.position=\"fixed\";document.body.style.top=`-${scrollY}px`;document.body.style.width=\"100%\";document.body.style.overflow=\"hidden\";}else{const scrollY=document.body.style.top;document.body.style.position=\"\";document.body.style.top=\"\";document.body.style.width=\"\";document.body.style.overflow=\"\";if(scrollY){window.scrollTo(0,parseInt(scrollY||\"0\")*-1);}}return()=>{document.body.style.position=\"\";document.body.style.top=\"\";document.body.style.width=\"\";document.body.style.overflow=\"\";};},[isBlocking]);if(!showIndicator)return null;return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",backgroundColor,color:textColor,padding:20,borderRadius:8,...font},children:/*#__PURE__*/_jsx(\"span\",{style:{width:\"max-content\"},children:isBlocking?indicatorText:\"Scrolling enabled\"})});}addPropertyControls(ScrollBlocker,{enabled:{type:ControlType.Boolean,title:\"Block Scroll\",defaultValue:false,enabledTitle:\"Blocked\",disabledTitle:\"Enabled\"},showIndicator:{type:ControlType.Boolean,title:\"Show Indicator\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},indicatorText:{type:ControlType.String,title:\"Indicator Text\",defaultValue:\"Scrolling blocked\",hidden:({showIndicator})=>!showIndicator},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\",hidden:({showIndicator})=>!showIndicator},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\",hidden:({showIndicator})=>!showIndicator},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},hidden:({showIndicator})=>!showIndicator}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollBlocker\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollBlocker.map"],"mappings":"sMAIG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,UAAQ,gBAAc,gBAAc,kBAAgB,YAAU,QAAM,EAAW,CAAC,EAAW,GAAeA,EAAS,CAAO,EAAitB,OAA/sB,MAAc,CAAC,MAAoB,EAAc,CAAO,CAAC,CAAE,EAAE,CAAC,CAAO,CAAC,EAAE,MAAc,CAAI,GAAO,IAAS,OAAmB,IAAG,EAAW,CAAC,IAAM,EAAQ,EAAO,QAAQ,SAAS,KAAK,MAAM,SAAS,QAAQ,SAAS,KAAK,MAAM,IAAI,IAAI,EAAQ,IAAI,SAAS,KAAK,MAAM,MAAM,OAAO,SAAS,KAAK,MAAM,SAAS,QAAS,KAAK,CAAC,IAAM,EAAQ,SAAS,KAAK,MAAM,IAAI,SAAS,KAAK,MAAM,SAAS,GAAG,SAAS,KAAK,MAAM,IAAI,GAAG,SAAS,KAAK,MAAM,MAAM,GAAG,SAAS,KAAK,MAAM,SAAS,GAAM,GAAS,EAAO,SAAS,EAAE,SAAS,GAAS,GAAG,EAA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