{"version":3,"file":"SymposiumSwipeToBook.CHWIkifT.mjs","names":["React.useRef","React.useState","React.useId"],"sources":["https:/framerusercontent.com/modules/vz1Ukppj2oyw2mTPiMZD/GCEAxpbTxPW7ziAI0HLV/SymposiumSwipeToBook.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useReducedMotion}from\"framer-motion\";/**\n * @framerIntrinsicWidth 340\n * @framerIntrinsicHeight 56\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight fixed\n */export default function SymposiumSwipeToBook(props){const{label=\"Slide to book a conversation\",link=\"/free-consultation\",accent=\"#8900ff\",style}=props;const isStatic=useIsStaticRenderer();const reducedMotion=useReducedMotion();const trackRef=React.useRef(null);const thumbRef=React.useRef(null);const gesture=React.useRef(null);const[offset,setOffset]=React.useState(0);const[dragging,setDragging]=React.useState(false);const[thumbFocus,setThumbFocus]=React.useState(false);const[linkFocus,setLinkFocus]=React.useState(false);const[status,setStatus]=React.useState(\"\");const instructionId=React.useId();function releaseCapture(id){const thumb=thumbRef.current;if(thumb?.hasPointerCapture(id))thumb.releasePointerCapture(id);}function reset(){const active=gesture.current;gesture.current=null;if(active)releaseCapture(active.id);setDragging(false);setOffset(0);}function book(){if(isStatic||typeof window===\"undefined\")return;setStatus(\"Opening the booking page.\");window.location.assign(link);}function start(event){if(isStatic||!event.isPrimary||event.button!==0)return;const track=trackRef.current;if(!track)return;// Measure only this component's own track. The thumb is 44px, inset 6px.\nconst travel=Math.max(0,track.getBoundingClientRect().width-56);if(travel<1)return;gesture.current={id:event.pointerId,startX:event.clientX,startY:event.clientY,travel,offset:0,horizontal:false};event.currentTarget.setPointerCapture(event.pointerId);setDragging(true);setStatus(\"\");}function move(event){const active=gesture.current;if(!active||active.id!==event.pointerId)return;const dx=event.clientX-active.startX;const dy=event.clientY-active.startY;// A vertical gesture yields to page scrolling instead of becoming a swipe.\nif(!active.horizontal&&Math.abs(dy)>8&&Math.abs(dy)>Math.abs(dx)){reset();return;}if(!active.horizontal&&dx>6&&Math.abs(dx)>Math.abs(dy)){active.horizontal=true;}if(!active.horizontal)return;active.offset=Math.min(active.travel,Math.max(0,dx));setOffset(active.offset);}function finish(event){const active=gesture.current;if(!active||active.id!==event.pointerId)return;// Update from the release coordinate too; a fast swipe may have few moves.\nconst dx=Math.max(0,event.clientX-active.startX);const dy=Math.abs(event.clientY-active.startY);const completed=dx>=active.travel*.85&&dx>dy;gesture.current=null;releaseCapture(event.pointerId);setDragging(false);if(completed){setOffset(active.travel);book();}else{setOffset(0);}}React.useEffect(()=>{// Browsers may restore this component after returning from the form.\nif(isStatic||typeof window===\"undefined\")return;const restore=()=>{gesture.current=null;setDragging(false);setOffset(0);setStatus(\"\");};window.addEventListener(\"pageshow\",restore);return()=>{window.removeEventListener(\"pageshow\",restore);gesture.current=null;};},[isStatic]);const hidden={position:\"absolute\",width:1,height:1,padding:0,margin:-1,overflow:\"hidden\",clipPath:\"inset(50%)\",whiteSpace:\"nowrap\",border:0};return /*#__PURE__*/_jsxs(\"div\",{ref:trackRef,style:{width:\"100%\",height:56,...style,position:\"relative\",minHeight:56,boxSizing:\"border-box\",borderRadius:999,background:accent,color:\"#ffffff\",fontFamily:'\"Inter\", sans-serif',touchAction:\"pan-y\",isolation:\"isolate\"},children:[/*#__PURE__*/_jsx(\"span\",{id:instructionId,style:hidden,children:\"Swipe the arrow to the right, press Enter, Space or Right Arrow, or use the booking link beside it. Vertical scrolling stays available.\"}),/*#__PURE__*/_jsx(\"a\",{href:link,tabIndex:isStatic?-1:0,\"aria-label\":\"Book a conversation, without swiping\",onClick:event=>{if(isStatic)event.preventDefault();},onFocus:()=>setLinkFocus(true),onBlur:()=>setLinkFocus(false),style:{position:\"absolute\",inset:\"6px 16px 6px 64px\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",color:\"#ffffff\",fontSize:13,fontWeight:500,lineHeight:1.2,letterSpacing:\"-0.02em\",textAlign:\"center\",textDecoration:\"underline\",textDecorationColor:\"rgba(255,255,255,0.5)\",textUnderlineOffset:3,borderRadius:6,outline:linkFocus?\"2px solid #ffffff\":\"none\",outlineOffset:2,opacity:Math.max(.15,1-offset/100),transition:reducedMotion||dragging?\"none\":\"opacity 200ms ease\",WebkitTapHighlightColor:\"transparent\"},children:label}),/*#__PURE__*/_jsx(\"button\",{ref:thumbRef,type:\"button\",tabIndex:isStatic?-1:0,\"aria-label\":\"Book a conversation\",\"aria-describedby\":instructionId,onPointerDown:start,onPointerMove:move,onPointerUp:finish,onPointerCancel:reset,onLostPointerCapture:()=>{if(gesture.current)reset();},onDragStart:event=>event.preventDefault(),onClick:event=>{// A normal pointer tap never completes a swipe. Native keyboard\n// and assistive-technology activation have detail === 0.\nif(event.detail===0)book();},onKeyDown:event=>{if(event.key===\"Enter\"||event.key===\" \"||event.key===\"ArrowRight\"){event.preventDefault();reset();book();}else if(event.key===\"Escape\"){reset();}},onFocus:()=>setThumbFocus(true),onBlur:()=>{setThumbFocus(false);if(gesture.current)reset();},style:{position:\"absolute\",left:6,top:\"calc(50% - 22px)\",width:44,height:44,padding:0,border:0,borderRadius:\"50%\",background:\"#ffffff\",color:accent,display:\"grid\",placeItems:\"center\",cursor:dragging?\"grabbing\":\"grab\",touchAction:\"pan-y\",userSelect:\"none\",WebkitUserSelect:\"none\",WebkitTapHighlightColor:\"transparent\",transform:`translate3d(${offset}px, 0, 0)`,transition:reducedMotion||dragging||isStatic?\"none\":\"transform 320ms cubic-bezier(0.2, 0.75, 0.25, 1)\",outline:thumbFocus?\"2px solid #ffffff\":\"none\",outlineOffset:2,zIndex:2,boxShadow:\"0 2px 6px rgba(23, 9, 39, 0.12)\"},children:/*#__PURE__*/_jsx(\"svg\",{width:\"22\",height:\"22\",viewBox:\"0 0 24 24\",fill:\"none\",\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M5 12h14m-6-6 6 6-6 6\",stroke:\"currentColor\",strokeWidth:\"1.8\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})})}),/*#__PURE__*/_jsx(\"span\",{role:\"status\",\"aria-live\":\"polite\",style:hidden,children:status})]});}addPropertyControls(SymposiumSwipeToBook,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Slide to book a conversation\"},link:{type:ControlType.Link,title:\"Booking link\",defaultValue:\"/free-consultation\"},accent:{type:ControlType.Color,title:\"Purple\",defaultValue:\"#8900ff\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SymposiumSwipeToBook\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"340\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicHeight\":\"56\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SymposiumSwipeToBook.map"],"mappings":"yQAKG,SAAwB,EAAqB,EAAM,CAAC,GAAK,CAAC,QAAM,+BAA+B,OAAK,qBAAqB,SAAO,UAAU,SAAO,EAAY,EAAS,EAAoB,EAAQ,EAAc,EAAiB,EAAQ,EAASA,EAAa,IAAI,EAAQ,EAASA,EAAa,IAAI,EAAQ,EAAQA,EAAa,IAAI,EAAO,CAAC,EAAO,GAAWC,EAAe,CAAC,EAAO,CAAC,EAAS,GAAaA,EAAe,EAAK,EAAO,CAAC,EAAW,GAAeA,EAAe,EAAK,EAAO,CAAC,EAAU,GAAcA,EAAe,EAAK,EAAO,CAAC,EAAO,GAAWA,EAAe,EAAE,EAAQ,EAAcC,EAAY,EAAE,SAAS,EAAe,EAAG,CAAC,IAAM,EAAM,EAAS,QAAW,GAAO,kBAAkB,CAAE,GAAE,EAAM,sBAAsB,CAAE,CAAE,CAAC,SAAS,GAAO,CAAC,IAAM,EAAO,EAAQ,QAAQ,EAAQ,QAAQ,KAAQ,GAAO,EAAe,EAAO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