{"version":3,"file":"HideWhenEmpty.DelYIigp.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/BRMAv8oYwHQofJPZk8xl/ZdnR7IPjlqHAuYQ9YwL5/HideWhenEmpty.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef,useState}from\"react\";import{RenderTarget}from\"framer\";// Hide when empty: hides a section whose CMS list has no items, so an empty list never leaves a title and column\n// heads over nothing. It looks for the list by its layer name: Rows, Testimonial, Articles, Questions list, People or\n// Packages. Delete every item of the collection and the section disappears from the site; add one back and it returns.\n// Keep those layer names if you rename layers. The canvas always shows the section.\nexport function withHideWhenEmpty(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const box=useRef(null);const[empty,setEmpty]=useState(false);const onCanvas=RenderTarget.current()===RenderTarget.canvas;useEffect(()=>{if(onCanvas)return;const names=[\"Rows\",\"Testimonial\",\"Articles\",\"Questions list\",\"People\",\"Packages\"];const rows=box.current?.querySelector(names.map(n=>`[data-framer-name=\"${n}\"]`).join(\",\"));setEmpty(!!rows&&rows.children.length===0);},[onCanvas]);return /*#__PURE__*/_jsx(\"div\",{ref:box,style:{display:empty?\"none\":\"contents\"},children:/*#__PURE__*/_jsx(Component,{ref:ref,...props})});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withHideWhenEmpty\":{\"type\":\"reactHoc\",\"name\":\"withHideWhenEmpty\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HideWhenEmpty.map"],"mappings":"wLAIA,SAAgB,EAAkB,EAAU,CAAC,OAAoB,GAAY,EAAM,IAAM,CAAC,IAAM,EAAIA,EAAO,IAAI,EAAO,CAAC,EAAM,GAAUC,EAAS,EAAK,EAAQ,EAAS,EAAa,QAAQ,IAAI,EAAa,OAAgR,OAAzQ,MAAc,CAAC,GAAG,EAAS,OAA0F,IAAM,EAAK,EAAI,SAAS,cAAc,CAA5G,OAAO,cAAc,WAAW,iBAAiB,SAAS,UAAsD,CAAC,CAAC,IAAI,GAAG,sBAAsB,EAAE,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,EAAE,EAAS,CAAC,CAAC,GAAM,EAAK,SAAS,SAAS,CAAC,CAAE,EAAE,CAAC,CAAQ,CAAC,EAAsB,EAAK,MAAM,CAAC,IAAI,EAAI,MAAM,CAAC,QAAQ,EAAM,OAAO,UAAU,EAAE,SAAsB,EAAK,EAAU,CAAK,MAAI,GAAG,CAAK,CAAC,CAAC,CAAC,CAAE,CAAC,CAAE,iBAJhkB,IAAwD,IAAiC"}