{"version":3,"file":"ScrollUpButton.BF7THkWi.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/ipwdbfxgATIpuOWdoGxi/r9YIKxGcKxsBpX0RBjuV/ScrollUpButton.js"],"sourcesContent":["// Scroll Up Button\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Scroll Up Button\n * Shows a floating button to scroll to top when user scrolls down.\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ScrollUpButton(props){const{icon,iconType,background,color,borderRadius,shadow,size,showAfter,hoverBackground,hoverColor,style}=props;const[visible,setVisible]=useState(false);useEffect(()=>{function onScroll(){if(typeof window!==\"undefined\"){startTransition(()=>setVisible(window.scrollY>showAfter));}}window.addEventListener(\"scroll\",onScroll);onScroll();return()=>window.removeEventListener(\"scroll\",onScroll);},[showAfter]);function handleClick(){if(typeof window!==\"undefined\"){window.scrollTo({top:0,behavior:\"smooth\"});}}if(!visible)return null;return /*#__PURE__*/_jsx(\"button\",{\"aria-label\":\"Scroll to top\",onClick:handleClick,style:{...style,position:\"relative\",width:size,height:size,borderRadius:100,background,color,border:\"2px solid #000\",boxShadow:shadow?\"0 2px 8px rgba(0,0,0,0.12)\":\"none\",cursor:\"pointer\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",transition:\"opacity 0.2s, width 0.2s, height 0.2s, background 0.2s, color 0.2s\",outline:\"none\",zIndex:10},onMouseEnter:e=>{e.currentTarget.style.width=size*1.4+\"px\";e.currentTarget.style.height=size*1.4+\"px\";e.currentTarget.style.background=hoverBackground// set hover background\n;e.currentTarget.style.color=hoverColor// set hover icon color\n;},onMouseLeave:e=>{e.currentTarget.style.width=size+\"px\";e.currentTarget.style.height=size+\"px\";e.currentTarget.style.background=background// reset background\n;e.currentTarget.style.color=color// reset icon color\n;},children:/*#__PURE__*/_jsx(\"span\",{style:{fontSize:size*.5,lineHeight:1},children:iconType===\"feather\"?/*#__PURE__*/_jsxs(\"svg\",{width:size*.5,height:size*.5,viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",\"aria-hidden\":\"true\",focusable:\"false\",children:[/*#__PURE__*/_jsx(\"path\",{d:\"M4 20c0-2.5 2-4.5 4.5-4.5h7.5c2.5 0 4.5-2 4.5-4.5S18.5 6.5 16 6.5H8.5C6 6.5 4 8.5 4 11v9z\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M8 17l8-8\"})]}):iconType===\"arrow\"?/*#__PURE__*/_jsxs(\"svg\",{width:size*.5,height:size*.5,viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",\"aria-hidden\":\"true\",focusable:\"false\",children:[/*#__PURE__*/_jsx(\"line\",{x1:\"12\",y1:\"19\",x2:\"12\",y2:\"5\"}),/*#__PURE__*/_jsx(\"polyline\",{points:\"5 12 12 5 19 12\"})]}):iconType===\"star\"?/*#__PURE__*/_jsx(\"svg\",{width:size*.5,height:size*.5,viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",\"aria-hidden\":\"true\",focusable:\"false\",children:/*#__PURE__*/_jsx(\"polygon\",{points:\"12 2 15 8.5 22 9.3 17 14.1 18.2 21 12 17.8 5.8 21 7 14.1 2 9.3 9 8.5 12 2\"})}):iconType===\"heart\"?/*#__PURE__*/_jsx(\"svg\",{width:size*.5,height:size*.5,viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",\"aria-hidden\":\"true\",focusable:\"false\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M20.8 4.6c-1.5-1.4-3.9-1.4-5.4 0l-.4.4-.4-.4c-1.5-1.4-3.9-1.4-5.4 0-1.6 1.5-1.6 4 0 5.5l5.8 5.7 5.8-5.7c1.6-1.5 1.6-4 0-5.5z\"})}):/*#__PURE__*/_jsx(\"span\",{children:icon})})});}addPropertyControls(ScrollUpButton,{icon:{type:ControlType.String,title:\"Icon\",defaultValue:\"↑\",placeholder:\"↑\",description:\"Custom icon (used if type is Custom)\"},iconType:{type:ControlType.Enum,title:\"Icon Type\",options:[\"feather\",\"arrow\",\"star\",\"heart\",\"custom\"],optionTitles:[\"Feather\",\"Arrow\",\"Star\",\"Heart\",\"Custom\"],defaultValue:\"feather\"},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},color:{type:ControlType.Color,title:\"Icon Color\",defaultValue:\"#000000\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:24,min:0,max:48},shadow:{type:ControlType.Boolean,title:\"Shadow\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},size:{type:ControlType.Number,title:\"Size\",defaultValue:48,min:32,max:96,unit:\"px\"},showAfter:{type:ControlType.Number,title:\"Show After (px)\",defaultValue:200,min:0,max:1e3,step:10},hoverBackground:{type:ControlType.Color,title:\"Hover Background\",defaultValue:\"#F5F5F5\"},hoverColor:{type:ControlType.Color,title:\"Hover Icon Color\",defaultValue:\"#000000\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollUpButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollUpButton.map"],"mappings":"6MAOG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,OAAK,WAAS,aAAW,QAAM,eAAa,SAAO,OAAK,YAAU,kBAAgB,aAAW,SAAO,EAAW,CAAC,EAAQ,GAAYA,EAAS,GAAM,CAAC,MAAc,CAAC,SA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