{"version":3,"file":"AutoRestaurantCarousel.Tfks2XMZ.mjs","names":["React.useMemo","React.useRef","React.useState","p"],"sources":["https:/framerusercontent.com/modules/BE2gzQ9fdEHGRqSgx3td/fl6ByXf20ffpA5aUa9D6/AutoRestaurantCarousel.js"],"sourcesContent":["// User request: revise the \"Popular right now\" restaurant section to be an automated carousel and more animated to look better.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useInView,useReducedMotion,useAnimationFrame}from\"framer-motion\";function parseRestaurants(data){try{const parsed=JSON.parse(data);if(!Array.isArray(parsed))return[];return parsed.map(r=>{const name=typeof r?.name===\"string\"?r.name:\"\";const meta=typeof r?.meta===\"string\"?r.meta:\"\";const src=typeof r?.image?.src===\"string\"?r.image.src:typeof r?.image===\"string\"?r.image:\"\";const alt=typeof r?.image?.alt===\"string\"?r.image.alt:name;if(!name||!meta||!src)return null;return{name,meta,image:{src,alt}};}).filter(Boolean);}catch{return[];}}/**\n * Auto Restaurant Carousel\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function AutoRestaurantCarousel(props){const{data=JSON.stringify([{name:\"Harbour Bistro\",meta:\"Surry Hills \\xb7 Modern Australian\",image:{src:\"https://framerusercontent.com/images/SQA8NxdF3af42JNt7lbOTHkmU.jpg\",alt:\"Harbour Bistro\"}},{name:\"Luna Kitchen\",meta:\"Fitzroy \\xb7 Shared plates\",image:{src:\"https://framerusercontent.com/images/ihFd5MB7vJBLc5BBv72cZax70rk.jpg\",alt:\"Luna Kitchen\"}},{name:\"Dockside Dining\",meta:\"Southbank \\xb7 Seafood\",image:{src:\"https://framerusercontent.com/images/1VfChXdsdNiO52cC1IeyGQRRaQ.jpg\",alt:\"Dockside Dining\"}},{name:\"Northlane\",meta:\"Newtown \\xb7 Asian fusion\",image:{src:\"https://framerusercontent.com/images/X27fTa7oHMRjPZYlqG3Kqt1rWg.jpg\",alt:\"Northlane\"}}],null,2),speed=42,gap=16,cardWidth=280,imageHeight=160,radius=16,borderColor=\"rgba(0,0,0,0.15)\",background=\"rgba(255,255,255,1)\",titleColor=\"rgb(31,31,31)\",metaColor=\"rgba(0,0,0,0.6)\",pauseOnHover=true,edgeFade=true,edgeFadeWidth=56,style}=props;const isStatic=useIsStaticRenderer();const reducedMotion=useReducedMotion()??false;const restaurants=React.useMemo(()=>{const parsed=parseRestaurants(data);return parsed.length>=2?parsed:[];},[data]);const scrollerRef=React.useRef(null);const contentRef=React.useRef(null);const[isHovering,setIsHovering]=React.useState(false);const[contentWidth,setContentWidth]=React.useState(1);const inViewRef=React.useRef(null);const inView=useInView(inViewRef,{amount:.25,margin:\"-10% 0px\"})??true;React.useEffect(()=>{if(isStatic)return;if(!contentRef.current)return;const el=contentRef.current;const measure=()=>{const w=el.scrollWidth;setContentWidth(w>0?w:1);};measure();const ro=new ResizeObserver(measure);ro.observe(el);return()=>ro.disconnect();},[isStatic,restaurants.length,gap,cardWidth,imageHeight]);useAnimationFrame((_,delta)=>{if(isStatic||reducedMotion)return;if(!inView)return;if(pauseOnHover&&isHovering)return;const el=scrollerRef.current;if(!el)return;const pxPerMs=speed/1e3;el.scrollLeft+=pxPerMs*delta;const loopPoint=contentWidth/2;if(loopPoint>0&&el.scrollLeft>=loopPoint){el.scrollLeft-=loopPoint;}});const items=React.useMemo(()=>{const base=restaurants.length?restaurants:parseRestaurants(data);return[...base,...base];},[restaurants,data]);const containerStyles={...style,position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",background};const scrollerStyles={width:\"100%\",height:\"100%\",overflowX:\"auto\",overflowY:\"hidden\",WebkitOverflowScrolling:\"touch\",scrollbarWidth:\"none\"};const trackStyles={display:\"flex\",flexDirection:\"row\",gap,padding:\"4px 0px 10px 0px\",alignItems:\"stretch\",width:\"max-content\"};const cardBase={width:cardWidth,minWidth:cardWidth,background:\"rgba(255,255,255,1)\",borderRadius:radius,border:`1px solid ${borderColor}`,padding:12,display:\"flex\",flexDirection:\"column\",gap:12,boxSizing:\"border-box\",willChange:\"transform\"};const imageStyle={width:\"100%\",height:imageHeight,borderRadius:Math.max(0,radius-4),objectFit:\"cover\",display:\"block\"};const titleStyle={color:titleColor,fontSize:18,lineHeight:\"1.2em\",letterSpacing:\"-0.02em\",fontWeight:650,margin:0};const metaStyle={color:metaColor,fontSize:14,lineHeight:\"1.35em\",letterSpacing:\"-0.01em\",margin:0};const fadeCommon={position:\"absolute\",top:0,bottom:0,width:edgeFadeWidth,pointerEvents:\"none\",zIndex:3};const leftFade={...fadeCommon,left:0,background:\"linear-gradient(90deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%)\"};const rightFade={...fadeCommon,right:0,background:\"linear-gradient(270deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%)\"};return /*#__PURE__*/_jsxs(\"div\",{ref:inViewRef,style:containerStyles,onMouseEnter:pauseOnHover?()=>setIsHovering(true):undefined,onMouseLeave:pauseOnHover?()=>setIsHovering(false):undefined,\"aria-roledescription\":\"carousel\",children:[edgeFade&&/*#__PURE__*/_jsx(\"div\",{style:leftFade,\"aria-hidden\":true}),edgeFade&&/*#__PURE__*/_jsx(\"div\",{style:rightFade,\"aria-hidden\":true}),/*#__PURE__*/_jsx(\"div\",{ref:scrollerRef,style:scrollerStyles,children:/*#__PURE__*/_jsx(\"div\",{ref:contentRef,style:trackStyles,children:items.map((r,idx)=>/*#__PURE__*/_jsxs(motion.article,{style:cardBase,whileHover:isStatic||reducedMotion?undefined:{y:-4,boxShadow:\"0 16px 40px rgba(0,0,0,0.10)\"},transition:{duration:.18,ease:[.16,1,.3,1]},children:[/*#__PURE__*/_jsx(\"img\",{src:r.image.src,alt:r.image.alt||\"\",style:imageStyle,loading:isStatic?\"eager\":\"lazy\",draggable:false}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",gap:6},children:[/*#__PURE__*/_jsx(\"p\",{style:titleStyle,children:r.name}),/*#__PURE__*/_jsx(\"p\",{style:metaStyle,children:r.meta})]})]},`${r.name}-${idx}`))})}),/*#__PURE__*/_jsx(\"style\",{children:`\n                /* Hide scrollbars (best effort) */\n                div::-webkit-scrollbar { display: none; }\n            `})]});}addPropertyControls(AutoRestaurantCarousel,{data:{type:ControlType.String,title:\"Restaurants JSON\",defaultValue:JSON.stringify([{name:\"Harbour Bistro\",meta:\"Surry Hills \\xb7 Modern Australian\",image:{src:\"https://framerusercontent.com/images/SQA8NxdF3af42JNt7lbOTHkmU.jpg\",alt:\"Harbour Bistro\"}},{name:\"Luna Kitchen\",meta:\"Fitzroy \\xb7 Shared plates\",image:{src:\"https://framerusercontent.com/images/ihFd5MB7vJBLc5BBv72cZax70rk.jpg\",alt:\"Luna Kitchen\"}},{name:\"Dockside Dining\",meta:\"Southbank \\xb7 Seafood\",image:{src:\"https://framerusercontent.com/images/1VfChXdsdNiO52cC1IeyGQRRaQ.jpg\",alt:\"Dockside Dining\"}},{name:\"Northlane\",meta:\"Newtown \\xb7 Asian fusion\",image:{src:\"https://framerusercontent.com/images/X27fTa7oHMRjPZYlqG3Kqt1rWg.jpg\",alt:\"Northlane\"}}],null,2),displayTextArea:true},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:42,min:0,max:140,step:1,unit:\"px/s\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:16,min:8,max:40,step:1,unit:\"px\"},cardWidth:{type:ControlType.Number,title:\"Card W\",defaultValue:280,min:220,max:420,step:1,unit:\"px\"},imageHeight:{type:ControlType.Number,title:\"Image H\",defaultValue:160,min:120,max:240,step:1,unit:\"px\"},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:16,min:0,max:28,step:1,unit:\"px\"},borderColor:{type:ControlType.Color,title:\"Border\",defaultValue:\"rgba(0,0,0,0.15)\"},background:{type:ControlType.Color,title:\"Bg\",defaultValue:\"#FFFFFF\"},titleColor:{type:ControlType.Color,title:\"Title\",defaultValue:\"#1F1F1F\"},metaColor:{type:ControlType.Color,title:\"Meta\",defaultValue:\"rgba(0,0,0,0.6)\"},pauseOnHover:{type:ControlType.Boolean,title:\"Pause Hover\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},edgeFade:{type:ControlType.Boolean,title:\"Edge Fade\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},edgeFadeWidth:{type:ControlType.Number,title:\"Fade W\",defaultValue:56,min:24,max:120,step:1,unit:\"px\",hidden:p=>!p.edgeFade}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AutoRestaurantCarousel\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AutoRestaurantCarousel.map"],"mappings":"oRAC4O,SAAS,EAAiB,EAAK,CAAC,GAAG,CAAC,IAAM,EAAO,KAAK,MAAM,EAAK,CAAoC,OAA/B,MAAM,QAAQ,EAAO,CAAiB,EAAO,IAAI,GAAG,CAAC,IAAM,EAAK,OAAO,GAAG,MAAO,SAAS,EAAE,KAAK,GAAS,EAAK,OAAO,GAAG,MAAO,SAAS,EAAE,KAAK,GAAS,EAAI,OAAO,GAAG,OAAO,KAAM,SAAS,EAAE,MAAM,IAAI,OAAO,GAAG,OAAQ,SAAS,EAAE,MAAM,GAAS,EAAI,OAAO,GAAG,OAAO,KAAM,SAAS,EAAE,MAAM,IAAI,EAAuC,MAA/B,CAAC,GAAM,CAAC,GAAM,CAAC,EAAW,KAAW,CAAC,OAAK,OAAK,MAAM,CAAC,MAAI,MAAI,CAAC,EAAG,CAAC,OAAO,QAAQ,CAApW,EAAE,MAAyW,CAAC,MAAM,EAAE,EAK/rB,SAAwB,EAAuB,EAAM,CAAC,GAAK,CAAC,OAAK,KAAK,UAAU,CAAC,CA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