{"version":3,"file":"Scrollprogress.DtIVe-R0.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/0JbLZy4cicPNL8ihEfRO/nApVOnbQSRaEXWZIDiOm/Scrollprogress.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion}from\"framer-motion\";// 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 ScrollProgress(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;};// For gradient fills, adjust the angle based on orientation\nconst getBackgroundStyle=()=>{if(props.fillType===\"gradient\"){const angle=props.orientation===\"vertical\"?\"180deg\":\"90deg\";return`linear-gradient(${angle}, ${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};};// Determine orientation\nconst isVertical=props.orientation===\"vertical\";// Container style: for vertical we use a fixed width (the bar \"thickness\")\nconst containerStyle=isVertical?{width:`${props.barHeight}px`,height:\"100%\",background:getBackgroundStyle(),position:\"relative\",overflow:\"visible\"}:{width:\"100%\",height:`${props.barHeight}px`,background:getBackgroundStyle(),position:\"relative\",overflow:\"visible\"};return /*#__PURE__*/_jsxs(\"div\",{ref:progressBarRef,style:containerStyle,role:\"progressbar\",\"aria-valuenow\":Math.round(scrollProgress),\"aria-valuemin\":0,\"aria-valuemax\":100,children:[/*#__PURE__*/_jsx(motion.div,{initial:isVertical?{height:\"100%\"}:{width:\"100%\"},animate:isVertical?{height:`${100-scrollProgress}%`}:{width:`${100-scrollProgress}%`},transition:props.transition,style:isVertical?{width:\"100%\",backgroundColor:props.backgroundColor,position:\"absolute\",bottom:0,left:0}:{height:\"100%\",backgroundColor:props.backgroundColor,position:\"absolute\",top:0,right:0}}),props.fillType===\"solid\"&&props.glowEnabled&&/*#__PURE__*/_jsx(motion.div,{initial:isVertical?{height:\"0%\"}:{width:\"0%\"},animate:isVertical?{height:`${scrollProgress}%`}:{width:`${scrollProgress}%`},transition:props.transition,style:isVertical?{width:\"100%\",background:props.fillColor,position:\"absolute\",top:0,left:0,...getGlowStyle(),zIndex:1}:{height:\"100%\",background:props.fillColor,position:\"absolute\",top:0,left:0,...getGlowStyle(),zIndex:1}})]});}addPropertyControls(ScrollProgress,{orientation:{type:ControlType.SegmentedEnum,title:\"Orientation\",defaultValue:\"horizontal\",options:[\"horizontal\",\"vertical\"],optionTitles:[\"Horizontal\",\"Vertical\"]},barHeight:{type:ControlType.Number,defaultValue:2,min:1,max:50,step:1,displayStepper:true,unit:\"px\",title:\"Bar Thickness\"},backgroundColor:{type:ControlType.Color,defaultValue:\"#757575\",title:\"Background\"},fillType:{type:ControlType.SegmentedEnum,title:\"Fill Type\",defaultValue:\"solid\",options:[\"solid\",\"gradient\"],optionTitles:[\"Solid\",\"Gradient\"],onChange:(value,props)=>{if(value===\"gradient\"){props.glowEnabled=false;}}},fillColor:{type:ControlType.Color,defaultValue:\"#6200EE\",title:\"Fill\",hidden(props){return props.fillType===\"gradient\";}},gradientStartColor:{type:ControlType.Color,defaultValue:\"#6200EE\",title:\"Start\",hidden(props){return props.fillType===\"solid\";}},gradientEndColor:{type:ControlType.Color,defaultValue:\"#FF00AA\",title:\"End\",hidden(props){return props.fillType===\"solid\";}},glowEnabled:{type:ControlType.Boolean,title:\"Glow\",defaultValue:false,hidden(props){return props.fillType===\"gradient\";}},glowColor:{type:ControlType.Color,defaultValue:\"#6200EE\",title:\"Color\",hidden(props){return props.fillType===\"gradient\"||!props.glowEnabled;}},glowIntensity:{type:ControlType.Number,defaultValue:12,min:0,max:100,step:1,displayStepper:true,unit:\"%\",title:\"Intensity\",hidden(props){return!props.glowEnabled;}},glowSpread:{type:ControlType.Number,defaultValue:3,min:1,max:100,step:1,displayStepper:true,unit:\"%\",title:\"Spread\",hidden(props){return!props.glowEnabled;}},transition:{type:ControlType.Transition,title:\"Transition\",defaultValue:{type:\"tween\",duration:0}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollProgress\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"100%\",\"framerIntrinsicWidth\":\"1200\",\"framerDisableUnlink\":\"*\",\"framerIntrinsicHeight\":\"300\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Scrollprogress.map"],"mappings":"+PASG,SAAwB,EAAe,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,GACnlB,MAA2B,EAA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