{"version":3,"file":"MasonryLayout.BniGifqy.mjs","names":["j"],"sources":["https:/framerusercontent.com/modules/QvcQDHFSyXpcgTzkSMpg/BWjyTbXErexuXPF5ZUK9/Masonry.js","https:/framerusercontent.com/modules/7XzJP0Q2NyyJyg9uVacP/met3zffn26WSKovWjmpV/MasonryLayout.js"],"sourcesContent":["// Code from Nikolay Goncharuk on GitHub:\n// https://github.com/GoncharukBro/react-smart-masonry/blob/master/src/Masonry.tsx\n// https://github.com/GoncharukBro/react-smart-masonry/blob/master/src/useResize.ts\n//\n// Modified by Isaac Roberts\n// https://framestack.co/components/masonry-layout\n//\n// Copyright (c) 2021 Nikolay Goncharuk\n// MIT License\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useLayoutEffect,useMemo,useRef,Children,isValidElement}from\"react\";const DEFAULT_COLUMNS=1;const DEFAULT_GAP=0;export default function Masonry({breakpoints,columns=DEFAULT_COLUMNS,gap=DEFAULT_GAP,reverse=false,autoArrange=false,alignment=\"center\",children,style,...otherProps},forwardedRef){const elements=useRef([]);const[arrange,setArrange]=useState(false);// eslint-disable-next-line react-hooks/exhaustive-deps\nuseLayoutEffect(()=>{if(autoArrange&&!arrange)setArrange(true);return()=>{if(autoArrange&&arrange)setArrange(false);};});const layout=useMemo(()=>{if(columns<1)return[];const arrayOfChildren=Children.toArray(children);if(reverse)arrayOfChildren.reverse();const newLayout=Array.from({length:columns},()=>{return[];});const columnHeights=newLayout.map(()=>0);const getcolumnIndex=index=>{if(autoArrange&&arrange&&elements.current.length>0){const columnIndex=columnHeights.findIndex(item=>{return item===Math.min(...columnHeights);});const element=elements.current.find(item=>item.index===index);const elementHeight=element===null||element===void 0?void 0:element.element.getBoundingClientRect().height;columnHeights[columnIndex]+=elementHeight||0;return columnIndex;}return index%columns;};arrayOfChildren.forEach((child,index)=>{if(child&&/*#__PURE__*/isValidElement(child)){newLayout[getcolumnIndex(index)].push({element:child,index});}});return newLayout;},[arrange,autoArrange,children,columns,reverse]);const temporaryElements=[];const addElement=index=>element=>{if(element!==null){temporaryElements.push({element,index});elements.current=temporaryElements;}};return /*#__PURE__*/_jsx(\"div\",{ref:forwardedRef,style:{display:\"flex\",gap,...style},...otherProps,children:layout.map((column,columnIndex)=>/*#__PURE__*/_jsx(\"div\",{style:{flex:1,display:\"flex\",flexDirection:\"column\",alignItems:alignment,gap},children:column.map((item,itemIndex)=>/*#__PURE__*/_jsx(\"div\",{ref:addElement(item.index),children:item.element},itemIndex))},columnIndex))});}\nexport const __FramerMetadata__ = {\"exports\":{\"MasonryProps\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"reactComponent\",\"name\":\"Masonry\",\"slots\":[\"children\"],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Masonry.map","import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget,// @ts-ignore\nuseQueryData}from\"framer\";import{cloneElement,useMemo}from\"react\";import Masonry from\"https://framerusercontent.com/modules/QvcQDHFSyXpcgTzkSMpg/BWjyTbXErexuXPF5ZUK9/Masonry.js\";import{getCollectionData}from\"https://framer.com/m/CMSLibrary-09eo.js\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function MasonryLayout(props){var _props_collectionList;const{type}=props;const collectionList=(_props_collectionList=props.collectionList)===null||_props_collectionList===void 0?void 0:_props_collectionList[0];const isCanvas=RenderTarget.current()===RenderTarget.canvas;let layers=useMemo(()=>{let value=[];switch(type){case\"cms\":const{query,childrenFunction}=getCollectionData(collectionList);if(!isCanvas&&query){var _c_props;const c=childrenFunction(useQueryData(query));if(Array.isArray(c)){value=c;}else if(Array.isArray(c===null||c===void 0?void 0:(_c_props=c.props)===null||_c_props===void 0?void 0:_c_props.children)){value=c.props.children;}}if(!collectionList||!query&&!isCanvas){return /*#__PURE__*/_jsx(Message,{title:\"Connect a CMS Collection List\",subtitle:\"Use the handle on the right side of the component to connect a collection list, or select it from the dropdown. The collection list must be outside of the page on the canvas.\"});}else if(isCanvas){return /*#__PURE__*/_jsx(Message,{title:\"Preview site to view masonry grid\",subtitle:\"Press the play button or visit the live website to view the masonry grid.\"});}break;case\"layers\":if(!props.layers.length){return /*#__PURE__*/_jsx(Message,{title:\"Connect layers\",subtitle:\"Use the handle on the right side of the component to connect layers outside of the page for a masonry grid.\"});}value=props.layers;break;}return props.randomize?shuffleArray(value):value;},[type,collectionList,props.layers,props.randomize]);if(props.columnWidth==\"fill\"){for(let i=0;i<layers.length;i++){if(layers[i]){var _layers_i_props,_layers_i;layers[i]=/*#__PURE__*/cloneElement(layers[i],{style:{...(_layers_i=layers[i])===null||_layers_i===void 0?void 0:(_layers_i_props=_layers_i.props)===null||_layers_i_props===void 0?void 0:_layers_i_props.style,width:\"100%\"}});}}}if(props.columns==1){return /*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",flexDirection:\"column\",gap:props.gapV},children:layers});}else{return /*#__PURE__*/_jsx(Masonry,{columns:props.columns,gap:`${props.gapV}px ${props.gapH}px`,alignment:props.columnWidth==\"fit\"?props.align:\"stretch\",autoArrange:true,reverse:false,style:props.style,children:layers});}}MasonryLayout.displayName=\"Masonry Layout\";addPropertyControls(MasonryLayout,{type:{type:ControlType.Enum,defaultValue:\"layers\",options:[\"layers\",\"cms\"],optionTitles:[\"Layers\",\"CMS\"],displaySegmentedControl:true},collectionList:{type:ControlType.ComponentInstance,hidden:props=>props.type!==\"cms\"},layers:{type:ControlType.Array,control:{type:ControlType.ComponentInstance},hidden:props=>props.type!==\"layers\"},columns:{type:ControlType.Number,defaultValue:3,min:1,step:1,displayStepper:true},columnWidth:{type:ControlType.Enum,defaultValue:\"fill\",options:[\"fit\",\"fill\"],optionTitles:[\"Fit\",\"Fill\"],displaySegmentedControl:true,title:\"Item Width\"},align:{type:ControlType.Enum,defaultValue:\"center\",options:[\"start\",\"center\",\"end\"],optionTitles:[\"Left\",\"Center\",\"Right\"],displaySegmentedControl:true,hidden:props=>props.columnWidth!==\"fit\"},gapH:{type:ControlType.Number,defaultValue:10,min:0,hidden:props=>props.columns==1},gapV:{type:ControlType.Number,defaultValue:10,min:0},randomize:{type:ControlType.Boolean,defaultValue:false}});function Message({title,subtitle}){return /*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",width:\"100%\",placeContent:\"center\",placeItems:\"center\",flexDirection:\"column\",gap:16,backgroundColor:\"rgba(136, 85, 255, 0.1)\",borderRadius:6,border:\"1px dashed rgb(136, 85, 255)\",color:\"rgb(136, 85, 255)\",fontSize:16,padding:20,minHeight:200,textWrap:\"balance\"},children:[/*#__PURE__*/_jsx(\"p\",{style:{margin:0,fontWeight:600,textAlign:\"center\"},children:title}),/*#__PURE__*/_jsx(\"p\",{style:{margin:0,opacity:.7,lineHeight:1.5,textAlign:\"center\"},children:subtitle})]});}function shuffleArray(array){if(!array){return[];}for(let i=array.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));[array[i],array[j]]=[array[j],array[i]];}return array;}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MasonryLayout\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./MasonryLayout.map"],"mappings":"4aAS0K,SAAwB,EAAQ,CAAC,cAAY,UAAQ,EAAgB,MAAI,EAAY,WAAQ,EAAM,eAAY,EAAM,YAAU,SAAS,WAAS,QAAM,GAAG,EAAW,CAAC,EAAa,CAAC,IAAM,EAAS,EAAO,CAAE,EAAC,CAAM,CAAC,EAAQ,EAAW,CAAC,GAAS,EAAM,CACja,EAAgB,KAAQ,IAAc,GAAQ,GAAW,EAAK,CAAO,IAAI,CAAC,AAAG,GAAa,GAAQ,GAAW,EAA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