{"version":3,"file":"VerticalProgressIndicator.BOX_0aRg.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/u7mF3g8tddCHsdYDyow7/coOXCTciSI9E9FGK9wei/VerticalProgressIndicator.js"],"sourcesContent":["// Page scroll indicator that displays progress of page scroll\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect,startTransition}from\"react\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function PageScrollIndicator(props){const{thickness,backgroundColor,progressColor,fadeOnIdle,fadeDelay,borderRadius}=props;const[scrollProgress,setScrollProgress]=useState(0);const[isVisible,setIsVisible]=useState(false);useEffect(()=>{if(typeof window===\"undefined\")return;let timeoutId;const handleScroll=()=>{const windowHeight=window.innerHeight;const documentHeight=document.documentElement.scrollHeight;const scrollTop=window.scrollY||document.documentElement.scrollTop;const totalScrollable=documentHeight-windowHeight;const progress=totalScrollable>0?scrollTop/totalScrollable*100:0;startTransition(()=>{setScrollProgress(Math.min(100,Math.max(0,progress)));if(fadeOnIdle&&progress>0){setIsVisible(true);}else if(!fadeOnIdle&&progress>0){setIsVisible(true);}});if(fadeOnIdle&&progress>0){clearTimeout(timeoutId);timeoutId=window.setTimeout(()=>{startTransition(()=>{setIsVisible(false);});},fadeDelay);}};handleScroll();window.addEventListener(\"scroll\",handleScroll,{passive:true});return()=>{window.removeEventListener(\"scroll\",handleScroll);clearTimeout(timeoutId);};},[fadeOnIdle,fadeDelay]);const barSize=40// Size of the moving bar in pixels\n;// Calculate the position of the moving bar\nconst getBarStyle=()=>{const baseStyle={position:\"absolute\",backgroundColor:progressColor,borderRadius:`${borderRadius}px`};return{...baseStyle,left:0,top:`${scrollProgress}%`,transform:`translateY(-${scrollProgress}%)`,width:`${thickness}px`,height:`${barSize}px`};};return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:`${thickness}px`,height:\"100%\",backgroundColor,borderRadius:`${borderRadius}px`,overflow:\"hidden\",opacity:fadeOnIdle?isVisible?1:0:1,transition:fadeOnIdle?\"opacity 0.3s ease-out\":\"none\"},children:/*#__PURE__*/_jsx(\"div\",{style:getBarStyle()})});}addPropertyControls(PageScrollIndicator,{thickness:{type:ControlType.Number,title:\"Thickness\",defaultValue:4,min:2,max:20,step:1,unit:\"px\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#EEEEEE\"},progressColor:{type:ControlType.Color,title:\"Progress\",defaultValue:\"#0099FF\"},borderRadius:{type:ControlType.Number,title:\"Corner Radius\",defaultValue:8,min:0,max:50,step:1,unit:\"px\"},fadeOnIdle:{type:ControlType.Boolean,title:\"Fade on Idle\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},fadeDelay:{type:ControlType.Number,title:\"Fade Delay\",defaultValue:1e3,min:100,max:5e3,step:100,unit:\"ms\",hidden:({fadeOnIdle})=>!fadeOnIdle}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PageScrollIndicator\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./VerticalProgressIndicator.map"],"mappings":"uMAIG,SAAwB,EAAoB,EAAM,CAAC,GAAK,CAAC,YAAU,kBAAgB,gBAAc,aAAW,YAAU,gBAAc,EAAW,CAAC,EAAe,GAAmBA,EAAS,EAAE,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAE8B,OAF7B,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAI,EAAgB,MAAiB,CAAC,IAAM,EAAa,EAAO,YAAkB,EAAe,SAAS,gBAAgB,aAAmB,EAAU,EAAO,SAAS,SAAS,gBAAgB,UAAgB,EAAgB,EAAe,EAAmB,EAAS,EAAgB,EAAE,EAAU,EAAgB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