{"version":3,"file":"WorkTile.DFi6lluG.mjs","names":["React.useRef","React.useState","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","init_npm_react_dom_18_3_1","_e","Ha","p","init_jsx_runtime","ce","de","addPropertyControls","init_framer_BkYB2Gqq","ControlType","listRoot","el","id","tagCell","type","fitWidth","w","h","r","fw","area","fh","maxd","flush","f","queue","preloaded","u","i","preloadImage","installCeramicLinks","a","CER_RE","WorkTile","props","url","src","image","big","previewImage","ref","preview","mobile","pct","setPct","imgRef","pos","setPos","canHover","showPreview","move","right","hh","previewWidth","meta","year","online","style","number","name","scale","FONT","scheduled","init_WorkTile","img"],"sources":["https:/framerusercontent.com/modules/iAf9BDLtPT6YQzlpStba/KWO07nwX4GKBQYsWTaWD/WorkTile.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{createPortal}from\"react-dom\";import{addPropertyControls,ControlType}from\"framer\";// Find the element that actually holds the cells of a list: the element with the HTML id, or\n// (if Framer wraps it) its first descendant with more than one child. Marked data-haos-list.\nfunction listRoot(id){if(typeof document===\"undefined\")return null;let el=document.getElementById(id);while(el&&el.children.length===1)el=el.children[0];if(el)el.setAttribute(\"data-haos-list\",id);return el;}function tagCell(el,type){listRoot(\"works-grid\");listRoot(\"works-rows\");let n=el;while(n&&n.parentElement){if(n.parentElement.hasAttribute(\"data-haos-list\")){n.setAttribute(\"data-haos-type\",type||\"\");return;}n=n.parentElement;}}// Studio HAOS — one work in the home grid.\n// The photo is contained and centred in a square cell; its width follows the\n// \"even visual area\" rule of the validated mockup (Home-5d): every object gets the\n// same visual area (46 % of the cell, 58 % on mobile), capped at 92 % (95 %) of the cell.\n// On desktop, hovering shows a larger floating preview next to the cursor with\n// the caption \"No. 001 / Armchair — Seating, 2020\".\nconst FONT='\"Hanken Grotesk\", \"Hanken Grotesk Placeholder\", sans-serif';export function fitWidth(w,h,area,maxd){if(!w||!h)return 70;const r=w/h;let fw=Math.sqrt(area*r);let fh=fw/r;if(fw>maxd){fw=maxd;fh=fw/r;}if(fh>maxd){fh=maxd;fw=fh*r;}return Math.round(fw*1e3)/10;}// Preload (after the page has loaded and the browser is idle) the exact image URL a hover /\n// list preview will show, so the preview appears instantly from the browser cache.\nconst preloaded=new Map;const queue=[];let scheduled=false;function flush(){scheduled=false;const idle=window.requestIdleCallback||(f=>window.setTimeout(f,200));idle(()=>{const batch=queue.splice(0,8);batch.forEach(u=>{if(preloaded.has(u))return;const i=new Image;i.decoding=\"async\";i.src=u;preloaded.set(u,i);i.decode?.().catch(()=>{});});if(queue.length)flush();});}export function preloadImage(u){if(typeof window===\"undefined\"||!u||preloaded.has(u)||queue.includes(u))return;queue.push(u);if(scheduled)return;scheduled=true;if(document.readyState===\"complete\")flush();else window.addEventListener(\"load\",flush,{once:true});}const src=img=>typeof img===\"string\"?img:img?.src||\"\";// Ceramic family pages are static pages under /works/; Framer's client router would open the\n// CMS template instead, so links to them always do a full page load.\nconst CER_RE=/\\/works\\/ceramic-(table-lamps|pendant-lights|wall-lights)\\/?$/;function installCeramicLinks(){if(typeof window===\"undefined\"||window.__haosCer===2)return;window.__haosCer=2;const h=e=>{if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;const a=e.target?.closest?.(\"a\");if(!a||a.target===\"_blank\")return;const h=a.getAttribute(\"href\");if(!h)return;const u=new URL(h,window.location.href);if(u.origin!==window.location.origin||!CER_RE.test(u.pathname))return;e.preventDefault();e.stopImmediatePropagation();window.location.assign(u.pathname);};window.addEventListener(\"click\",h,true);}/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function WorkTile(props){React.useEffect(installCeramicLinks,[]);const{image,previewImage,number=\"\",name=\"\",type=\"\",year=0,online=false,mobile=false,preview=true,previewWidth=420,scale=1,style}=props;const url=src(image);const big=src(previewImage)||url;const ref=React.useRef(null);React.useEffect(()=>tagCell(ref.current,type),[type]);React.useEffect(()=>{if(preview&&!mobile)preloadImage(big);},[big,preview,mobile]);const area=mobile?.58:.46;const maxd=mobile?.95:.92;const[pct,setPct]=React.useState(null);const imgRef=React.useRef(null);// the image may finish loading before React hydrates (onLoad then never fires)\nReact.useEffect(()=>{const i=imgRef.current;if(i&&i.complete&&i.naturalWidth)setPct(fitWidth(i.naturalWidth,i.naturalHeight,area,maxd));},[url,area,maxd]);const[pos,setPos]=React.useState(null);const canHover=typeof window!==\"undefined\"&&window.matchMedia?window.matchMedia(\"(hover: hover)\").matches:false;const showPreview=preview&&!mobile&&canHover;const move=e=>{if(!showPreview)return;const right=e.clientX<window.innerWidth/2;const hh=previewWidth*.9+40;setPos({x:right?e.clientX+32:e.clientX-previewWidth-32,y:Math.max(80,Math.min(e.clientY-hh/2,window.innerHeight-hh-16))});};const meta=[type,year?String(year):\"\"].filter(Boolean).join(\", \")+(online?\". Available online\":\"\");return /*#__PURE__*/_jsxs(\"div\",{ref:ref,style:{...style,position:\"relative\",width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},onMouseMove:move,onMouseLeave:()=>setPos(null),\"aria-label\":\"No. \"+number+\" \"+name,children:[url?/*#__PURE__*/_jsx(\"img\",{ref:imgRef,src:url,alt:\"No. \"+number+\" \"+name,loading:\"lazy\",onLoad:e=>setPct(fitWidth(e.currentTarget.naturalWidth,e.currentTarget.naturalHeight,area,maxd)),style:{display:\"block\",width:Math.min(100,(pct??70)*(Number(scale)||1))+\"%\",height:\"auto\",opacity:pct===null?0:1,transition:\"opacity .3s\"}}):null,showPreview&&pos&&url&&typeof document!==\"undefined\"?/*#__PURE__*/createPortal(/*#__PURE__*/_jsxs(\"div\",{style:{position:\"fixed\",left:pos.x,top:pos.y,width:previewWidth,zIndex:25,pointerEvents:\"none\",display:\"flex\",flexDirection:\"column\",gap:8,background:\"#FFFFFF\",padding:\"0 0 4px\"},children:[/*#__PURE__*/_jsx(\"img\",{src:big,alt:\"\",style:{display:\"block\",width:\"100%\",height:\"auto\"}}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",justifyContent:\"space-between\",gap:12,fontFamily:FONT,fontSize:11,lineHeight:1.35,color:\"#111111\"},children:[/*#__PURE__*/_jsxs(\"span\",{children:[\"No. \",number,/*#__PURE__*/_jsx(\"br\",{}),name]}),/*#__PURE__*/_jsx(\"span\",{style:{color:\"#8A8A8A\",textAlign:\"right\"},children:meta})]})]}),document.body):null]});}WorkTile.displayName=\"Work Tile\";addPropertyControls(WorkTile,{image:{type:ControlType.ResponsiveImage,title:\"Image\"},previewImage:{type:ControlType.ResponsiveImage,title:\"Preview image\"},scale:{type:ControlType.Number,title:\"Scale\",defaultValue:1,min:.2,max:2,step:.01},number:{type:ControlType.String,title:\"Number\",defaultValue:\"001\"},name:{type:ControlType.String,title:\"Name\",defaultValue:\"Armchair\"},type:{type:ControlType.String,title:\"Type\",defaultValue:\"Seating\"},year:{type:ControlType.Number,title:\"Year\",defaultValue:2020},online:{type:ControlType.Boolean,title:\"Online\",defaultValue:false},mobile:{type:ControlType.Boolean,title:\"Mobile\",defaultValue:false},preview:{type:ControlType.Boolean,title:\"Hover preview\",defaultValue:true},previewWidth:{type:ControlType.Number,title:\"Preview width\",defaultValue:420}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"WorkTile\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\"}},\"fitWidth\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"preloadImage\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WorkTile.map"],"mappings":"A,2NAEA,SAASgB,EAAS,EAAG,CAAC,GAAG,OAAO,SAAW,IAAY,OAAO,KAAK,IAAIC,EAAG,SAAS,eAAeC,CAAE,EAAE,KAAMD,GAAIA,EAAG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