{"version":3,"file":"ScrollToTopButton.CQSPcwp9.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/xuzoyoQeIbxWDI5eBhTU/DpI5TEmQEV6JTEikxa1u/ScrollToTopButton.js"],"sourcesContent":["// Animated button to scroll back to top of page\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,startTransition}from\"react\";import{motion,AnimatePresence}from\"framer-motion\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * Scroll to Top Button\n * \n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ScrollToTopButton(props){const{showThreshold=300,backgroundColor=\"#000000\",iconColor=\"#FFFFFF\",size=50,borderRadius=25,shadow=true,position=\"bottom-right\",offset=20,animationType=\"fade\"}=props;const[isVisible,setIsVisible]=useState(false);const isStatic=useIsStaticRenderer();useEffect(()=>{if(isStatic||typeof window===\"undefined\")return;const toggleVisibility=()=>{if(window.pageYOffset>showThreshold){startTransition(()=>setIsVisible(true));}else{startTransition(()=>setIsVisible(false));}};window.addEventListener(\"scroll\",toggleVisibility);return()=>window.removeEventListener(\"scroll\",toggleVisibility);},[showThreshold,isStatic]);const scrollToTop=()=>{if(typeof window!==\"undefined\"){window.scrollTo({top:0,behavior:\"smooth\"});}};const getPositionStyles=()=>{const baseStyles={position:\"fixed\",zIndex:1e3};switch(position){case\"bottom-right\":return{...baseStyles,bottom:offset,right:offset};case\"bottom-left\":return{...baseStyles,bottom:offset,left:offset};case\"bottom-center\":return{...baseStyles,bottom:offset,left:\"50%\",transform:\"translateX(-50%)\"};default:return{...baseStyles,bottom:offset,right:offset};}};const getAnimationVariants=()=>{switch(animationType){case\"slide\":return{initial:{y:100,opacity:0},animate:{y:0,opacity:1},exit:{y:100,opacity:0}};case\"scale\":return{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0}};default:return{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}};}};// Show static preview in Canvas\nif(isStatic){return /*#__PURE__*/_jsx(\"div\",{style:{width:size,height:size,backgroundColor,borderRadius,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",cursor:\"pointer\",boxShadow:shadow?\"0 4px 12px rgba(0, 0, 0, 0.15)\":\"none\",position:\"relative\"},children:/*#__PURE__*/_jsx(\"svg\",{width:size*.4,height:size*.4,viewBox:\"0 0 24 24\",fill:\"none\",stroke:iconColor,strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M18 15l-6-6-6 6\"})})});}return /*#__PURE__*/_jsx(AnimatePresence,{children:isVisible&&/*#__PURE__*/_jsx(motion.button,{style:{...getPositionStyles(),width:size,height:size,backgroundColor,border:\"none\",borderRadius,cursor:\"pointer\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",boxShadow:shadow?\"0 4px 12px rgba(0, 0, 0, 0.15)\":\"none\",outline:\"none\"},variants:getAnimationVariants(),initial:\"initial\",animate:\"animate\",exit:\"exit\",transition:{duration:.3,ease:\"easeInOut\"},whileHover:{scale:1.1},whileTap:{scale:.95},onClick:scrollToTop,\"aria-label\":\"Scroll to top\",children:/*#__PURE__*/_jsx(\"svg\",{width:size*.4,height:size*.4,viewBox:\"0 0 24 24\",fill:\"none\",stroke:iconColor,strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M18 15l-6-6-6 6\"})})})});}addPropertyControls(ScrollToTopButton,{showThreshold:{type:ControlType.Number,title:\"Show Threshold\",defaultValue:300,min:0,max:1e3,step:50,unit:\"px\"},backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"#000000\"},iconColor:{type:ControlType.Color,title:\"Icon Color\",defaultValue:\"#FFFFFF\"},size:{type:ControlType.Number,title:\"Size\",defaultValue:50,min:30,max:80,step:5,unit:\"px\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:25,min:0,max:40,step:1,unit:\"px\"},shadow:{type:ControlType.Boolean,title:\"Shadow\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},position:{type:ControlType.Enum,title:\"Position\",options:[\"bottom-right\",\"bottom-left\",\"bottom-center\"],optionTitles:[\"Bottom Right\",\"Bottom Left\",\"Bottom Center\"],defaultValue:\"bottom-right\",displaySegmentedControl:true},offset:{type:ControlType.Number,title:\"Offset\",defaultValue:20,min:10,max:50,step:5,unit:\"px\"},animationType:{type:ControlType.Enum,title:\"Animation\",options:[\"fade\",\"slide\",\"scale\"],optionTitles:[\"Fade\",\"Slide\",\"Scale\"],defaultValue:\"fade\",displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollToTopButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollToTopButton.map"],"mappings":"ubAMG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,gBAAc,IAAI,kBAAgB,UAAU,YAAU,UAAU,OAAK,GAAG,eAAa,GAAG,SAAO,GAAK,WAAS,eAAe,SAAO,GAAG,gBAAc,OAAO,CAAC,EAAW,CAAC,EAAU,EAAa,CAACA,EAAS,IAAa,EAAS,IAAsB,MAAc,CAAC,GAAG,GAAiB,IAAS,OAAY,OAAO,IAAM,MAAqB,CAAI,EAAO,YAAY,EAAe,MAAoB,EAAa,KAAa,MAAoB,EAAa,IAAU,EAAoD,OAAnD,EAAO,iBAAiB,SAAS,OAA4B,EAAO,oBAAoB,SAAS,EAAmB,EAAC,CAAC,EAAc,EAAS,EAAE,IAAM,MAAgB,CAAW,IAAS,QAAa,EAAO,SAAS,CAAC,IAAI,EAAE,SAAS,SAAS,CAAI,EAAO,MAAsB,CAAC,IAAM,EAAW,CAAC,SAAS,QAAQ,OAAO,IAAI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