{"version":3,"file":"BackToTopButton.D48mFMIl.mjs","names":["useState","useCallback"],"sources":["https:/framerusercontent.com/modules/OSqsHFTGtENU7BKXjws7/bOfabmenocKlVs5Mcueo/BackToTopButton.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,useCallback,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function BackToTopButton(props){const{label,backgroundColor,textColor,hoverBackgroundColor,hoverTextColor,borderRadius,paddingX,paddingY,showAfterScroll,showAlways,font,style,borderWidth,borderColor,hoverBorderColor,textDecoration,underlineColor,underlineThickness,hoverUnderlineColor,underlineOffset,hapticsEnabled,hapticsIntensity,hapticsFrequency}=props;const[isVisible,setIsVisible]=useState(showAlways);const handleScroll=useCallback(()=>{if(showAlways||typeof window===\"undefined\"){startTransition(()=>setIsVisible(true));return;}const y=window.scrollY||window.pageYOffset||0;startTransition(()=>setIsVisible(y>=showAfterScroll));},[showAfterScroll,showAlways]);useEffect(()=>{if(typeof window===\"undefined\")return;handleScroll();window.addEventListener(\"scroll\",handleScroll,{passive:true});return()=>window.removeEventListener(\"scroll\",handleScroll);},[handleScroll]);const triggerHaptics=useCallback(()=>{if(!hapticsEnabled)return;if(typeof navigator===\"undefined\"||typeof window===\"undefined\"){return;}// @ts-ignore\nconst canVibrate=typeof navigator.vibrate===\"function\";if(!canVibrate)return;let duration;switch(hapticsIntensity){case\"high\":duration=60;break;case\"medium\":duration=40;break;case\"low\":default:duration=25;break;}let pulses=1;switch(hapticsFrequency){case\"double\":pulses=2;break;case\"triple\":pulses=3;break;case\"single\":default:pulses=1;break;}const pattern=pulses===1?duration:Array.from({length:pulses*2-1},(_,index)=>index%2===0?duration:50);try{// @ts-ignore\nnavigator.vibrate(pattern);}catch{// Ignore errors\n}},[hapticsEnabled,hapticsIntensity,hapticsFrequency]);const handleClick=useCallback(()=>{if(typeof window===\"undefined\")return;triggerHaptics();try{window.scrollTo({top:0,behavior:\"smooth\"});}catch{window.scrollTo(0,0);}},[triggerHaptics]);useEffect(()=>{if(typeof document===\"undefined\")return;const styleId=\"back-to-top-button-styles\";if(document.getElementById(styleId))return;const styleEl=document.createElement(\"style\");styleEl.id=styleId;styleEl.innerHTML=`\n            .back-to-top-button {\n                display: inline-flex;\n                align-items: center;\n                justify-content: center;\n                cursor: pointer;\n\n                border-radius: var(--border-radius, 0px);\n\n                padding:\n                    var(--padding-y, 10px)\n                    var(--padding-x, 16px);\n\n                background-color:\n                    var(--bg-color, #000000);\n\n                color:\n                    var(--text-color, #ffffff);\n\n                border-width:\n                    var(--border-width, 1px);\n\n                border-style: solid;\n\n                border-color:\n                    var(--border-color, #000000);\n\n                outline: none;\n\n                transition:\n                    background-color 0.18s ease,\n                    color 0.18s ease,\n                    border-color 0.18s ease,\n                    transform 0.1s ease;\n\n                transform: translateY(0px);\n\n                -webkit-tap-highlight-color: transparent;\n\n                touch-action: manipulation;\n            }\n\n            .back-to-top-button:hover {\n                background-color:\n                    var(--hover-bg-color, #222222);\n\n                color:\n                    var(--hover-text-color, #ffffff);\n\n                border-color:\n                    var(--hover-border-color, #222222);\n\n                transform: translateY(-1px);\n            }\n\n            .back-to-top-button:active {\n                transform: scale(0.96);\n            }\n\n            .back-to-top-button span {\n                white-space: nowrap;\n\n                text-decoration-color:\n                    var(--underline-color, currentColor);\n\n                text-decoration-thickness:\n                    var(--underline-thickness, 1px);\n\n                text-underline-offset:\n                    var(--underline-offset, 2px);\n\n                transition:\n                    text-decoration-color 0.18s ease;\n            }\n\n            .back-to-top-button:hover span {\n                text-decoration-color:\n                    var(--hover-underline-color, currentColor);\n            }\n        `;document.head.appendChild(styleEl);return()=>{if(styleEl.parentNode){styleEl.parentNode.removeChild(styleEl);}};},[]);if(!isVisible){return /*#__PURE__*/_jsx(\"div\",{style:{...style||{},opacity:0,pointerEvents:\"none\"}});}const cssVars={\"--bg-color\":backgroundColor,\"--hover-bg-color\":hoverBackgroundColor,\"--text-color\":textColor,\"--hover-text-color\":hoverTextColor,\"--border-width\":`${borderWidth}px`,\"--border-color\":borderColor,\"--hover-border-color\":hoverBorderColor,\"--border-radius\":`${borderRadius}px`,\"--padding-x\":`${paddingX}px`,\"--padding-y\":`${paddingY}px`,\"--underline-color\":underlineColor,\"--hover-underline-color\":hoverUnderlineColor,\"--underline-thickness\":`${underlineThickness}px`,\"--underline-offset\":`${underlineOffset}px`};const buttonStyle={...style||{},...font,...cssVars};return /*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":label||\"Back to top\",onClick:handleClick,className:\"back-to-top-button\",style:buttonStyle,children:/*#__PURE__*/_jsx(\"span\",{style:{textDecoration:textDecoration?\"underline\":\"none\"},children:label})});}addPropertyControls(BackToTopButton,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Back to top\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#000000\"},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#FFFFFF\"},hoverBackgroundColor:{type:ControlType.Color,title:\"Hover BG\",defaultValue:\"#222222\"},hoverTextColor:{type:ControlType.Color,title:\"Hover Text\",defaultValue:\"#FFFFFF\"},borderWidth:{type:ControlType.Number,title:\"Border W\",defaultValue:1,min:0,max:8,step:1},borderColor:{type:ControlType.Color,title:\"Border\",defaultValue:\"#000000\"},hoverBorderColor:{type:ControlType.Color,title:\"Hover Border\",defaultValue:\"#222222\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:999,min:0,max:64},paddingX:{type:ControlType.Number,title:\"Padding X\",defaultValue:16,min:4,max:48},paddingY:{type:ControlType.Number,title:\"Padding Y\",defaultValue:10,min:4,max:32},showAlways:{type:ControlType.Boolean,title:\"Visibility\",enabledTitle:\"Always\",disabledTitle:\"On Scroll\",defaultValue:false},showAfterScroll:{type:ControlType.Number,title:\"Show After\",defaultValue:200,min:0,max:2e3,step:50,hidden:props=>props.showAlways===true},textDecoration:{type:ControlType.Boolean,title:\"Underline\",defaultValue:false},underlineColor:{type:ControlType.Color,title:\"Underline\",defaultValue:\"#FFFFFF\",hidden:props=>!props.textDecoration},underlineThickness:{type:ControlType.Number,title:\"Thickness\",defaultValue:1,min:1,max:4,hidden:props=>!props.textDecoration},hoverUnderlineColor:{type:ControlType.Color,title:\"Hover Underline\",defaultValue:\"#FFFFFF\",hidden:props=>!props.textDecoration},underlineOffset:{type:ControlType.Number,title:\"Offset\",defaultValue:2,min:0,max:10,hidden:props=>!props.textDecoration},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultValue:{fontSize:\"14px\",lineHeight:\"1em\",letterSpacing:\"-0.01em\"}},hapticsEnabled:{type:ControlType.Boolean,title:\"Haptics\",enabledTitle:\"On\",disabledTitle:\"Off\",defaultValue:false},hapticsIntensity:{type:ControlType.Enum,title:\"Intensity\",options:[\"low\",\"medium\",\"high\"],optionTitles:[\"Low\",\"Medium\",\"High\"],defaultValue:\"medium\",displaySegmentedControl:true,hidden:props=>!props.hapticsEnabled},hapticsFrequency:{type:ControlType.Enum,title:\"Frequency\",options:[\"single\",\"double\",\"triple\"],optionTitles:[\"Single\",\"Double\",\"Triple\"],defaultValue:\"single\",displaySegmentedControl:true,hidden:props=>!props.hapticsEnabled}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BackToTopButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./BackToTopButton.map"],"mappings":"oNAAiK,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,QAAM,kBAAgB,YAAU,uBAAqB,iBAAe,eAAa,WAAS,WAAS,kBAAgB,aAAW,OAAK,QAAM,cAAY,cAAY,mBAAiB,iBAAe,iBAAe,qBAAmB,sBAAoB,kBAAgB,iBAAe,mBAAiB,oBAAkB,EAAW,CAAC,EAAU,GAAcA,EAAS,EAAW,CAAO,EAAaC,MAAgB,CAAC,GAAG,GAAmB,IAAS,OAAY,CAAC,MAAoB,EAAa,GAA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