{"version":3,"file":"ParallaxGridMotion.C8K0pXOG.mjs","names":["useRef","useMemo"],"sources":["https:/framerusercontent.com/modules/AuutRHQRb2GILGa8Fo5I/h5KUgW6FVzVi4KkMmtmE/ParallaxGridMotion.js"],"sourcesContent":["// GridMotion: GSAP-like mouse movement on grid, Framer rules, property controls, no gsap (use framer-motion)\n// Renamed to ParallaxGridMotion\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,startTransition,useMemo}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useMotionValue,useAnimationFrame}from\"framer-motion\";/**\n * ParallaxGridMotion\n *\n * Interactive 4x7 grid, with rows moving horizontally on mouse move or touch.\n * Uses framer-motion for animation. Rows alternate direction for parallax.\n * Background is radial gradient w/ noise overlay. Items customizable.\n *\n * @framerIntrinsicWidth 1200\n * @framerIntrinsicHeight 600\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */function ParallaxGridMotion(props){const{items=[],gradientColor=\"black\",background=\"#000\",cellColor=\"#111\",textColor=\"#fff\",font={fontSize:\"24px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"},borderRadius=10,cardWidth=180,cardHeight=180,rowGap=16,columnGap=16,style}=props;const gridRef=useRef(null);const rowCount=4;const colCount=7;const totalItems=rowCount*colCount;const defaultItems=Array.from({length:totalItems},(_,i)=>`Item ${i+1}`);// Shuffle function that avoids repeating images in the same row\nconst distributeItems=sourceItems=>{if(sourceItems.length===0)return defaultItems.slice();if(sourceItems.length===1)return Array.from({length:totalItems},()=>sourceItems[0]);const result=[];const itemPool=[...sourceItems];// For each row\nfor(let row=0;row<rowCount;row++){const rowItems=[];const usedInRow=new Set;// For each column in the row\nfor(let col=0;col<colCount;col++){let selectedItem;let attempts=0;const maxAttempts=itemPool.length*2;// Try to find an item not used in this row yet\ndo{const randomIndex=Math.floor(Math.random()*itemPool.length);selectedItem=itemPool[randomIndex];attempts++;// If we've tried too many times or this item hasn't been used in this row, use it\nif(attempts>=maxAttempts||!usedInRow.has(selectedItem)){break;}}while(attempts<maxAttempts)rowItems.push(selectedItem);usedInRow.add(selectedItem);}result.push(...rowItems);}return result;};// Distribute items to avoid repetition in rows\nconst distributedItems=useMemo(()=>distributeItems(items),[items.length]);// New: ensure correct parsing for array/object item rendering\nfunction getContentDisplay(item){if(typeof item===\"object\"&&item!==null&&Object.prototype.hasOwnProperty.call(item,\"image\")&&item.image){// Handle ResponsiveImage object with src, srcSet, alt\nconst imageSrc=typeof item.image===\"object\"&&item.image.src?item.image.src:item.image;const imageSrcSet=typeof item.image===\"object\"&&item.image.srcSet?item.image.srcSet:undefined;const imageAlt=typeof item.image===\"object\"&&item.image.alt?item.image.alt:\"Grid cell image\";return /*#__PURE__*/_jsx(\"img\",{src:imageSrc,srcSet:imageSrcSet,alt:imageAlt,style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",objectFit:\"cover\",pointerEvents:\"none\"}});}// If object with content key (or fallback to string)\nconst label=typeof item===\"object\"&&item&&\"content\"in item?item.content:item;return /*#__PURE__*/_jsx(\"div\",{style:{padding:\"1rem\",textAlign:\"center\",zIndex:1,...font},children:label});}// MouseX: 0..1 normalized across viewport width.\nconst mouseX=useMotionValue(.5);const isStatic=useIsStaticRenderer();// Row X offsets, motion values, one per row.\nconst rowOffsets=Array.from({length:rowCount},()=>useMotionValue(0));const rowBaseDuration=.8;const inertia=[.6,.4,.3,.2];// On mouse move update mouseX\nuseEffect(()=>{if(isStatic)return;function handle(e){let clientX=0;if(e.touches&&e.touches[0]){clientX=e.touches[0].clientX;}else{clientX=e.clientX;}const x=Math.max(0,Math.min(1,clientX/window.innerWidth));startTransition(()=>mouseX.set(x));}window.addEventListener(\"mousemove\",handle);window.addEventListener(\"touchmove\",handle);return()=>{window.removeEventListener(\"mousemove\",handle);window.removeEventListener(\"touchmove\",handle);};},[isStatic]);// Parallax row X updates\nuseAnimationFrame(t=>{if(isStatic)return;const x=mouseX.get();const maxMove=props.scrollSpeed??300// use scrollSpeed prop if provided\n;rowOffsets.forEach((mv,i)=>{const dir=i%2===0?1:-1;const moveAmount=(x-.5)*2*maxMove*dir;const current=mv.get();// Animate toward moveAmount\nconst diff=moveAmount-current;// Lerp\nmv.set(current+diff*.1);});});// Utility: Noise overlay\nfunction Noise(){return /*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",pointerEvents:\"none\",zIndex:4,top:0,left:0,width:\"100%\",height:\"100%\",opacity:.15,backgroundImage:\"url('https://grainy-gradients.vercel.app/noise.svg')\",backgroundSize:\"250px\"}});}return /*#__PURE__*/_jsx(\"div\",{ref:gridRef,style:{width:\"100%\",height:\"100%\",overflow:\"hidden\",backgroundColor:background,position:\"relative\",...style},children:/*#__PURE__*/_jsxs(\"section\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",background:`radial-gradient(circle, ${gradientColor} 0%, transparent 100%)`},children:[/*#__PURE__*/_jsx(Noise,{}),/*#__PURE__*/_jsx(\"div\",{style:{gap:`${rowGap}px`,flex:\"none\",position:\"relative\",width:\"150vw\",height:\"150vh\",display:\"grid\",gridTemplateRows:`repeat(${rowCount}, 1fr)`,gridTemplateColumns:\"100%\",transform:\"rotate(-15deg)\",transformOrigin:\"center center\",zIndex:2},children:[...Array(rowCount)].map((_,rowIndex)=>/*#__PURE__*/_jsx(motion.div,{style:{display:\"grid\",gap:`${columnGap}px`,gridTemplateColumns:`repeat(${colCount}, 1fr)`,willChange:\"transform\",x:rowOffsets[rowIndex]},\"aria-rowindex\":rowIndex+1,children:[...Array(colCount)].map((_,colIdx)=>{const idx=rowIndex*colCount+colIdx;const content=distributedItems[idx];return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\"},children:/*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:cardWidth,height:cardHeight,overflow:\"hidden\",borderRadius:borderRadius,backgroundColor:cellColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",color:textColor,fontSize:font.fontSize,letterSpacing:font.letterSpacing,lineHeight:font.lineHeight,fontWeight:font.variant===\"Bold\"?700:font.variant===\"Medium\"?500:undefined,fontStyle:font.variant&&font.variant.toLowerCase().includes(\"italic\")?\"italic\":undefined},children:getContentDisplay(content)})},colIdx);})},rowIndex))})]})});}export default ParallaxGridMotion;addPropertyControls(ParallaxGridMotion,{items:{type:ControlType.Array,title:\"Items\",description:\"Array of grid cell content. Each entry can be a text label, an uploaded image, or both. If only one item is set it fills all grid cells; two items will alternate, more will cycle.\",control:{type:ControlType.Object,controls:{content:{type:ControlType.String,title:\"Text\",description:\"Text to display in the grid cell (leave blank to show only image)\",placeholder:\"Text label...\",defaultValue:\"\"},image:{type:ControlType.ResponsiveImage,title:\"Image Upload\",description:\"Upload an image to display as background in the grid cell.\"}},defaultValue:{content:\"\",image:undefined}},defaultValue:Array.from({length:28},(_,i)=>({content:`Item ${i+1}`})),maxCount:28},gradientColor:{type:ControlType.Color,title:\"Gradient Center\",description:\"Center color of the radial gradient for the background.\",defaultValue:\"#111\"},background:{type:ControlType.Color,title:\"Background Color\",description:\"Solid background color for the outer container layer.\",defaultValue:\"#000\"},cellColor:{type:ControlType.Color,title:\"Cell Color\",description:\"Background color of individual grid cells.\",defaultValue:\"#111\"},textColor:{type:ControlType.Color,title:\"Text Color\",description:\"Text color used for cell content.\",defaultValue:\"#fff\"},font:{type:ControlType.Font,title:\"Text Font\",description:\"Font style used for content inside grid cells.\",defaultValue:{fontSize:\"24px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},borderRadius:{type:ControlType.Number,title:\"Cell Radius\",description:\"Corner radius for grid cell cards.\",defaultValue:10,min:0,max:40},cardWidth:{type:ControlType.Number,title:\"Card Width\",description:\"Width (in px) for each grid cell/card.\",defaultValue:180,min:50,max:500,step:1,unit:\"px\"},cardHeight:{type:ControlType.Number,title:\"Card Height\",description:\"Height (in px) for each grid cell/card.\",defaultValue:180,min:50,max:500,step:1,unit:\"px\"},scrollSpeed:{type:ControlType.Number,title:\"Scroll Speed\",description:\"How far rows move left/right based on mouse or touch movement.\",defaultValue:300,min:50,max:1e3,step:1,unit:\"px\"},rowGap:{type:ControlType.Number,title:\"Row Gap\",description:\"Vertical spacing between rows of grid cells.\",defaultValue:16,min:0,max:100,step:1,unit:\"px\"},columnGap:{type:ControlType.Number,title:\"Column Gap\",description:\"Horizontal spacing between columns of grid cells.\",defaultValue:16,min:0,max:100,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ParallaxGridMotion\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"1200\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"600\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ParallaxGridMotion.map"],"mappings":"sRAcG,SAAS,EAAmB,EAAM,CAAC,GAAK,CAAC,QAAM,EAAE,CAAC,gBAAc,QAAQ,aAAW,OAAO,YAAU,OAAO,YAAU,OAAO,OAAK,CAAC,SAAS,OAAO,QAAQ,SAAS,cAAc,UAAU,WAAW,QAAQ,CAAC,eAAa,GAAG,YAAU,IAAI,aAAW,IAAI,SAAO,GAAG,YAAU,GAAG,SAAO,EAAY,EAAQA,EAAO,KAAK,CAA4E,EAAa,MAAM,KAAK,CAAC,OAAO,GAAW,EAAE,EAAE,IAAI,QAAQ,EAAE,IAAI,CACpc,EAAgB,GAAa,CAAC,GAAG,EAAY,SAAS,EAAE,OAAO,EAAa,OAAO,CAAC,GAAG,EAAY,SAAS,EAAE,OAAO,MAAM,KAAK,CAAC,OAAO,GAAW,KAAK,EAAY,GAAG,CAAC,IAAM,EAAO,EA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