{"version":3,"file":"BackToTopButton.kHiSuRjo.mjs","names":["React.useState","React.useCallback","React.useMemo","__esmMin","pe","init_npm_react_18_3_1","ne","init_ssg_sandbox_shims","window","te","_e","init_jsx_runtime","ce","init_framer_D6uXRwWs","addPropertyControls","ControlType","BackToTopButton","props","isVisible","setIsVisible","viewportWidth","setViewportWidth","updateViewportWidth","nextWidth","updateVisibility","shouldShow","threshold","handleBackToTop","isPhone","isTablet","resolvedBottomOffset","bottomOffset","bottomValue","rightOffset","size","arrowColor","init_BackToTopButton"],"sources":["https:/framerusercontent.com/modules/klcEJF2n947qEbn27BUs/TLZI8vpcaVVRdO9IB5Bo/BackToTopButton.js"],"sourcesContent":["// User request: Create a self-contained fixed-position back-to-top button component for a professional hygiene services website, hidden until a meaningful scroll threshold, smooth-scroll to top on click, safe-area-aware lower-right placement with device-specific spacing, accessible aria label, and limited useful controls only.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function BackToTopButton(props){const{size=42,bottomOffset=24,rightOffset=24,threshold=420,backgroundColor=\"#000000\",arrowColor=\"#FFFFFF\"}=props;const[isVisible,setIsVisible]=React.useState(false);const[viewportWidth,setViewportWidth]=React.useState(1200);const updateViewportWidth=React.useCallback(()=>{if(typeof window!==\"undefined\"){const nextWidth=window.innerWidth;React.startTransition(()=>setViewportWidth(nextWidth));}else{React.startTransition(()=>setViewportWidth(1200));}},[]);const updateVisibility=React.useCallback(()=>{if(typeof window!==\"undefined\"){const shouldShow=window.scrollY>threshold;React.startTransition(()=>setIsVisible(shouldShow));}else{React.startTransition(()=>setIsVisible(false));}},[threshold]);React.useEffect(()=>{if(typeof window!==\"undefined\"){updateViewportWidth();updateVisibility();window.addEventListener(\"resize\",updateViewportWidth);window.addEventListener(\"scroll\",updateVisibility,{passive:true});return()=>{window.removeEventListener(\"resize\",updateViewportWidth);window.removeEventListener(\"scroll\",updateVisibility);};}else{updateViewportWidth();updateVisibility();}},[updateViewportWidth,updateVisibility]);const handleBackToTop=React.useCallback(()=>{if(typeof window!==\"undefined\"){window.scrollTo({top:0,behavior:\"smooth\"});}},[]);const isPhone=viewportWidth<=480;const isTablet=viewportWidth>480&&viewportWidth<=1024;const resolvedBottomOffset=React.useMemo(()=>{if(isPhone||isTablet)return bottomOffset+24;return bottomOffset;},[bottomOffset,isPhone,isTablet]);const bottomValue=React.useMemo(()=>{if(isPhone){return`calc(${resolvedBottomOffset}px + env(safe-area-inset-bottom, 0px))`;}return`${resolvedBottomOffset}px`;},[isPhone,resolvedBottomOffset]);if(!isVisible){return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:0,height:0}});}return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:0,height:0},children:/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":\"Back to top\",onClick:handleBackToTop,style:{position:\"fixed\",right:`${rightOffset}px`,bottom:bottomValue,width:`${size}px`,height:`${size}px`,borderRadius:`${Math.round(size*.5)}px`,border:\"none\",backgroundColor,color:arrowColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",cursor:\"pointer\",padding:0,margin:0,zIndex:1e3},children:/*#__PURE__*/_jsx(\"svg\",{width:Math.max(14,Math.round(size*.38)),height:Math.max(14,Math.round(size*.38)),viewBox:\"0 0 24 24\",\"aria-hidden\":\"true\",focusable:\"false\",style:{display:\"block\"},children:/*#__PURE__*/_jsx(\"path\",{d:\"M12 6L5 13H9.5V18H14.5V13H19L12 6Z\",fill:arrowColor})})})});}addPropertyControls(BackToTopButton,{size:{type:ControlType.Number,title:\"Size\",defaultValue:42,min:32,max:72,step:1,unit:\"px\"},bottomOffset:{type:ControlType.Number,title:\"Bottom\",defaultValue:24,min:0,max:120,step:1,unit:\"px\"},rightOffset:{type:ControlType.Number,title:\"Right\",defaultValue:24,min:0,max:120,step:1,unit:\"px\"},threshold:{type:ControlType.Number,title:\"Threshold\",defaultValue:420,min:0,max:2e3,step:10,unit:\"px\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#000000\"},arrowColor:{type:ControlType.Color,title:\"Arrow\",defaultValue:\"#FFFFFF\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BackToTopButton\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./BackToTopButton.map"],"mappings":"A,oNAIG,SAAwBgB,EAAgB,EAAM,CAAC,GAAK,CAAC,OAAK,GAAG,eAAa,GAAG,cAAY,GAAG,YAAU,IAAI,kBAAgB,UAAU,aAAW,WAAWC,EAAW,CAACC,EAAUC,GAAcnB,EAAe,EAAK,EAAO,CAACoB,EAAcC,GAAkBrB,EAAe,IAAI,EAAQsB,EAAoBrB,MAAsB,CAAC,GAAUO,IAAS,OAAY,CAAC,IAAMe,EAAUf,EAAO,WAAWC,MAA0BY,EAAiBE,CAAS,CAAC,CAAE,MAAMd,MAA0BY,EAAiB,IAAI,CAAC,CAAG,EAAE,CAAC,CAAC,EAAQG,EAAiBvB,MAAsB,CAAC,GAAUO,IAAS,OAAY,CAAC,IAAMiB,EAAWjB,EAAO,QAAQkB,EAAUjB,MAA0BU,EAAaM,CAAU,CAAC,CAAE,MAAMhB,MAA0BU,EAAa,EAAK,CAAC,CAAG,EAAE,CAACO,CAAS,CAAC,EAAEd,MAAoB,CAAC,GAAUJ,IAAS,OAA8K,OAAjKc,EAAoB,EAAEE,EAAiB,EAAEhB,EAAO,iBAAiB,SAASc,CAAmB,EAAEd,EAAO,iBAAiB,SAASgB,EAAiB,CAAC,QAAQ,EAAI,CAAC,MAAY,CAAChB,EAAO,oBAAoB,SAASc,CAAmB,EAAEd,EAAO,oBAAoB,SAASgB,CAAgB,CAAE,EAAQF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