{"version":3,"file":"Examples.22mItqNl.mjs","names":["useState","useRef","useCallback","useMemo"],"sources":["https:/framerusercontent.com/modules/cl8RxflCgux7hmVdu3ys/cYJM3OvZjcZmrntUbNi6/Examples.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,startTransition,useCallback,useEffect,useMemo,useRef,useState}from\"react\";// Learn more: https://www.framer.com/developers/overrides/\nexport function withRotate(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,animate:{rotate:90},transition:{duration:2}});};}export function withHover(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,whileHover:{scale:1.05}});};}export function withRandomColor(Component){return props=>{const[background,setBackground]=useState(\"#0099FF\");const colors=[\"#0099FF\",\"#FF3366\",\"#22C55E\",\"#F59E0B\",\"#8B5CF6\"];return /*#__PURE__*/_jsx(Component,{...props,animate:{background},onClick:()=>{const nextColor=colors[Math.floor(Math.random()*colors.length)];startTransition(()=>setBackground(nextColor));}});};}export function withMouseDragScroll(Component){return /*#__PURE__*/forwardRef(function WithMouseDragScroll(props,ref){const DRAG_THRESHOLD=6;const[isPointerDown,setIsPointerDown]=useState(false);const containerRef=useRef(null);const dragStartXRef=useRef(0);const lastXRef=useRef(0);const startScrollLeftRef=useRef(0);const totalHorizontalMovementRef=useRef(0);const dragExceededThresholdRef=useRef(false);const pendingClickSuppressRef=useRef(null);const setRefs=useCallback(node=>{containerRef.current=node;if(typeof ref===\"function\"){ref(node);}else if(ref&&typeof ref===\"object\"){ref.current=node;}},[ref]);const stopDragging=useCallback(()=>{startTransition(()=>setIsPointerDown(false));},[]);const registerClickSuppressor=useCallback(()=>{const node=containerRef.current;if(!node||pendingClickSuppressRef.current)return;const suppressClick=event=>{if(!dragExceededThresholdRef.current)return;event.preventDefault();event.stopPropagation();if(\"stopImmediatePropagation\"in event){event.stopImmediatePropagation();}cleanupSuppressor();};const cleanupSuppressor=()=>{node.removeEventListener(\"click\",suppressClick,true);pendingClickSuppressRef.current=null;};node.addEventListener(\"click\",suppressClick,true);pendingClickSuppressRef.current=cleanupSuppressor;},[]);const onMouseDown=useCallback(event=>{props.onMouseDown?.(event);if(event.defaultPrevented)return;const node=containerRef.current;if(!node||event.button!==0)return;event.preventDefault();dragStartXRef.current=event.clientX;lastXRef.current=event.clientX;startScrollLeftRef.current=node.scrollLeft;totalHorizontalMovementRef.current=0;dragExceededThresholdRef.current=false;pendingClickSuppressRef.current?.();pendingClickSuppressRef.current=null;startTransition(()=>setIsPointerDown(true));},[props]);useEffect(()=>{if(!isPointerDown)return;const handleWindowMouseMove=event=>{const node=containerRef.current;if(!node)return;const stepDelta=Math.abs(event.clientX-lastXRef.current);totalHorizontalMovementRef.current+=stepDelta;lastXRef.current=event.clientX;if(!dragExceededThresholdRef.current&&totalHorizontalMovementRef.current>=DRAG_THRESHOLD){dragExceededThresholdRef.current=true;registerClickSuppressor();}if(!dragExceededThresholdRef.current)return;const deltaX=event.clientX-dragStartXRef.current;node.scrollLeft=startScrollLeftRef.current-deltaX;event.preventDefault();};const handleWindowMouseUp=()=>{stopDragging();};if(typeof window!==\"undefined\"){window.addEventListener(\"mousemove\",handleWindowMouseMove,{passive:false});window.addEventListener(\"mouseup\",handleWindowMouseUp);}return()=>{if(typeof window!==\"undefined\"){window.removeEventListener(\"mousemove\",handleWindowMouseMove);window.removeEventListener(\"mouseup\",handleWindowMouseUp);}};},[DRAG_THRESHOLD,isPointerDown,registerClickSuppressor,stopDragging]);useEffect(()=>{return()=>{pendingClickSuppressRef.current?.();};},[]);const mergedStyle=useMemo(()=>({...props.style,cursor:isPointerDown?\"grabbing\":\"grab\",userSelect:isPointerDown?\"none\":props.style?.userSelect,WebkitUserDrag:isPointerDown?\"none\":props.style?.WebkitUserDrag}),[isPointerDown,props.style]);return /*#__PURE__*/_jsx(Component,{ref:setRefs,...props,style:mergedStyle,draggable:false,onMouseDown:onMouseDown});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withRandomColor\":{\"type\":\"reactHoc\",\"name\":\"withRandomColor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRotate\":{\"type\":\"reactHoc\",\"name\":\"withRotate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHover\":{\"type\":\"reactHoc\",\"name\":\"withHover\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMouseDragScroll\":{\"type\":\"reactHoc\",\"name\":\"withMouseDragScroll\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Examples.map"],"mappings":"0KACooB,SAAgB,EAAoB,EAAU,CAAC,OAAoB,EAAW,SAA6B,EAAM,EAAI,CAAC,GAA4B,CAAC,EAAc,GAAkBA,EAAS,GAAM,CAAO,EAAaC,EAAO,KAAK,CAAO,EAAcA,EAAO,EAAE,CAAO,EAASA,EAAO,EAAE,CAAO,EAAmBA,EAAO,EAAE,CAAO,EAA2BA,EAAO,EAAE,CAAO,EAAyBA,EAAO,GAAM,CAAO,EAAwBA,EAAO,KAAK,CAAO,EAAQC,EAAY,GAAM,CAAC,EAAa,QAAQ,EAAQ,OAAO,GAAM,WAAY,EAAI,EAAK,CAAU,GAAK,OAAO,GAAM,WAAU,EAAI,QAAQ,IAAQ,CAAC,EAAI,CAAC,CAAO,EAAaA,MAAgB,CAAC,MAAoB,EAAiB,GAAM,CAAC,EAAG,EAAE,CAAC,CAAO,EAAwBA,MAAgB,CAAC,IAAM,EAAK,EAAa,QAAQ,GAAG,CAAC,GAAM,EAAwB,QAAQ,OAAO,IAAM,EAAc,GAAO,CAAK,EAAyB,UAAe,EAAM,gBAAgB,CAAC,EAAM,iBAAiB,CAAI,6BAA6B,GAAO,EAAM,0BAA0B,CAAE,GAAmB,GAAS,MAAsB,CAAC,EAAK,oBAAoB,QAAQ,EAAc,GAAK,CAAC,EAAwB,QAAQ,MAAO,EAAK,iBAAiB,QAAQ,EAAc,GAAK,CAAC,EAAwB,QAAQ,GAAoB,EAAE,CAAC,CAAO,EAAYA,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