{"version":3,"file":"ScrollBackground.dnjbYBd2.mjs","names":["useState","React"],"sources":["https:/framerusercontent.com/modules/EtNKquUtkmIuGYcZpvWA/gZFaKr02F6psfT4P5sEb/ScrollBackground.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import React,{useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Component that shows background after scrolling past threshold\n *\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 100\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function ScrollBackground(props){const{backgroundColor,borderColor,scrollThreshold,children,style}=props;const[showBackground,setShowBackground]=useState(false);useEffect(()=>{if(typeof window===\"undefined\")return;const handleScroll=()=>{const scrollY=window.scrollY||window.pageYOffset;startTransition(()=>{setShowBackground(scrollY>=scrollThreshold);});};window.addEventListener(\"scroll\",handleScroll,{passive:true});handleScroll();return()=>{window.removeEventListener(\"scroll\",handleScroll);};},[scrollThreshold]);return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:\"100%\",height:style?.height===\"100%\"?\"100%\":\"auto\",minWidth:5,minHeight:5,backgroundColor:showBackground?backgroundColor:\"transparent\",backdropFilter:showBackground?\"blur(50px)\":\"none\",WebkitBackdropFilter:showBackground?\"blur(50px)\":\"none\",borderBottom:showBackground?`1px solid ${borderColor}`:\"none\",display:\"flex\",flexDirection:\"column\",alignItems:\"stretch\",justifyContent:\"flex-start\"},children:React.Children.map(children,child=>{if(/*#__PURE__*/React.isValidElement(child)){return /*#__PURE__*/React.cloneElement(child,{style:{...child.props.style||{},width:\"100%\"}});}return child;})});}addPropertyControls(ScrollBackground,{backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"rgba(255, 255, 255, 0.15)\"},scrollThreshold:{type:ControlType.Number,title:\"Scroll Threshold\",defaultValue:442,min:0,step:1,unit:\"px\"},children:{type:ControlType.Slot,title:\"Content\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollBackground\",\"slots\":[\"children\"],\"annotations\":{\"framerIntrinsicHeight\":\"100\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\",\"framerIntrinsicWidth\":\"200\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollBackground.map"],"mappings":"6MAQG,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,kBAAgB,cAAY,kBAAgB,WAAS,SAAO,EAAW,CAAC,EAAe,GAAmBA,EAAS,GAAM,CAAsW,OAArW,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,MAAiB,CAAC,IAAM,EAAQ,EAAO,SAAS,EAAO,YAAY,MAAoB,CAAC,EAAkB,GAAS,EAAgB,EAAG,EAAgF,OAA7E,EAAO,iBAAiB,SAAS,EAAa,CAAC,QAAQ,GAAK,CAAC,CAAC,GAAc,KAAW,CAAC,EAAO,oBAAoB,SAAS,EAAa,GAAK,CAAC,EAAgB,CAAC,CAAqB,EAAK,MAAM,CAAC,MAAM,CAAC,SAAS,WAAW,MAAM,OAAO,OAAO,GAAO,SAAS,OAAO,OAAO,OAAO,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAe,EAAgB,cAAc,eAAe,EAAe,aAAa,OAAO,qBAAqB,EAAe,aAAa,OAAO,aAAa,EAAe,aAAa,IAAc,OAAO,QAAQ,OAAO,cAAc,SAAS,WAAW,UAAU,eAAe,aAAa,CAAC,SAASC,EAAM,SAAS,IAAI,EAAS,GAAwB,EAAM,eAAe,EAAM,CAAsB,EAAM,aAAa,EAAM,CAAC,MAAM,CAAC,GAAG,EAAM,MAAM,OAAO,EAAE,CAAC,MAAM,OAAO,CAAC,CAAC,CAAS,EAAQ,CAAC,CAAC,sBAR/nC,IAA6D,IAAoD,CAQghC,EAAoB,EAAiB,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