{"version":3,"file":"NumericScrollProgress.BUUQ99bA.mjs","names":["useState","useRef","useEffect","startTransition","useMemo","_jsx","__esmMin","pe","init_npm_react_18_3_1","init_ssg_sandbox_shims","te","window","_e","c","init_jsx_runtime","ce","de","init_framer_ChujFWHC","addPropertyControls","useIsStaticRenderer","ControlType","NumericScrollProgress","props","textColor","backgroundColor","showBackground","borderRadius","font","style","isStatic","progress","setProgress","visible","setVisible","hideTimeoutRef","calculateProgress","scrollTop","docHeight","viewportHeight","raw","clamped","timeoutId","displayText","isFixedWidth","isFixedHeight","isVisible","init_NumericScrollProgress"],"sources":["https:/framerusercontent.com/modules/bu5akYku1sCOX4wycen6/5ZVZ8zgUGZTmJbyS09fi/NumericScrollProgress.js"],"sourcesContent":["// User goal: create a numeric scroll progress component that scrolls with the page vertically.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,useMemo,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useRef}from\"react\";/**\n * NumericScrollProgress\n *\n * Displays the vertical scroll progress (0–100%) as a number that updates while the page scrolls.\n *\n * @framerIntrinsicWidth 80\n * @framerIntrinsicHeight 40\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function NumericScrollProgress(props){const{textColor,backgroundColor,showBackground,borderRadius,font,style}=props;const isStatic=useIsStaticRenderer();const[progress,setProgress]=useState(0);const[visible,setVisible]=useState(false);const hideTimeoutRef=useRef(null);useEffect(()=>{if(isStatic)return;function calculateProgress(){if(typeof window===\"undefined\"||typeof document===\"undefined\")return;const scrollTop=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;const docHeight=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight);const viewportHeight=window.innerHeight||document.documentElement.clientHeight||0;const scrollable=Math.max(docHeight-viewportHeight,1);const raw=scrollTop/scrollable*100;const clamped=Math.min(Math.max(raw,0),100);startTransition(()=>{setProgress(Math.round(clamped));setVisible(true);});if(hideTimeoutRef.current!==null&&typeof window!==\"undefined\"){window.clearTimeout(hideTimeoutRef.current);}if(typeof window!==\"undefined\"){const timeoutId=window.setTimeout(()=>{startTransition(()=>{setVisible(false);});},600);hideTimeoutRef.current=timeoutId;}}if(typeof window!==\"undefined\"){window.addEventListener(\"scroll\",calculateProgress,{passive:true});window.addEventListener(\"resize\",calculateProgress);return()=>{window.removeEventListener(\"scroll\",calculateProgress);window.removeEventListener(\"resize\",calculateProgress);if(hideTimeoutRef.current!==null&&typeof window!==\"undefined\"){window.clearTimeout(hideTimeoutRef.current);}};}return;},[isStatic]);const displayText=useMemo(()=>`${progress}%`,[progress]);const isFixedWidth=style&&style.width===\"100%\";const isFixedHeight=style&&style.height===\"100%\";const isVisible=isStatic?true:visible;return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",padding:\"8px 12px\",color:textColor,backgroundColor:showBackground?backgroundColor:\"transparent\",borderRadius,boxSizing:\"border-box\",minWidth:isFixedWidth?undefined:\"max-content\",minHeight:isFixedHeight?undefined:\"max-content\",opacity:isVisible?1:0,transform:isVisible?\"translateY(0px)\":\"translateY(8px)\",transition:\"opacity 0.4s ease-out, transform 0.4s ease-out\",pointerEvents:isVisible?\"auto\":\"none\",...font,...style},\"aria-label\":`Scroll progress: ${progress} percent`,role:\"status\",children:/*#__PURE__*/_jsx(\"span\",{style:{width:\"max-content\",lineHeight:\"1em\",whiteSpace:\"nowrap\"},children:displayText})});}addPropertyControls(NumericScrollProgress,{textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#000000\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},showBackground:{type:ControlType.Boolean,title:\"Background\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:48,step:1,unit:\"px\"},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"NumericScrollProgress\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"40\",\"framerIntrinsicWidth\":\"80\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./NumericScrollProgress.map"],"mappings":"A,4NAWG,SAAwBqB,EAAsBC,EAAM,CAAC,GAAK,CAACC,YAAUC,kBAAgBC,iBAAeC,eAAaC,OAAKC,SAAON,EAAYO,EAASV,EAAoB,EAAO,CAACW,EAASC,GAAa/B,EAAS,CAAC,EAAO,CAACgC,EAAQC,GAAYjC,EAAS,EAAK,EAAQkC,EAAejC,EAAO,IAAI,EAAEC,MAAc,CAAC,GAAG2B,EAAS,OAAO,SAASM,GAAmB,CAAC,GAAUxB,IAAS,QAAa,OAAO,SAAW,IAAY,OAAO,IAAMyB,EAAUzB,EAAO,aAAa,SAAS,gBAAgB,WAAW,SAAS,KAAK,WAAW,EAAQ0B,EAAU,KAAK,IAAI,SAAS,KAAK,aAAa,SAAS,gBAAgB,aAAa,SAAS,KAAK,aAAa,SAAS,gBAAgB,aAAa,SAAS,KAAK,aAAa,SAAS,gBAAgB,YAAY,EAAQC,EAAe3B,EAAO,aAAa,SAAS,gBAAgB,cAAc,EAA8D4B,EAAIH,EAA/C,KAAK,IAAIC,EAAUC,EAAe,CAAgC,EAAE,IAAUE,EAAQ,KAAK,IAAI,KAAK,IAAID,EAAI,CAAC,EAAE,GAAG,EAAwL,GAAtLpC,MAAoB,CAAC4B,EAAY,KAAK,MAAMS,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