{"version":3,"file":"Examples.Dy4BY_HI.mjs","names":["useRef","useCallback"],"sources":["https:/framerusercontent.com/modules/jBE37OAEXLsOw3O52Vz4/qqrlxItvmb6EWnn0fvM6/Examples.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,startTransition,useCallback,useEffect,useRef,useState}from\"react\";// Learn more: https://www.framer.com/developers/overrides/\nexport function withRotate(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsx(Component,{ref:ref,...props,animate:{rotate:90},transition:{duration:2}});});}export function withHover(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsx(Component,{ref:ref,...props,whileHover:{scale:1.05}});});}export function withRandomColor(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[background,setBackground]=useState(\"#0099FF\");return /*#__PURE__*/_jsx(Component,{ref:ref,...props,animate:{background},onClick:()=>{startTransition(()=>{setBackground(`#${Math.floor(Math.random()*16777215).toString(16).padStart(6,\"0\")}`);});}});});}export function withCurrencyNoDecimals(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const hostRef=useRef(null);const isDispatchingRef=useRef(false);const formatCurrency=useCallback(value=>{const digitsOnly=value.replace(/\\D/g,\"\");if(!digitsOnly)return\"\";return`\\xa3${Number(digitsOnly).toLocaleString(\"en-GB\",{maximumFractionDigits:0,useGrouping:true})}`;},[]);const resolveField=useCallback(node=>{if(typeof window===\"undefined\"||!node)return null;if(node instanceof window.HTMLInputElement||node instanceof window.HTMLTextAreaElement){return node;}return node.querySelector(\"input, textarea\");},[]);useEffect(()=>{if(typeof window===\"undefined\")return;const field=resolveField(hostRef.current);if(!field)return;const prototype=field instanceof window.HTMLTextAreaElement?window.HTMLTextAreaElement.prototype:window.HTMLInputElement.prototype;const nativeValueSetter=Object.getOwnPropertyDescriptor(prototype,\"value\")?.set;const emitFormattedEvents=target=>{if(isDispatchingRef.current)return;isDispatchingRef.current=true;target.dispatchEvent(new Event(\"input\",{bubbles:true}));target.dispatchEvent(new Event(\"change\",{bubbles:true}));isDispatchingRef.current=false;};const applyFormatting=target=>{if(!nativeValueSetter)return;const formatted=formatCurrency(target.value);if(formatted===target.value)return;nativeValueSetter.call(target,formatted);emitFormattedEvents(target);};const handleInput=event=>{if(isDispatchingRef.current)return;applyFormatting(event.currentTarget);};const handleBlur=event=>{applyFormatting(event.currentTarget);};applyFormatting(field);field.addEventListener(\"input\",handleInput);field.addEventListener(\"blur\",handleBlur);return()=>{field.removeEventListener(\"input\",handleInput);field.removeEventListener(\"blur\",handleBlur);};},[formatCurrency,resolveField]);return /*#__PURE__*/_jsx(Component,{...props,ref:node=>{if(node&&typeof window!==\"undefined\"&&node instanceof window.HTMLElement){hostRef.current=node;}else{hostRef.current=null;}if(typeof ref===\"function\"){ref(node);}else if(ref){ref.current=node;}}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withCurrencyNoDecimals\":{\"type\":\"reactHoc\",\"name\":\"withCurrencyNoDecimals\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHover\":{\"type\":\"reactHoc\",\"name\":\"withHover\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRotate\":{\"type\":\"reactHoc\",\"name\":\"withRotate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRandomColor\":{\"type\":\"reactHoc\",\"name\":\"withRandomColor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Examples.map"],"mappings":"qJACurB,SAAgB,EAAuB,EAAU,CAAC,OAAoB,GAAY,EAAM,IAAM,CAAC,IAAM,EAAQA,EAAO,KAAK,CAAO,EAAiBA,EAAO,GAAM,CAAO,EAAeC,EAAY,GAAO,CAAC,IAAM,EAAW,EAAM,QAAQ,MAAM,GAAG,CAAyB,OAApB,EAA0B,OAAO,OAAO,EAAW,CAAC,eAAe,QAAQ,CAAC,sBAAsB,EAAE,YAAY,GAAK,CAAC,GAArG,IAA0G,EAAE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