{"version":3,"file":"ScrollJumpButton.BiEFfW4X.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/XQSgmTWn06DI7DACaG85/1enIUClpZ9lpkNcKu5DZ/ScrollJumpButton.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{createPortal}from\"react-dom\";import{addPropertyControls,ControlType}from\"framer\";/**\n * ScrollJumpButton\n * Quadratischer Button mit Pfeil-nach-oben, wird per Portal an\n * document.body gerendert (bleibt daher garantiert fixed, auch wenn\n * ein Vorfahre ein CSS-transform hat). Erscheint erst, nachdem der\n * Nutzer weiter als \"threshold\" Pixel gescrollt hat. Klick scrollt\n * sanft zu dem Element mit der angegebenen ID.\n *\n * Ziel-Element in Framer: gewünschte Section auswählen, im Style-Panel\n * eine ID vergeben (Feld \"ID\" bei den Layer-Eigenschaften) — genau\n * diesen Text hier bei \"Ziel-ID\" eintragen (ohne #).\n */export default function ScrollJumpButton(props){const{targetMode=\"top\",targetId=\"\",threshold=400,size=48,radius=8,iconColor=\"#FFFFFF\",backgroundColor=\"rgba(0,0,0,0.7)\",corner=\"bottom-right\",margin=24}=props;const[visible,setVisible]=useState(false);useEffect(()=>{if(typeof window===\"undefined\")return;const onScroll=()=>setVisible(window.scrollY>threshold);onScroll();window.addEventListener(\"scroll\",onScroll,{passive:true});return()=>window.removeEventListener(\"scroll\",onScroll);},[threshold]);const handleClick=()=>{if(typeof document===\"undefined\")return;// Nachlaufendes Trackpad-Momentum feuert noch einige Zeit weitere\n// Wheel-Events, die einen programmierten Scroll sofort wieder\n// überschreiben würden. Kurz abfangen, bis das Momentum abgeklungen ist.\nconst blockWheel=e=>e.preventDefault();window.addEventListener(\"wheel\",blockWheel,{passive:false});window.setTimeout(()=>{window.removeEventListener(\"wheel\",blockWheel);},600);if(targetMode===\"top\"){window.scrollTo({top:0,behavior:\"smooth\"});return;}const el=targetId?document.getElementById(targetId):null;if(el){el.scrollIntoView({behavior:\"smooth\",block:\"start\"});}else{window.scrollTo({top:0,behavior:\"smooth\"});}};if(typeof document===\"undefined\")return null;const vertical=corner.startsWith(\"top\")?\"top\":\"bottom\";const horizontal=corner.endsWith(\"left\")?\"left\":\"right\";return /*#__PURE__*/createPortal(/*#__PURE__*/_jsx(\"div\",{onClick:handleClick,style:{position:\"fixed\",[vertical]:margin,[horizontal]:margin,width:size,height:size,borderRadius:radius,background:backgroundColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",cursor:\"pointer\",zIndex:9998,opacity:visible?1:0,pointerEvents:visible?\"auto\":\"none\",transform:visible?\"translateY(0)\":\"translateY(8px)\",transition:\"opacity 0.25s ease, transform 0.25s ease\"},children:/*#__PURE__*/_jsx(\"svg\",{width:size*.4,height:size*.4,viewBox:\"0 0 24 24\",fill:\"none\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M12 19V5M12 5L5 12M12 5L19 12\",stroke:iconColor,strokeWidth:\"2.2\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})})}),document.body);}addPropertyControls(ScrollJumpButton,{targetMode:{type:ControlType.Enum,title:\"Ziel\",options:[\"top\",\"section\"],optionTitles:[\"Nach oben\",\"Zu Section\"],defaultValue:\"top\"},targetId:{type:ControlType.String,title:\"Ziel-ID\",placeholder:\"z.B. kunst-section\",hidden:props=>props.targetMode!==\"section\"},threshold:{type:ControlType.Number,title:\"Ab Scroll (px)\",defaultValue:400,min:0},corner:{type:ControlType.Enum,title:\"Ecke\",options:[\"top-left\",\"top-right\",\"bottom-left\",\"bottom-right\"],optionTitles:[\"Oben Links\",\"Oben Rechts\",\"Unten Links\",\"Unten Rechts\"],defaultValue:\"bottom-right\"},margin:{type:ControlType.Number,title:\"Abstand zum Rand\",defaultValue:24,min:0,max:120},size:{type:ControlType.Number,title:\"Button-Gr\\xf6\\xdfe\",defaultValue:48,min:24,max:120},radius:{type:ControlType.Number,title:\"Ecken-Radius\",defaultValue:8,min:0,max:60},iconColor:{type:ControlType.Color,title:\"Pfeil-Farbe\",defaultValue:\"#FFFFFF\"},backgroundColor:{type:ControlType.Color,title:\"Hintergrund\",defaultValue:\"rgba(0,0,0,0.7)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollJumpButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollJumpButton.map"],"mappings":"mMAWG,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,aAAW,MAAM,WAAS,GAAG,YAAU,IAAI,OAAK,GAAG,SAAO,EAAE,YAAU,UAAU,kBAAgB,kBAAkB,SAAO,eAAe,SAAO,IAAI,EAAW,CAAC,EAAQ,GAAYA,EAAS,EAAK,EAAE,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,MAAa,EAAW,EAAO,QAAQ,CAAS,EAAuE,OAArE,EAAS,EAAE,EAAO,iBAAiB,SAAS,EAAS,CAAC,QAAQ,EAAI,CAAC,MAAY,EAAO,oBAAoB,SAAS,CAAQ,CAAE,EAAE,CAAC,CAAS,CAAC,EAAE,IAAM,MAAgB,CAAC,GAAG,OAAO,SAAW,IAAY,OAG7iB,IAAM,EAAW,GAAG,EAAE,eAAe,EAA2I,GAAzI,EAAO,iBAAiB,QAAQ,EAAW,CAAC,QAAQ,EAAK,CAAC,EAAE,EAAO,eAAe,CAAC,EAAO,oBAAoB,QAAQ,CAAU,CAAE,EAAE,GAAG,EAAK,IAAa,MAAM,CAAC,EAAO,SAAS,CAAC,IAAI,EAAE,SAAS,QAAQ,CAAC,EAAE,MAAO,CAAC,IAAM,EAAG,EAAS,SAAS,eAAe,CAAQ,EAAE,KAAQ,EAAI,EAAG,eAAe,CAAC,SAAS,SAAS,MAAM,OAAO,CAAC,EAAQ,EAAO,SAAS,CAAC,IAAI,EAAE,SAAS,QAAQ,CAAC,CAAG,EAAE,GAAG,OAAO,SAAW,IAAY,OAAO,KAAK,IAAM,EAAS,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