{"version":3,"file":"Scroll_progress_bar.CXToZwwC.mjs","names":[],"sources":["https:/framerusercontent.com/modules/HvNHO2ScTr7HQzwUcSD4/gaG4psyF6bVtRqiDYWmW/Scroll_progress_bar.js"],"sourcesContent":["// ScrollProgressBar.tsx\n// @framerSupportedLayoutWidth auto\n// @framerSupportedLayoutHeight auto\nimport{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{motion,useMotionValue}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";export default function ScrollProgressBar({thickness,color,orientation,hPosition,vPosition}){const progress=useMotionValue(0);React.useEffect(()=>{const update=()=>{const doc=document.documentElement;const body=document.body;const scrollHeight=Math.max(body.scrollHeight,doc.scrollHeight,body.offsetHeight,doc.offsetHeight,body.clientHeight,doc.clientHeight);const viewport=doc.clientHeight;const max=Math.max(scrollHeight-viewport,1);const y=window.pageYOffset||doc.scrollTop||body.scrollTop||0;progress.set(Math.min(Math.max(y/max,0),1));};update();window.addEventListener(\"scroll\",update,{passive:true});window.addEventListener(\"resize\",update);return()=>{window.removeEventListener(\"scroll\",update);window.removeEventListener(\"resize\",update);};},[progress]);const t=Math.max(thickness,1);// Container style (fixed, full-page)\nconst container={position:\"fixed\",zIndex:9999,pointerEvents:\"none\"};let barStyle;if(orientation===\"horizontal\"){Object.assign(container,{left:0,right:0,height:t,top:hPosition===\"top\"?0:undefined,bottom:hPosition===\"bottom\"?0:undefined});barStyle={height:\"100%\",width:\"100%\",background:color,scaleX:progress,transformOrigin:\"0% 50%\",willChange:\"transform\"};}else{Object.assign(container,{top:0,bottom:0,width:t,left:vPosition===\"left\"?0:undefined,right:vPosition===\"right\"?0:undefined});barStyle={width:\"100%\",height:\"100%\",background:color,scaleY:progress,transformOrigin:\"50% 0%\",willChange:\"transform\"};}return /*#__PURE__*/_jsx(\"div\",{style:container,children:/*#__PURE__*/_jsx(motion.div,{style:barStyle})});}addPropertyControls(ScrollProgressBar,{thickness:{type:ControlType.Number,title:\"Thickness\",defaultValue:3,min:1,max:40,unit:\"px\"},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#FF1212\"},orientation:{type:ControlType.Enum,title:\"Orientation\",options:[\"horizontal\",\"vertical\"],optionTitles:[\"Horizontal\",\"Vertical\"],defaultValue:\"horizontal\"},hPosition:{type:ControlType.Enum,title:\"Position\",options:[\"top\",\"bottom\"],optionTitles:[\"Top\",\"Bottom\"],defaultValue:\"top\",hidden:p=>p.orientation!==\"horizontal\"},vPosition:{type:ControlType.Enum,title:\"Position\",options:[\"left\",\"right\"],optionTitles:[\"Left\",\"Right\"],defaultValue:\"left\",hidden:p=>p.orientation!==\"vertical\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollProgressBar\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Scroll_progress_bar.map"],"mappings":"gPAG4K,SAAwB,EAAkB,CAAC,YAAU,QAAM,cAAY,YAAU,aAAW,CAAC,IAAM,EAAS,EAAe,CAAC,EAAE,MAAoB,CAAC,IAAM,MAAW,CAAC,IAAM,EAAI,SAAS,gBAAsB,EAAK,SAAS,KAAW,EAAa,KAAK,IAAI,EAAK,aAAa,EAAI,aAAa,EAAK,aAAa,EAAI,aAAa,EAAK,aAAa,EAAI,YAAY,EAAQ,EAAS,EAAI,aAAmB,EAAI,KAAK,IAAI,EAAa,EAAS,CAAC,EAAQ,EAAE,EAAO,aAAa,EAAI,WAAW,EAAK,WAAW,EAAE,EAAS,IAAI,KAAK,IAAI,KAAK,IAAI,EAAE,EAAI,CAAC,EAAE,CAAC,CAAC,CAAE,EAA4G,OAA1G,EAAO,EAAE,EAAO,iBAAiB,SAAS,EAAO,CAAC,QAAQ,EAAI,CAAC,EAAE,EAAO,iBAAiB,SAAS,CAAM,MAAY,CAAC,EAAO,oBAAoB,SAAS,CAAM,EAAE,EAAO,oBAAoB,SAAS,CAAM,CAAE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