{"version":3,"file":"ScrollTopButton.DGiD4dtX.mjs","names":["React.useState"],"sources":["https:/framerusercontent.com/modules/e1pmPfydYQj16DZ34Dpx/fsDpkrOGGkwuHcgGzw6v/ScrollTopButton.js"],"sourcesContent":["// Floating \"scroll to top\" button.\n// Fixed to a corner of the viewport; hidden until the page is scrolled past a\n// threshold, then fades in. Clicking smoothly scrolls back to the top.\n// Uses position:fixed internally, so its placement on the canvas doesn't matter.\n//\n// It also resets the scroll to the very top whenever the page it sits on loads\n// (i.e. after navigating via a link), UNLESS the URL has an anchor (#section),\n// so in-page anchor links still work. Toggle with the \"Reset on load\" control.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function ScrollTopButton(props){const{size,bg,iconColor,radius,offsetX,offsetY,threshold,side,resetOnLoad,style}=props;const isStatic=useIsStaticRenderer();const[visible,setVisible]=React.useState(false);const[hover,setHover]=React.useState(false);React.useEffect(()=>{if(isStatic||typeof window===\"undefined\")return;const onScroll=()=>setVisible(window.scrollY>threshold);onScroll();window.addEventListener(\"scroll\",onScroll,{passive:true});return()=>window.removeEventListener(\"scroll\",onScroll);},[isStatic,threshold]);// On page entry (navigation), jump to the top — unless an anchor (#...) is\n// present so section links still scroll to their target.\nReact.useEffect(()=>{if(isStatic||!resetOnLoad||typeof window===\"undefined\")return;if(window.location.hash)return;let k=0;const toTop=()=>{try{window.scrollTo(0,0);}catch(e){}if(document.scrollingElement)document.scrollingElement.scrollTop=0;if(document.documentElement)document.documentElement.scrollTop=0;if(document.body)document.body.scrollTop=0;};toTop();const id=window.setInterval(()=>{toTop();if(++k>10)window.clearInterval(id);},30);return()=>window.clearInterval(id);},[isStatic,resetOnLoad]);const toTop=()=>{if(typeof window!==\"undefined\"){window.scrollTo({top:0,behavior:\"smooth\"});}};// On the static (canvas/thumbnail) render show it so it's visible while editing.\nconst show=isStatic?true:visible;const onRight=side!==\"left\";return /*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":\"Scroll to top\",onClick:toTop,onMouseEnter:()=>setHover(true),onMouseLeave:()=>setHover(false),style:{position:\"fixed\",bottom:offsetY,right:onRight?offsetX:undefined,left:onRight?undefined:offsetX,width:size,height:size,borderRadius:radius,border:\"none\",background:bg,color:iconColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",cursor:\"pointer\",zIndex:1e3,boxShadow:\"0 10px 30px rgba(0,0,0,0.22)\",opacity:show?hover?.9:1:0,transform:show?hover?\"translateY(-2px)\":\"none\":\"translateY(12px)\",pointerEvents:show?\"auto\":\"none\",transition:\"opacity 0.35s ease, transform 0.35s cubic-bezier(0.76,0,0.24,1)\",WebkitTapHighlightColor:\"transparent\",...style},children:/*#__PURE__*/_jsx(\"svg\",{width:Math.max(14,size*.38),height:Math.max(14,size*.38),viewBox:\"0 0 24 24\",fill:\"none\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M12 19V5M12 5l-7 7M12 5l7 7\",stroke:iconColor,strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})})});}ScrollTopButton.defaultProps={size:48,bg:\"rgb(0,0,0)\",iconColor:\"rgb(255,255,255)\",radius:999,offsetX:28,offsetY:28,threshold:400,side:\"right\",resetOnLoad:true};addPropertyControls(ScrollTopButton,{size:{type:ControlType.Number,title:\"Size\",defaultValue:48,min:32,max:80,step:1,unit:\"px\"},bg:{type:ControlType.Color,title:\"Background\",defaultValue:\"rgb(0,0,0)\"},iconColor:{type:ControlType.Color,title:\"Icon\",defaultValue:\"rgb(255,255,255)\"},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:999,min:0,max:999,step:1,unit:\"px\"},offsetX:{type:ControlType.Number,title:\"Offset X\",defaultValue:28,min:0,max:120,step:1,unit:\"px\"},offsetY:{type:ControlType.Number,title:\"Offset Y\",defaultValue:28,min:0,max:120,step:1,unit:\"px\"},threshold:{type:ControlType.Number,title:\"Show after\",defaultValue:400,min:0,max:2e3,step:50,unit:\"px\"},side:{type:ControlType.Enum,title:\"Side\",defaultValue:\"right\",options:[\"left\",\"right\"],optionTitles:[\"Left\",\"Right\"],displaySegmentedControl:true},resetOnLoad:{type:ControlType.Boolean,title:\"Reset on load\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollTopButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollTopButton.map"],"mappings":"uMAWG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,OAAK,KAAG,YAAU,SAAO,UAAQ,UAAQ,YAAU,OAAK,cAAY,SAAO,EAAY,EAAS,EAAoB,EAAO,CAAC,EAAQ,GAAYA,EAAe,EAAK,EAAO,CAAC,EAAM,GAAUA,EAAe,EAAK,EAAE,MAAoB,CAAC,GAAG,GAAiB,IAAS,OAAY,OAAO,IAAM,MAAa,EAAW,EAAO,QAAQ,CAAS,EAAuE,OAArE,EAAS,EAAE,EAAO,iBAAiB,SAAS,EAAS,CAAC,QAAQ,EAAI,CAAC,MAAY,EAAO,oBAAoB,SAAS,CAAQ,CAAE,EAAE,CAAC,EAAS,CAAS,CAAC,EAE1hB,MAAoB,CAA+D,GAA3D,GAAU,CAAC,GAAoB,IAAS,QAAsB,EAAO,SAAS,KAAK,OAAO,IAAI,EAAE,EAAQ,MAAU,CAAC,GAAG,CAAC,EAAO,SAAS,EAAE,CAAC,CAAE,MAAS,CAAC,CAAI,SAAS,mBAAiB,SAAS,iBAAiB,UAAU,GAAK,SAAS,kBAAgB,SAAS,gBAAgB,UAAU,GAAK,SAAS,OAAK,SAAS,KAAK,UAAU,EAAE,EAAE,EAAM,EAAE,IAAM,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