{"version":3,"file":"BackToTop.BvLXAzLC.mjs","names":["useState","useCallback"],"sources":["https:/framerusercontent.com/modules/RT393UASqkU9Tk1Ja7iw/1KYDglZRGkKmRLFzMtFf/BackToTop.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion}from\"framer-motion\";import{useCallback,useEffect,useState,startTransition}from\"react\";/**\n * Back To Top\n *\n * A circular scroll-to-top button. It stays out of the way until the page has\n * been scrolled past a threshold, then fades in. Clicking it returns the page\n * to the very top. Place it inside a fixed-position frame in the bottom right\n * corner of a page.\n *\n * @framerIntrinsicWidth 56\n * @framerIntrinsicHeight 56\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function BackToTop(props){const{size=56,background=\"#080C15\",ringColor=\"#FFFFFF\",ringWidth=1.5,arrowColor=\"#FFFFFF\",arrowWidth=2,showAfter=400,label=\"Back to top\",style}=props;const isStatic=useIsStaticRenderer();const[scrolledPast,setScrolledPast]=useState(false);useEffect(()=>{if(isStatic)return;if(typeof window===\"undefined\")return;const handleScroll=()=>{const next=window.scrollY>showAfter;startTransition(()=>setScrolledPast(current=>current===next?current:next));};handleScroll();window.addEventListener(\"scroll\",handleScroll,{passive:true});return()=>window.removeEventListener(\"scroll\",handleScroll);},[isStatic,showAfter]);const scrollToTop=useCallback(()=>{if(typeof window===\"undefined\")return;window.scrollTo({top:0,left:0,behavior:\"smooth\"});},[]);// On the canvas the button always shows, so it can be seen and positioned.\nconst shown=isStatic||scrolledPast;const glyph=Math.round(size*.4);return /*#__PURE__*/_jsx(\"div\",{style:{...style,position:\"relative\",width:size,height:size},children:/*#__PURE__*/_jsx(motion.button,{type:\"button\",\"aria-label\":label,title:label,\"aria-hidden\":shown?undefined:true,tabIndex:shown?0:-1,onClick:scrollToTop,initial:false,animate:{opacity:shown?1:0,y:shown?0:12,scale:shown?1:.9},transition:{duration:.28,ease:[.44,0,.56,1]},whileHover:{scale:1.06},whileTap:{scale:.94},style:{position:\"absolute\",top:0,left:0,width:size,height:size,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",padding:0,margin:0,borderRadius:\"50%\",background:background,border:ringWidth+\"px solid \"+ringColor,cursor:\"pointer\",pointerEvents:shown?\"auto\":\"none\",WebkitTapHighlightColor:\"transparent\",appearance:\"none\"},children:/*#__PURE__*/_jsxs(\"svg\",{width:glyph,height:glyph,viewBox:\"0 0 24 24\",fill:\"none\",\"aria-hidden\":\"true\",focusable:\"false\",children:[/*#__PURE__*/_jsx(\"path\",{d:\"M12 19V5\",stroke:arrowColor,strokeWidth:arrowWidth,strokeLinecap:\"round\",strokeLinejoin:\"round\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M5 12L12 5L19 12\",stroke:arrowColor,strokeWidth:arrowWidth,strokeLinecap:\"round\",strokeLinejoin:\"round\"})]})})});}addPropertyControls(BackToTop,{size:{type:ControlType.Number,title:\"Size\",defaultValue:56,min:32,max:96,step:1,unit:\"px\"},background:{type:ControlType.Color,title:\"Fill\",defaultValue:\"#080C15\"},ringColor:{type:ControlType.Color,title:\"Ring\",defaultValue:\"#FFFFFF\"},ringWidth:{type:ControlType.Number,title:\"Ring Width\",defaultValue:1.5,min:0,max:6,step:.5,unit:\"px\"},arrowColor:{type:ControlType.Color,title:\"Arrow\",defaultValue:\"#FFFFFF\"},arrowWidth:{type:ControlType.Number,title:\"Arrow Width\",defaultValue:2,min:1,max:4,step:.5,unit:\"px\"},showAfter:{type:ControlType.Number,title:\"Show After\",description:\"How far down the page the button appears.\",defaultValue:400,min:0,max:2e3,step:50,unit:\"px\"},label:{type:ControlType.String,title:\"Label\",defaultValue:\"Back to top\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BackToTop\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",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