{"version":3,"file":"Progress.CTGEcDAM.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/pxMZBVrFBwaJXomvfw71/RVtqm1EElrI6xFr8ofPG/Progress.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";//Code component provided by Eleveight Supply™. All rights reserved 2024.\n/**\n * @framerDisableUnlink\n *\n * @framerIntrinsicWidth 1200\n * @framerIntrinsicHeight 300\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight 100%\n */export default function Progress(props){const[scrollProgress,setScrollProgress]=useState(0);const progressBarRef=useRef(null);const updateScrollProgress=()=>{const totalPageHeight=document.documentElement.scrollHeight-window.innerHeight;const scrollPosition=window.scrollY;const scrollPercentage=Math.min(scrollPosition/totalPageHeight*100,100);setScrollProgress(scrollPercentage);};useEffect(()=>{window.addEventListener(\"scroll\",updateScrollProgress);return()=>{window.removeEventListener(\"scroll\",updateScrollProgress);};},[]);const controlledGlowSpread=spread=>{return Math.log(spread+1)*10;};const getBackgroundStyle=()=>{if(props.fillType===\"gradient\"){return`linear-gradient(90deg, ${props.gradientStartColor}, ${props.gradientEndColor})`;}return props.fillColor;};const getGlowStyle=()=>{if(props.fillType===\"gradient\"||!props.glowEnabled)return{};const glowColor=props.glowColor||props.fillColor;return{boxShadow:`0 0 ${controlledGlowSpread(props.glowSpread)}px ${controlledGlowSpread(props.glowSpread)}px ${glowColor}`,opacity:props.glowIntensity/100};};return /*#__PURE__*/_jsxs(\"div\",{ref:progressBarRef,style:{width:\"100%\",height:`${props.barHeight}px`,background:getBackgroundStyle(),position:\"relative\",overflow:\"visible\"},role:\"progressbar\",\"aria-valuenow\":Math.round(scrollProgress),\"aria-valuemin\":0,\"aria-valuemax\":100,children:[/*#__PURE__*/_jsx(\"div\",{style:{width:`${100-scrollProgress}%`,height:\"100%\",backgroundColor:props.backgroundColor,position:\"absolute\",top:0,right:0,transition:\"width 0s\"}}),props.fillType===\"solid\"&&props.glowEnabled&&/*#__PURE__*/_jsx(\"div\",{style:{width:`${scrollProgress}%`,height:\"100%\",position:\"absolute\",top:0,left:0,background:props.fillColor,...getGlowStyle(),zIndex:1,transition:\"width 0s\"}})]});}addPropertyControls(Progress,{barHeight:{type:ControlType.Number,defaultValue:2,min:1,max:50,step:1,displayStepper:true,unit:\"px\",title:\"Bar Height\"},backgroundColor:{type:ControlType.Color,defaultValue:\"#757575\",title:\"Background\"},fillColor:{type:ControlType.Color,defaultValue:\"#6200EE\",title:\"Fill\",description:\"Unlock the Full version of the component on [Eleveight Supply](https://www.eleveight.supply/components/scrollprogress)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Progress\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"1200\",\"framerDisableUnlink\":\"*\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"300\",\"framerSupportedLayoutHeight\":\"100%\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Progress.map"],"mappings":"wMASG,SAAwB,EAAS,EAAM,CAAC,GAAK,CAAC,EAAe,GAAmBA,EAAS,EAAE,CAAO,EAAeC,EAAO,KAAK,CAAO,MAAyB,CAAC,IAAM,EAAgB,SAAS,gBAAgB,aAAa,EAAO,YAAkB,EAAe,EAAO,QAAgF,EAAjD,KAAK,IAAI,EAAe,EAAgB,IAAI,IAAI,CAAoC,EAAG,OAAe,EAAO,iBAAiB,SAAS,EAAqB,KAAW,CAAC,EAAO,oBAAoB,SAAS,EAAqB,GAAK,EAAE,CAAC,CAAC,IAAM,EAAqB,GAAgB,KAAK,IAAI,EAAO,EAAE,CAAC,GAAW,MAA2B,EAAM,WAAW,WAAkB,0BAA0B,EAAM,mBAAmB,IAAI,EAAM,iBAAiB,GAAW,EAAM,UAAkB,MA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