{"version":3,"file":"ScrollToTopFloatingButton.BlXokIOE.mjs","names":["useState","useCallback","useMemo"],"sources":["https:/framerusercontent.com/modules/XW4IY0lZVvh7GCcVOhaV/R1WmTaODaqtLn825FOPi/ScrollToTopFloatingButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{startTransition,useCallback,useEffect,useMemo,useState}from\"react\";/**\n * @framerIntrinsicWidth 240\n * @framerIntrinsicHeight 240\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function ScrollToTopFloatingButton(props){const{label,ariaLabel,showAfter,smoothScroll,offsetX,offsetY,size,radius,background,color,border,shadow,font,showChevron,chevronSize,chevronStrokeWidth,style}=props;const isStatic=useIsStaticRenderer();const[visible,setVisible]=useState(isStatic);useEffect(()=>{if(isStatic){startTransition(()=>setVisible(true));return;}if(typeof window===\"undefined\")return;const update=()=>{const y=typeof window.scrollY===\"number\"?window.scrollY:typeof window.pageYOffset===\"number\"?window.pageYOffset:0;const next=y>=Math.max(0,showAfter);startTransition(()=>setVisible(next));};update();window.addEventListener(\"scroll\",update,{passive:true});return()=>window.removeEventListener(\"scroll\",update);},[isStatic,showAfter]);const onClick=useCallback(()=>{if(typeof window===\"undefined\")return;try{window.scrollTo({top:0,behavior:smoothScroll?\"smooth\":\"auto\"});}catch(e){// Fallback for older browsers\nwindow.scrollTo(0,0);}},[smoothScroll]);const isFullWidth=style?.width===\"100%\";const isFullHeight=style?.height===\"100%\";const containerStyle=useMemo(()=>({position:\"relative\",width:\"100%\",height:\"100%\",pointerEvents:\"none\",...style||{},// Avoid collapsing when used with auto sizing\n    ...isFullWidth?null:{minWidth:1},...isFullHeight?null:{minHeight:1}}),[style,isFullWidth,isFullHeight]);const buttonStyle=useMemo(()=>({position:\"absolute\",right:offsetX,bottom:offsetY,width:size,height:size,borderRadius:radius,background,color,border,boxShadow:shadow,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",gap:8,padding:10,cursor:\"pointer\",pointerEvents:\"auto\",userSelect:\"none\",WebkitTapHighlightColor:\"transparent\",opacity:visible?1:0,transform:visible?\"translateY(0px)\":\"translateY(6px)\",transition:\"opacity 220ms ease, transform 220ms ease\",...font}),[offsetX,offsetY,size,radius,background,color,border,shadow,visible,font]);const contentStyle=useMemo(()=>({display:\"flex\",alignItems:\"center\",justifyContent:\"center\",gap:8,whiteSpace:\"nowrap\",lineHeight:1}),[]);const showText=label?.trim().length>0;return /*#__PURE__*/_jsx(\"div\",{style:containerStyle,\"aria-hidden\":false,children:/*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:onClick,style:buttonStyle,\"aria-label\":ariaLabel,tabIndex:0,children:/*#__PURE__*/_jsxs(\"span\",{style:contentStyle,children:[showChevron&&/*#__PURE__*/_jsx(\"svg\",{width:chevronSize,height:chevronSize,viewBox:\"0 0 24 24\",fill:\"none\",\"aria-hidden\":\"true\",focusable:\"false\",style:{display:\"block\",flex:\"0 0 auto\"},children:/*#__PURE__*/_jsx(\"path\",{d:\"M6 14l6-6 6 6\",stroke:\"currentColor\",strokeWidth:chevronStrokeWidth,strokeLinecap:\"round\",strokeLinejoin:\"round\"})}),showText&&/*#__PURE__*/_jsx(\"span\",{style:{minWidth:\"max-content\",display:\"block\"},children:label})]})})});}addPropertyControls(ScrollToTopFloatingButton,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"\",placeholder:\"Top\"},ariaLabel:{type:ControlType.String,title:\"ARIA Label\",defaultValue:\"Scroll to top\"},showAfter:{type:ControlType.Number,title:\"Show After\",defaultValue:300,min:0,max:3e3,step:10,unit:\"px\"},smoothScroll:{type:ControlType.Boolean,title:\"Smooth\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},offsetX:{type:ControlType.Number,title:\"Right\",defaultValue:24,min:0,max:200,step:1,unit:\"px\"},offsetY:{type:ControlType.Number,title:\"Bottom\",defaultValue:24,min:0,max:200,step:1,unit:\"px\"},size:{type:ControlType.Number,title:\"Size\",defaultValue:52,min:32,max:120,step:1,unit:\"px\"},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:999,min:0,max:999,step:1,unit:\"px\"},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"},border:{type:ControlType.String,title:\"Border\",defaultValue:\"1px solid rgba(0,0,0,0.12)\"},shadow:{type:ControlType.BoxShadow,title:\"Shadow\",defaultValue:\"0 10px 30px rgba(0,0,0,0.14)\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"14px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\",textAlign:\"center\"}},showChevron:{type:ControlType.Boolean,title:\"Chevron\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},chevronSize:{type:ControlType.Number,title:\"Chevron Size\",defaultValue:20,min:10,max:48,step:1,unit:\"px\",hidden:({showChevron})=>!showChevron},chevronStrokeWidth:{type:ControlType.Number,title:\"Chevron Weight\",defaultValue:2.5,min:1,max:6,step:.5,hidden:({showChevron})=>!showChevron}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollToTopFloatingButton\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"240\",\"framerSupportedLayoutHeight\":\"any\",\"framerIntrinsicWidth\":\"240\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollToTopFloatingButton.map"],"mappings":"mOAMG,SAAwB,EAA0B,EAAM,CAAC,GAAK,CAAC,QAAM,YAAU,YAAU,eAAa,UAAQ,UAAQ,OAAK,SAAO,aAAW,QAAM,SAAO,SAAO,OAAK,cAAY,cAAY,qBAAmB,SAAO,EAAY,EAAS,GAAqB,CAAM,C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