{"version":3,"file":"CursorBadge.C-0Vvau_.mjs","names":["React.useRef","__esmMin","init_ssg_sandbox_shims","window","de","p","c","init_jsx_runtime","init_npm_react_18_3_1","ce","RenderTarget","addPropertyControls","ControlType","init_framer_BWFVvmND","CursorBadge","props","ref","badge","isCanvas","reduce","host","hostName","b","photo","photoName","x","y","tx","ty","raf","inside","place","tick","local","r","enter","e","zoom","move","leave","half","size","style","color","arrowColor","init_CursorBadge"],"sources":["https:/framerusercontent.com/modules/09oNIH0nmDRwqHyXJLsS/nETVwI8jnmezojiOcR7S/CursorBadge.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Hover badge for cards: a round badge with an arrow follows the cursor while it is over the card,\n * and the card photo zooms in a little. Drop it inside a card as an absolute layer that fills the card.\n * The card itself stays a normal Framer layer (link, photo, text are all editable).\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function CursorBadge(props){const{hostName,photoName,size,color,arrowColor,zoom,style}=props;const ref=React.useRef(null);const badge=React.useRef(null);const isCanvas=RenderTarget.current()===RenderTarget.canvas;React.useEffect(()=>{if(isCanvas||!ref.current||!badge.current)return;if(window.matchMedia(\"(hover: none), (pointer: coarse)\").matches)return;const reduce=window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;let host=ref.current.parentElement;while(host&&host.getAttribute(\"data-framer-name\")!==hostName)host=host.parentElement;if(!host)return;const b=badge.current;const photo=host.querySelector(`[data-framer-name=\"${photoName}\"]`);if(photo)photo.style.transition=\"scale 0.7s cubic-bezier(0.22, 1, 0.36, 1)\";let x=0,y=0,tx=0,ty=0,raf=0,inside=false;const place=()=>{b.style.translate=`${x}px ${y}px`;};const tick=()=>{raf=0;x+=(tx-x)*.22;y+=(ty-y)*.22;place();if(Math.abs(tx-x)>.3||Math.abs(ty-y)>.3)raf=requestAnimationFrame(tick);};const local=e=>{const r=ref.current.getBoundingClientRect();tx=e.clientX-r.left;ty=e.clientY-r.top;};const enter=e=>{inside=true;local(e);x=tx;y=ty;place();b.style.scale=\"1\";b.style.opacity=\"1\";if(photo&&!reduce)photo.style.scale=String(zoom);};const move=e=>{if(!inside)return enter(e);local(e);if(reduce){x=tx;y=ty;place();return;}if(!raf)raf=requestAnimationFrame(tick);};const leave=()=>{inside=false;b.style.scale=\"0\";b.style.opacity=\"0\";if(photo)photo.style.scale=\"1\";};host.addEventListener(\"pointerenter\",enter);host.addEventListener(\"pointermove\",move);host.addEventListener(\"pointerleave\",leave);return()=>{host.removeEventListener(\"pointerenter\",enter);host.removeEventListener(\"pointermove\",move);host.removeEventListener(\"pointerleave\",leave);if(raf)cancelAnimationFrame(raf);};},[isCanvas,hostName,photoName,zoom]);const half=size/2;return /*#__PURE__*/_jsx(\"div\",{ref:ref,\"aria-hidden\":\"true\",style:{...style,position:\"relative\",width:\"100%\",height:\"100%\",pointerEvents:\"none\"},children:/*#__PURE__*/_jsx(\"div\",{ref:badge,style:{position:\"absolute\",left:-half,top:-half,width:size,height:size,borderRadius:\"50%\",background:color,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",scale:isCanvas?\"1\":\"0\",opacity:isCanvas?1:0,translate:isCanvas?`${half+24}px ${half+24}px`:\"0px 0px\",transition:\"scale 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease-out\",willChange:\"translate, scale\"},children:/*#__PURE__*/_jsxs(\"svg\",{width:size*.3,height:size*.3,viewBox:\"0 0 24 24\",fill:\"none\",stroke:arrowColor,strokeWidth:2,strokeLinecap:\"round\",strokeLinejoin:\"round\",children:[/*#__PURE__*/_jsx(\"path\",{d:\"M7 17 17 7\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M8 7h9v9\"})]})})});}CursorBadge.defaultProps={hostName:\"Case Card\",photoName:\"Card Photo\",size:76,color:\"#F7B733\",arrowColor:\"#071221\",zoom:1.05};addPropertyControls(CursorBadge,{hostName:{type:ControlType.String,title:\"Card layer\",defaultValue:\"Case Card\"},photoName:{type:ControlType.String,title:\"Photo layer\",defaultValue:\"Card Photo\"},size:{type:ControlType.Number,title:\"Size\",min:32,max:160,step:2,defaultValue:76},color:{type:ControlType.Color,title:\"Badge\",defaultValue:\"#F7B733\"},arrowColor:{type:ControlType.Color,title:\"Arrow\",defaultValue:\"#071221\"},zoom:{type:ControlType.Number,title:\"Photo zoom\",min:1,max:1.3,step:.01,defaultValue:1.05}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CursorBadge\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CursorBadge.map"],"mappings":"A,8MAOG,SAAwBc,EAAY,EAAM,CAAC,GAAK,CAAC,WAAS,YAAU,OAAK,QAAM,aAAW,OAAK,SAAOC,EAAYC,EAAIhB,EAAa,IAAI,EAAQiB,EAAMjB,EAAa,IAAI,EAAQkB,EAASR,EAAa,QAAQ,IAAIA,EAAa,OAAOD,MAAoB,CAAkD,GAA9CS,GAAU,CAACF,EAAI,SAAS,CAACC,EAAM,SAAkBd,EAAO,WAAW,kCAAkC,CAAC,CAAC,QAAQ,OAAO,IAAMgB,EAAOhB,EAAO,WAAW,kCAAkC,CAAC,CAAC,QAAYiB,EAAKJ,EAAI,QAAQ,cAAc,KAAMI,GAAMA,EAAK,aAAa,kBAAkB,IAAIC,GAAS,EAAKD,EAAK,cAAc,GAAG,CAACA,EAAK,OAAO,IAAME,EAAEL,EAAM,QAAcM,EAAMH,EAAK,cAAc,sBAAsBI,EAAU,GAAG,EAAKD,IAAM,EAAM,MAAM,WAAW,6CAA4C,IAAIE,EAAE,EAAEC,EAAE,EAAEC,EAAG,EAAEC,EAAG,EAAEC,EAAI,EAAEC,EAAO,GAAYC,MAAU,CAAC,EAAE,MAAM,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