{"version":3,"file":"ScrollToTopButton.vPsOF_GK.mjs","names":["useState","startTransition"],"sources":["https:/framerusercontent.com/modules/wSoJpngyWGgsRdSYH6Q1/Qy7JEuUbihw8K5WwQOhz/ScrollToTopButton.js"],"sourcesContent":["// Scroll to top button with customizable appearance, animation, and scroll position\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";/**\n * Scroll to Top Button\n * \n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ScrollToTopButton(props){const{frameColor=\"#FFFFFF\",iconColor=\"#000000\",borderColor=\"#EEEEEE\",hoverFrameColor=\"#F5F5F5\",shadow=\"0 2px 8px rgba(0, 0, 0, 0.1)\",scrollPosition=0,animationDuration=.3,frameSize=48,iconSize=24,borderRadius=8}=props;const[isVisible,setIsVisible]=useState(false);const[isHovered,setIsHovered]=useState(false);useEffect(()=>{if(typeof window===\"undefined\")return;const handleScroll=()=>{const scrollTop=window.scrollY;const docHeight=document.documentElement.scrollHeight-window.innerHeight;const scrollPercent=docHeight>0?scrollTop/docHeight*100:0;startTransition(()=>{setIsVisible(scrollPercent>10);});};window.addEventListener(\"scroll\",handleScroll);handleScroll();return()=>window.removeEventListener(\"scroll\",handleScroll);},[]);const handleClick=()=>{if(typeof window===\"undefined\")return;const docHeight=document.documentElement.scrollHeight-window.innerHeight;const targetScroll=docHeight*(scrollPosition/100);window.scrollTo({top:targetScroll,behavior:\"smooth\"});};return /*#__PURE__*/_jsx(AnimatePresence,{children:isVisible&&/*#__PURE__*/_jsx(motion.button,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:animationDuration},onClick:handleClick,onMouseEnter:()=>startTransition(()=>setIsHovered(true)),onMouseLeave:()=>startTransition(()=>setIsHovered(false)),style:{position:\"relative\",width:frameSize,height:frameSize,backgroundColor:isHovered?hoverFrameColor:frameColor,border:`1px solid ${borderColor}`,borderRadius:borderRadius,boxShadow:shadow,cursor:\"pointer\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",transition:`background-color ${animationDuration}s ease`,padding:0},\"aria-label\":\"Scroll to top\",children:/*#__PURE__*/_jsx(\"svg\",{width:iconSize,height:iconSize,viewBox:\"0 0 256 256\",fill:iconColor,xmlns:\"http://www.w3.org/2000/svg\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z\"})})})});}addPropertyControls(ScrollToTopButton,{frameColor:{type:ControlType.Color,title:\"Frame Color\",defaultValue:\"#FFFFFF\"},iconColor:{type:ControlType.Color,title:\"Icon Color\",defaultValue:\"#000000\"},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#EEEEEE\"},hoverFrameColor:{type:ControlType.Color,title:\"Hover Frame Color\",defaultValue:\"#F5F5F5\"},shadow:{type:ControlType.BoxShadow,title:\"Shadow\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:60,step:1,unit:\"px\"},scrollPosition:{type:ControlType.Number,title:\"Scroll Position\",defaultValue:0,min:0,max:100,step:1,unit:\"%\"},animationDuration:{type:ControlType.Number,title:\"Animation Duration\",defaultValue:.3,min:.1,max:2,step:.1,unit:\"s\"},frameSize:{type:ControlType.Number,title:\"Frame Size\",defaultValue:48,min:24,max:120,step:1,unit:\"px\",displayStepper:true},iconSize:{type:ControlType.Number,title:\"Icon Size\",defaultValue:24,min:12,max:80,step:1,unit:\"px\",displayStepper:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollToTopButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{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