{"version":3,"file":"ReadingProgress.CLJIUe8Z.mjs","names":["useState","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","te","window","ce","init_jsx_runtime","p","_e","addPropertyControls","ControlType","init_framer_BisrWwwE","ReadingProgress","props","progress","setProgress","sectionInView","setSectionInView","fadeIn","setFadeIn","updateProgress","section","sectionSelector","scrollTop","docHeight","inView","rect","sectionTop","sectionHeight","sectionBottom","winHeight","scrollY","percent","stickyStyle","style","backgroundColor","barColor","textColor","font","title","init_ReadingProgress"],"sources":["https:/framerusercontent.com/modules/s4I2dYy37i3obnDu5FXr/6XrQ5TjsbwJWnqpZSc8o/ReadingProgress.js"],"sourcesContent":["// Progress bar that sticks to the bottom of the viewport and updates as you scroll\n// Supports CMS connection for blog title field\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Sticky Reading Progress Bar\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ReadingProgress(props){const{title,backgroundColor,barColor,textColor,font,style={},padding,radius,shadow,sectionSelector}=props;const[progress,setProgress]=useState(0);const[sectionInView,setSectionInView]=useState(false);const[fadeIn,setFadeIn]=useState(false);useEffect(()=>{function updateProgress(){if(typeof window===\"undefined\"||typeof document===\"undefined\")return;let section=null;if(sectionSelector){section=document.querySelector(sectionSelector);}let scrollTop,docHeight;let inView=false;if(section){const rect=section.getBoundingClientRect();const sectionTop=rect.top+window.scrollY;const sectionHeight=section.offsetHeight;const sectionBottom=sectionTop+sectionHeight;const winHeight=window.innerHeight;const scrollY=window.scrollY;// Check if section is in viewport\ninView=rect.bottom>0&&rect.top<winHeight;if(!inView){startTransition(()=>setProgress(0));startTransition(()=>setSectionInView(false));startTransition(()=>setFadeIn(false));return;}startTransition(()=>setSectionInView(true));// Fade in when section comes into view\nif(!fadeIn){startTransition(()=>setFadeIn(true));}if(scrollY<sectionTop){startTransition(()=>setProgress(0));return;}if(scrollY+winHeight>sectionBottom){startTransition(()=>setProgress(100));return;}scrollTop=scrollY-sectionTop;docHeight=sectionHeight-winHeight;}else{scrollTop=window.scrollY||document.documentElement.scrollTop;docHeight=document.documentElement.scrollHeight-window.innerHeight;inView=true;startTransition(()=>setSectionInView(true));// Fade in immediately if no section selector\nif(!fadeIn){startTransition(()=>setFadeIn(true));}}const percent=docHeight>0?Math.round(scrollTop/docHeight*100):0;startTransition(()=>setProgress(percent));}if(typeof window!==\"undefined\"){window.addEventListener(\"scroll\",updateProgress,{passive:true});updateProgress();return()=>window.removeEventListener(\"scroll\",updateProgress);}},[sectionSelector]);// Sticky to bottom\nconst stickyStyle={position:style?.position||\"relative\",left:undefined,right:undefined,bottom:undefined,zIndex:1,pointerEvents:\"auto\",width:style?.width||\"100%\",height:style?.height,...style};return /*#__PURE__*/_jsxs(\"div\",{style:{...stickyStyle,borderRadius:props.radius,background:backgroundColor,boxShadow:props.shadow?\"0 2px 8px rgba(0,0,0,0.10)\":\"none\",display:\"flex\",alignItems:\"center\",padding:props.padding,gap:16,overflow:\"hidden\",minHeight:56,minWidth:0,opacity:fadeIn?1:0,transition:\"opacity 0.5s ease-in-out\"},\"aria-label\":\"Reading progress bar\",role:\"progressbar\",\"aria-valuenow\":progress,\"aria-valuemin\":0,\"aria-valuemax\":100,children:[/*#__PURE__*/_jsxs(\"button\",{\"aria-label\":\"Scroll to top\",tabIndex:progress>10?0:-1,onClick:()=>{if(progress>10&&typeof window!==\"undefined\"){window.scrollTo({top:0,behavior:\"smooth\"});}},style:{width:40,height:40,borderRadius:\"50%\",background:\"rgba(0,0,0,0.10)\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",position:\"relative\",border:\"none\",cursor:progress>10?\"pointer\":\"default\",outline:\"none\",transition:\"background 0.2s, box-shadow 0.2s\",boxShadow:progress>10?\"0 2px 8px rgba(0,0,0,0.10)\":\"none\",padding:0,opacity:sectionInView?1:.5},disabled:progress<=10||!sectionInView,children:[/*#__PURE__*/_jsx(\"svg\",{width:40,height:40,style:{position:\"absolute\",top:0,left:0},children:/*#__PURE__*/_jsx(\"circle\",{cx:20,cy:20,r:16,stroke:barColor,strokeWidth:3,fill:\"none\",strokeDasharray:2*Math.PI*16,strokeDashoffset:2*Math.PI*16*(1-progress/100),style:{transition:\"stroke-dashoffset 0.3s\"}})}),/*#__PURE__*/_jsx(\"svg\",{width:22,height:22,viewBox:\"0 0 256 256\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",style:{opacity:progress>10&&sectionInView?1:0,transition:\"opacity 0.4s\",zIndex:2,pointerEvents:\"none\"},\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M128 208V48M128 48l-80 80M128 48l80 80\",stroke:barColor,strokeWidth:16,strokeLinecap:\"round\",strokeLinejoin:\"round\"})})]}),/*#__PURE__*/_jsxs(\"div\",{style:{flex:1,minWidth:0},children:[/*#__PURE__*/_jsx(\"div\",{style:{color:textColor,fontWeight:600,fontSize:font.fontSize,lineHeight:font.lineHeight,letterSpacing:font.letterSpacing,fontStyle:font.fontStyle,textAlign:\"left\",whiteSpace:\"normal\",overflowWrap:\"break-word\",wordBreak:\"break-word\",minWidth:0,...font},children:title}),/*#__PURE__*/_jsxs(\"div\",{style:{color:textColor,opacity:.7,fontSize:14,fontWeight:400,marginTop:2},children:[progress,\"%\"]})]})]});}addPropertyControls(ReadingProgress,{title:{type:ControlType.String,title:\"Title\",defaultValue:\"Starting and Growing a Career in Web Design\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#232323\"},barColor:{type:ControlType.Color,title:\"Bar Color\",defaultValue:\"#FFFFFF\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#FFFFFF\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:16,variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"}},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"0 24px\"},radius:{type:ControlType.BorderRadius,title:\"Radius\",defaultValue:\"20px\"},shadow:{type:ControlType.Boolean,title:\"Shadow\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},sectionSelector:{type:ControlType.String,title:\"Section Selector\",defaultValue:\"\",placeholder:\"e.g. #main-content or .blog-article\",description:\"CSS selector for the section to track (optional)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ReadingProgress\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ReadingProgress.map"],"mappings":"A,yMAOG,SAAwBa,EAAgB,EAAM,CAAC,GAAK,CAAC,QAAM,kBAAgB,WAAS,YAAU,OAAK,QAAM,CAAC,EAAE,UAAQ,SAAO,SAAO,mBAAiBC,EAAW,CAACC,EAASC,GAAahB,EAAS,CAAC,EAAO,CAACiB,EAAcC,GAAkBlB,EAAS,EAAK,EAAO,CAACmB,EAAOC,GAAWpB,EAAS,EAAK,EAAEM,MAAc,CAAC,SAASe,GAAgB,CAAC,GAAUhB,IAAS,QAAa,OAAO,SAAW,IAAY,OAAO,IAAIiB,EAAQ,KAAQC,IAAiB,EAAQ,SAAS,cAAcA,CAAe,GAAG,IAAIC,EAAUC,EAAcC,EAAO,GAAM,GAAGJ,EAAQ,CAAC,IAAMK,EAAKL,EAAQ,sBAAsB,EAAQM,EAAWD,EAAK,IAAItB,EAAO,QAAcwB,EAAcP,EAAQ,aAAmBQ,EAAcF,EAAWC,EAAoBE,EAAU1B,EAAO,YAAkB2B,EAAQ3B,EAAO,QACptB,GAAzC,EAAOsB,EAAK,OAAO,GAAGA,EAAK,IAAII,EAAa,CAACL,EAAO,CAACtB,MAAoBY,EAAY,CAAC,CAAC,EAAEZ,MAA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