{"version":3,"file":"ChevronRoll.DFXWc2eD.mjs","names":["useRef","useCallback","__esmMin","init_ssg_sandbox_shims","ne","window","de","c","J","init_npm_react_18_3_1","ce","RenderTarget","init_framer_BWFVvmND","withChevronRoll","node","setRef","el","forwardedRef","box","icon","sign","at","k","twin","pair","front","on","reduce","roll","cur","next","stop","n","x","settle","ROLLER","leaving","enter","leave","focusIn","visible","focusOut","Component","props","init_ChevronRoll","init_jsx_runtime"],"sources":["https:/framerusercontent.com/modules/qQyoWaTHlnvcMpH92agz/rBgkYqWtQ3yOtaIK69It/ChevronRoll.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useCallback,useEffect,useRef}from\"react\";import{RenderTarget}from\"framer\";/**\n * Coatly · rolling chevrons for canvas links\n *\n * withChevronRoll goes on a link frame that holds a frame named \"Chevrons\" (or \"Chevrons Left\" for a back link)\n * with one double-chevron icon inside. On hover or keyboard focus the chevrons roll forward: the pair slides out\n * ahead while an identical pair slides in behind. When the pointer leaves they roll on again, so they never travel\n * backwards, the same motion as the CoatButton chevrons. The icon stays editable on the canvas; the twin is added at\n * runtime. The canvas, touch input and reduced motion leave the icon still.\n */const ROLLER=\"cubic-bezier(0.65, 0, 0.35, 1)\";export function withChevronRoll(Component){return /*#__PURE__*/forwardRef(function ChevronRoll(props,forwardedRef){const node=useRef(null);const setRef=useCallback(el=>{node.current=el;if(typeof forwardedRef===\"function\")forwardedRef(el);else if(forwardedRef)forwardedRef.current=el;},[forwardedRef]);useEffect(()=>{const el=node.current;if(!el||typeof window===\"undefined\")return;if(RenderTarget.current()===RenderTarget.canvas)return;const box=el.querySelector('[data-framer-name^=\"Chevrons\"]');const icon=(box?.firstElementChild)||null;if(!box||!icon)return;const sign=/left/i.test(box.getAttribute(\"data-framer-name\")||\"\")?-1:1;const at=k=>\"translateX(\"+k*sign*140+\"%)\";box.style.overflow=\"hidden\";if(getComputedStyle(box).position===\"static\")box.style.position=\"relative\";const twin=icon.cloneNode(true);twin.setAttribute(\"aria-hidden\",\"true\");Object.assign(twin.style,{position:\"absolute\",left:icon.offsetLeft+\"px\",top:icon.offsetTop+\"px\",width:icon.offsetWidth+\"px\",height:icon.offsetHeight+\"px\",margin:\"0px\",transform:at(-1)});box.appendChild(twin);const pair=[icon,twin];let front=0;let on=false;const reduce=window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches;const roll=delay=>{const cur=pair[front];const next=pair[1-front];front=1-front;const stop=()=>[cur,next].forEach(n=>n.getAnimations?.().forEach(x=>x.cancel()));const settle=()=>{cur.style.transform=at(-1);next.style.transform=at(0);};stop();if(reduce||!cur.animate)return settle();const o={duration:480,delay,easing:ROLLER,fill:\"both\"};const leaving=cur.animate([{transform:at(0)},{transform:at(1)}],o);next.animate([{transform:at(-1)},{transform:at(0)}],o);leaving.onfinish=()=>{settle();stop();};};const enter=e=>{if(e.pointerType===\"touch\"||on)return;on=true;roll(60);};const leave=e=>{if(e.pointerType===\"touch\"||!on)return;on=false;roll(0);};const focusIn=()=>{let visible=true;try{visible=el.matches(\":focus-visible\")||!!el.querySelector(\":focus-visible\");}catch(err){}if(visible&&!on){on=true;roll(0);}};const focusOut=()=>{if(!on)return;on=false;roll(0);};el.addEventListener(\"pointerenter\",enter);el.addEventListener(\"pointerleave\",leave);el.addEventListener(\"focusin\",focusIn);el.addEventListener(\"focusout\",focusOut);return()=>{el.removeEventListener(\"pointerenter\",enter);el.removeEventListener(\"pointerleave\",leave);el.removeEventListener(\"focusin\",focusIn);el.removeEventListener(\"focusout\",focusOut);pair.forEach(n=>n.getAnimations?.().forEach(x=>x.cancel()));twin.remove();icon.style.transform=\"\";};},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:setRef});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withChevronRoll\":{\"type\":\"reactHoc\",\"name\":\"withChevronRoll\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ChevronRoll.map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