{"version":3,"file":"PerfectGrid.CS5zedFW.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/SWmNy8oofTQ84wBmP3Oi/EwPbGr8TKtIMhHpnLARP/PerfectGrid.js"],"sourcesContent":["/*\n * Perfect Grid by framer.today\n * v1.0.0\n *\n * hi@framer.today\n * _joerl on 𝕏\n *\n * Full terms here ↴\n * https://framer.today/license\n *\n */import{jsx as _jsx}from\"react/jsx-runtime\";import{useRef,useState,useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerDisableUnlink\n */export default function PerfectGrid(props){const containerRef=useRef(null);const[gridSize,setGridSize]=useState(null);useEffect(()=>{if(containerRef.current){const containerWidth=containerRef.current.offsetWidth;// Calculate the number of columns\nconst columns=Math.ceil(containerWidth/props.columnWidth);// Adjust the column width slightly to fit the rightmost line within the container\nconst adjustedColumnWidth=(containerWidth-1)/columns;setGridSize(adjustedColumnWidth);}},[props.columnWidth]);const dashArray=props.dashed?`${props.dashLength},${props.dashSpace}`:\"0\";const encodedSvg=encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' width='${gridSize}' height='${gridSize}' viewBox='0 0 ${gridSize} ${gridSize}'>`+`<path d='M 0 0.5 L ${gridSize} 0.5 M 0.5 0 L 0.5 ${gridSize}' stroke='${props.lineColor}' stroke-dasharray='${dashArray}' stroke-width='1' />`+`</svg>`);const containerStyle={height:\"100%\",width:\"100%\",...props.style,backgroundSize:`${gridSize}px ${gridSize}px`,backgroundRepeat:\"repeat\",backgroundImage:`url(\"data:image/svg+xml,${encodedSvg}\")`};return /*#__PURE__*/_jsx(motion.div,{ref:containerRef,style:containerStyle,initial:{opacity:0},animate:{opacity:1},transition:{duration:.2}});}PerfectGrid.defaultProps={lineColor:\"#777\",columnWidth:50,dashed:false,dashLength:5,dashSpace:5};addPropertyControls(PerfectGrid,{columnWidth:{type:ControlType.Number,title:\"Column Width\",defaultValue:50,min:10,max:200,step:1},dashed:{type:ControlType.Boolean,title:\"Dashed Lines\",defaultValue:false},dashLength:{type:ControlType.Number,title:\"Dash Length\",defaultValue:5,min:1,max:20,step:1,hidden:props=>!props.dashed},dashSpace:{type:ControlType.Number,title:\"Dash Space\",defaultValue:5,min:1,max:20,step:1,hidden:props=>!props.dashed},lineColor:{type:ControlType.Color,title:\"Line Color\",defaultValue:\"#000000\",description:`\n        \n        *from framer.today*\n [License](https://framer.today/license)\n    `}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PerfectGrid\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PerfectGrid.map"],"mappings":"kWAcG,SAAwB,EAAY,EAAM,CAAC,IAAM,EAAaA,EAAO,MAAW,CAAC,EAAS,EAAY,CAACC,EAAS,MAAM,MAAc,CAAC,GAAG,EAAa,QAAQ,CAAC,IAAM,EAAe,EAAa,QAAQ,YACrM,EAAQ,KAAK,KAAK,EAAe,EAAM,aACvC,GAAqB,EAAe,GAAG,EAAQ,EAAY,EAAsB,CAAC,EAAC,CAAC,EAAM,YAAY,EAAE,IAAM,EAAU,EAAM,OAAO,GAAG,EAAM,WAAW,GAAG,EAAM,YAAY,IAAU,EAAW,mBAAmB,kDAAkD,EAAS,YAAY,EAAS,iBAAiB,EAAS,GAAG,EAAS,uBAA0B,EAAS,qBAAqB,EAAS,YAAY,EAAM,UAAU,sBAAsB,EAAU,8BAAuC,EAAe,CAAC,OAAO,OAAO,MAAM,OAAO,GAAG,EAAM,MAAM,eAAe,GAAG,EAAS,KAAK,EAAS,IAAI,iBAAiB,SAAS,gBAAgB,2BAA2B,EAAW,IAAI,CAAC,O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