{"version":3,"file":"ScrollToTop.D_urt6Rc.mjs","names":["useState","useCallback"],"sources":["https:/framerusercontent.com/modules/j8043bcMGJ2N968x5Ygg/4OK1rcgGZoDwdG1POeaU/ScrollToTop.js"],"sourcesContent":["// Scroll to Top component with scroll progress indicator and click-to-scroll functionality\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useCallback}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Scroll To Top Button with Progress\n * Shows scroll progress and scrolls to top on click\n *\n * @framerIntrinsicWidth 56\n * @framerIntrinsicHeight 56\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ScrollToTop(props){const{background,color,size,borderRadius,shadow,icon,style}=props;const[visible,setVisible]=useState(false);const[progress,setProgress]=useState(0);// Scroll event handler\nconst handleScroll=useCallback(()=>{if(typeof window===\"undefined\")return;const scrollTop=window.scrollY||document.documentElement.scrollTop;const docHeight=document.documentElement.scrollHeight-window.innerHeight;const percent=docHeight>0?Math.min(1,scrollTop/docHeight):0;setProgress(percent);setVisible(scrollTop>80);},[]);useEffect(()=>{if(RenderTarget.current()!==RenderTarget.preview)return;if(typeof window===\"undefined\")return;const onScroll=()=>{handleScroll();};window.addEventListener(\"scroll\",onScroll,{passive:true});handleScroll();return()=>window.removeEventListener(\"scroll\",onScroll);},[handleScroll]);const handleClick=useCallback(()=>{if(typeof window!==\"undefined\"){window.scrollTo({top:0,behavior:\"smooth\"});}},[]);if(!visible||RenderTarget.current()===RenderTarget.thumbnail)return null;const iconSvg=icon===\"arrow\"?/*#__PURE__*/_jsx(\"svg\",{width:size*.5,height:size*.5,viewBox:\"0 0 24 24\",fill:\"none\",stroke:color,strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M12 19V5M5 12l7-7 7 7\"})}):/*#__PURE__*/_jsx(\"svg\",{width:size*.5,height:size*.5,viewBox:\"0 0 24 24\",fill:\"none\",stroke:color,strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"circle\",{cx:\"12\",cy:\"12\",r:\"10\"})});// Progress circle\nconst radius=size/2-3// Make ring fit exactly to border\n;const circumference=2*Math.PI*radius;const offset=circumference*(1-progress);return /*#__PURE__*/_jsxs(\"button\",{\"aria-label\":\"Scroll to top\",tabIndex:0,onClick:handleClick,style:{...style,position:\"fixed\",right:24,bottom:32,width:40,height:40,border:\"none\",outline:\"none\",borderRadius,background:\"#373737\",color:\"#fff\",boxShadow:shadow?\"0 4px 16px rgba(0,0,0,0.12)\":\"none\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",cursor:\"pointer\",zIndex:9999,transition:\"box-shadow 0.2s, background 0.2s\"},children:[/*#__PURE__*/_jsxs(\"svg\",{width:40,height:40,style:{position:\"absolute\",top:0,left:0,zIndex:2},\"aria-hidden\":\"true\",children:[/*#__PURE__*/_jsx(\"circle\",{cx:20,cy:20,r:radius,stroke:\"#fff\"// progress circle as white\n,strokeWidth:3,fill:\"none\",opacity:.15}),/*#__PURE__*/_jsx(\"circle\",{cx:20,cy:20,r:radius,stroke:\"#fff\"// progress circle as white\n,strokeWidth:3,fill:\"none\",strokeDasharray:circumference,strokeDashoffset:offset,strokeLinecap:\"round\",style:{transition:\"stroke-dashoffset 0.2s\"}})]}),/*#__PURE__*/_jsx(\"span\",{style:{position:\"relative\",zIndex:3,display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:iconSvg})]});}addPropertyControls(ScrollToTop,{background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#373737\"},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#fff\"},size:{type:ControlType.Number,title:\"Size\",defaultValue:40,min:32,max:120,step:1,unit:\"px\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:28,min:0,max:60,step:1,unit:\"px\"},shadow:{type:ControlType.Boolean,title:\"Shadow\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},icon:{type:ControlType.Enum,title:\"Icon\",options:[\"arrow\",\"circle\"],optionTitles:[\"Arrow Up\",\"Circle\"],defaultValue:\"arrow\",displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollToTop\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"56\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicHeight\":\"56\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollToTop.map"],"mappings":"mVAUG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,aAAW,QAAM,OAAK,eAAa,SAAO,OAAK,SAAO,EAAW,CAAC,EAAQ,GAAYA,EAAS,GAAM,CAAM,CAAC,EAAS,GAAaA,EAAS,EAAE,CAC3L,EAAaC,MAAgB,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,EAAU,EAAO,SAAS,SAAS,gBAAgB,UAAgB,EAAU,SAAS,gBAAgB,aAAa,EAAO,YAAkB,EAAQ,EAAU,EAAE,KAAK,IAAI,EAAE,EAAU,EAAU,CAAC,EAAE,EAAY,EAAQ,CAAC,EAAW,EAAU,GAAG,EAAG,EAAE,CAAC,CAAC,MAAc,CAAyD,GAArD,EAAa,SAAS,GAAG,EAAa,SAAyB,IAAS,OAAY,OAAO,IAAM,MAAa,CAAC,GAAc,EAA4E,OAAzE,EAAO,iBAAiB,SAAS,EAAS,CAAC,QAAQ,GAAK,CAAC,CAAC,GAAc,KAAW,EAAO,oBAAoB,SAAS,EAAS,EAAG,CAAC,EAAa,CAAC,CAAC,IAAM,EAAYA,MAAgB,CAAW,IAAS,QAAa,EAAO,SAAS,CAAC,IAAI,EAAE,SAAS,SAAS,CAAC,EAAI,EAAE,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