{"version":3,"file":"ScrollProgressButton.CdBdI5HT.mjs","names":["useState","useCallback"],"sources":["https:/framerusercontent.com/modules/mYLbUqkgrPvHA0JgOVOZ/OvEJKNKHmoNJqbtLYHWt/ScrollProgressButton.js"],"sourcesContent":["// Rectangle Back to Top button with maximum corner rounding, scroll progress stroke, and arrow icon\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useCallback,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * Rectangle Back to Top Button with Scroll Progress\n * Shows a rounded rectangle button with an arrow icon. The button fills as you scroll down the page. Clicking scrolls to top.\n *\n * @framerIntrinsicWidth 128\n * @framerIntrinsicHeight 64\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ScrollProgressButton(props){const{background=\"#ffffff\",fillColor=\"#696969\",iconColor=\"#121212\",size=64,showBelow=200,style,padding=\"0px 48px 0px 24px\"}=props;const[visible,setVisible]=useState(false);const[progress,setProgress]=useState(0);const isStatic=useIsStaticRenderer();useEffect(()=>{if(typeof window===\"undefined\"||isStatic)return;function onScroll(){const scrollY=window.scrollY||window.pageYOffset;const docHeight=document.documentElement.scrollHeight-window.innerHeight;const percent=docHeight>0?Math.min(scrollY/docHeight,1):0;startTransition(()=>{setProgress(percent);setVisible(scrollY>showBelow);});}window.addEventListener(\"scroll\",onScroll,{passive:true});onScroll();return()=>window.removeEventListener(\"scroll\",onScroll);},[isStatic,showBelow]);const handleClick=useCallback(()=>{if(typeof window!==\"undefined\"){window.scrollTo({top:0,behavior:\"smooth\"});}},[]);// Always visible\n// Rectangle: width is 2x height\nconst width=size*2;const height=size;const borderRadius=height/2;// For stroke progress\nconst strokeWidth=4;const rx=borderRadius-strokeWidth/2;const w=width-strokeWidth;const h=height-strokeWidth;const perimeter=2*(w+h-2*rx)+Math.PI*rx;const progressLength=perimeter*progress;if(!visible)return null;return /*#__PURE__*/_jsxs(\"div\",{role:\"button\",tabIndex:0,\"aria-label\":\"Back to top\",onClick:handleClick,onKeyDown:e=>{if(e.key===\"Enter\"||e.key===\" \")handleClick();},style:{...style,padding:0,position:\"relative\",width:width,height:height,border:\"none\",borderRadius:borderRadius,background,boxShadow:\"0 2px 8px rgba(0,0,0,0.12)\",cursor:\"pointer\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",outline:\"none\",transition:\"box-shadow 0.2s\",zIndex:1e3,overflow:\"visible\",userSelect:\"none\",pointerEvents:\"auto\"},children:[/*#__PURE__*/_jsxs(\"svg\",{width:width,height:height,style:{position:\"absolute\",top:0,left:0,pointerEvents:\"none\",zIndex:2},pointerEvents:\"none\",children:[/*#__PURE__*/_jsx(\"rect\",{x:strokeWidth/2,y:strokeWidth/2,width:width-strokeWidth,height:height-strokeWidth,rx:borderRadius-strokeWidth/2,ry:borderRadius-strokeWidth/2,fill:\"none\",stroke:\"rgba(0,0,0,0.08)\",strokeWidth:strokeWidth}),/*#__PURE__*/_jsx(\"rect\",{x:strokeWidth/2,y:strokeWidth/2,width:width-strokeWidth,height:height-strokeWidth,rx:borderRadius-strokeWidth/2,ry:borderRadius-strokeWidth/2,fill:\"none\",stroke:fillColor,strokeWidth:strokeWidth,strokeDasharray:perimeter,strokeDashoffset:perimeter-progressLength,style:{transition:\"stroke-dashoffset 0.2s\"}})]}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"center\",zIndex:3,padding:padding,width:\"100%\",height:\"100%\",justifyContent:\"center\",pointerEvents:\"none\"},children:[/*#__PURE__*/_jsx(\"svg\",{width:size*.36,height:size*.38,viewBox:\"0 0 24 28\",\"aria-hidden\":\"true\",style:{display:\"block\",pointerEvents:\"none\"},children:/*#__PURE__*/_jsx(\"path\",{d:\"M12 22V7M12 7C12 7 7 13 7 13M12 7C12 7 17 13 17 13\",stroke:iconColor,strokeWidth:\"1.2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",fill:\"none\"})}),/*#__PURE__*/_jsx(\"span\",{style:{marginLeft:5,color:iconColor,fontSize:Math.round(size*.22),fontWeight:300,fontFamily:\"inherit\",userSelect:\"none\",whiteSpace:\"nowrap\",letterSpacing:\"-0.01em\"},children:\"Back to Top\"})]})]});}addPropertyControls(ScrollProgressButton,{padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"0px 48px 0px 24px\"},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#ffffff\"},fillColor:{type:ControlType.Color,title:\"Stroke Color\",defaultValue:\"#696969\"},iconColor:{type:ControlType.Color,title:\"Arrow/Text Color\",defaultValue:\"#121212\"},size:{type:ControlType.Number,title:\"Size\",defaultValue:64,min:32,max:128,step:1,unit:\"px\"},showBelow:{type:ControlType.Number,title:\"Show Below (px)\",defaultValue:200,min:0,max:2e3,step:10}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollProgressButton\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"128\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicHeight\":\"64\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollProgressButton.map"],"mappings":"iWAUG,SAAwB,EAAqB,EAAM,CAAC,GAAK,CAAC,aAAW,UAAU,YAAU,UAAU,YAAU,UAAU,OAAK,GAAG,YAAU,IAAI,QAAM,UAAQ,oBAAoB,CAAC,EAAW,CAAC,EAAQ,EAAW,CAACA,EAAS,IAAY,CAAC,EAAS,EAAY,CAACA,EAAS,GAAS,EAAS,IAAsB,MAAc,CAAC,GAAU,IAAS,QAAa,EAAS,OAAO,SAAS,GAAU,CAAC,IAAM,EAAQ,EAAO,SAAS,EAAO,YAAkB,EAAU,SAAS,gBAAgB,aAAa,EAAO,YAAkB,EAAQ,EAAU,EAAE,KAAK,IAAI,EAAQ,EAAU,GAAG,EAAE,MAAoB,CAAC,EAAY,GAAS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