{"version":3,"file":"ShimmerGrid.tgoFSa-e.mjs","names":[],"sources":["https:/framerusercontent.com/modules/nu87fOTB9vD6UDCg4MIr/SiSTlBBxt0hziiyCXpql/ShimmerGrid.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";var Pattern;(function(Pattern){Pattern[\"Grid\"]=\"grid\";Pattern[\"Checkerboard\"]=\"checkerboard\";Pattern[\"HorizontalLines\"]=\"horizontalLines\";Pattern[\"VerticalLines\"]=\"verticalLines\";Pattern[\"DiagonalLines\"]=\"diagonalLines\";Pattern[\"Dots\"]=\"dots\";Pattern[\"Triangles\"]=\"triangles\";Pattern[\"Custom\"]=\"custom\";})(Pattern||(Pattern={}));const IMAGE_SIZING_MAP={fill:\"cover\",fit:\"contain\",stretch:\"100% 100%\",tile:\"auto\"};const POSITION_MAP={topLeft:\"0 0\",topCenter:\"50% 0\",topRight:\"100% 0\",left:\"0 50%\",center:\"50% 50%\",right:\"100% 50%\",bottomLeft:\"0 100%\",bottomCenter:\"50% 100%\",bottomRight:\"100% 100%\"};function getSideLength(hypotenuseLength){// Check if input is a valid number\nif(typeof hypotenuseLength!==\"number\"||isNaN(hypotenuseLength)||hypotenuseLength<=0){return hypotenuseLength;}// Calculate the side length using the Pythagorean theorem\n// In a right isosceles triangle: side² + side² = hypotenuse²\n// So, side² = hypotenuse² / 2\nconst sideLength=Math.sqrt(Math.pow(hypotenuseLength,2)/2);// Round the result to 2 decimal places\nreturn Number(sideLength.toFixed(2));}/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n * @framerDisableUnlink\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 400\n */export default function ShimmerGrid({color=\"rgba(153, 153, 153, 0.5)\",patternPreset=\"grid\",flip=false,lineWidth=2,customPatternImage,customPatternSizing=\"tile\",tileSize=50,customPatternMode=\"alpha\",customPatternPosition=\"center\",dotSize=10,radius=\"0px\",style}){const isCanvas=RenderTarget.current()===RenderTarget.canvas;const isCustom=patternPreset===\"custom\";const bgPosition=isCustom&&customPatternSizing!==\"stretch\"?POSITION_MAP[customPatternPosition]:POSITION_MAP.center;let bgImage=\"\";let bgSize=`${tileSize}px ${tileSize}px`;let bgRepeat=\"repeat\";switch(patternPreset){case\"grid\":bgImage=`repeating-conic-gradient(at ${lineWidth}px ${lineWidth}px, [color] 0deg 90deg, transparent 90deg 180deg, [color] 180deg 360deg)`;break;case\"checkerboard\":bgImage=flip?`repeating-conic-gradient([color] 0% 25%, transparent 0% 50%)`:`repeating-conic-gradient(transparent 0% 25%, [color] 0% 50%)`;break;case\"horizontalLines\":bgImage=`linear-gradient(to top, [color] ${lineWidth}px, transparent ${lineWidth}px)`;break;case\"verticalLines\":bgImage=`linear-gradient(to left, [color] ${lineWidth}px, transparent ${lineWidth}px)`;break;case\"diagonalLines\":const w=lineWidth/2;const sideLength=getSideLength(tileSize*2);bgImage=`linear-gradient(to top ${flip?\"left\":\"right\"}, [color] ${w}px, transparent ${w}px, transparent calc(50% - ${w}px), [color] calc(50% - ${w}px), [color] calc(50% + ${w}px), transparent calc(50% + ${w}px), transparent calc(100% - ${w}px), [color] calc(100% - ${w}px), [color] 100%)`;bgSize=`${sideLength}px ${sideLength}px`;break;case\"dots\":bgImage=`radial-gradient([color] ${dotSize/2-.4}px, transparent ${dotSize/2+.4}px)`;break;case\"triangles\":bgImage=`linear-gradient(${flip?-45:45}deg, transparent calc(50% - 0.1px), [color] calc(50% + 0.1px))`;break;case\"custom\":bgImage=`url(\"${customPatternImage?.src}\")`;if(customPatternSizing!==\"tile\"){bgRepeat=\"no-repeat\";bgSize=IMAGE_SIZING_MAP[customPatternSizing];}break;}return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",borderRadius:radius,overflow:\"hidden\",backgroundImage:isCustom?\"\":bgImage.replace(/\\[color\\]/g,color),backgroundSize:bgSize,backgroundPosition:bgPosition,backgroundRepeat:bgRepeat,...style},children:isCustom&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",inset:0,backgroundColor:color,maskImage:bgImage,maskSize:bgSize,maskPosition:bgPosition,maskRepeat:bgRepeat,maskMode:customPatternMode}})});}ShimmerGrid.displayName=\"Shimmer Grid\";addPropertyControls(ShimmerGrid,{color:{type:ControlType.Color,title:\"Color\",defaultValue:\"rgba(153, 153, 153, 0.5)\"},patternPreset:{type:ControlType.Enum,title:\"Pattern\",defaultValue:\"grid\",options:Object.values(Pattern),optionTitles:[\"Grid\",\"Checkerboard\",\"Horizontal Lines\",\"Vertical Lines\",\"Diagonal Lines\",\"Dots\",\"Triangles\",\"Custom\"]},customPatternImage:{type:ControlType.ResponsiveImage,title:\"Image\",hidden:props=>props.patternPreset!==\"custom\"},customPatternSizing:{type:ControlType.Enum,title:\"Sizing\",defaultValue:\"tile\",options:[\"fill\",\"fit\",\"stretch\",\"tile\"],optionTitles:[\"Fill\",\"Fit\",\"Stretch\",\"Tile\"],hidden:props=>props.patternPreset!==\"custom\"},customPatternPosition:{type:ControlType.Enum,title:\"Position\",defaultValue:\"center\",options:[\"topLeft\",\"topCenter\",\"topRight\",\"left\",\"center\",\"right\",\"bottomLeft\",\"bottomCenter\",\"bottomRight\"],optionTitles:[\"Top Left\",\"Top Center\",\"Top Right\",\"Left\",\"Center\",\"Right\",\"Bottom Left\",\"Bottom Center\",\"Bottom Right\"],hidden:props=>props.patternPreset!==\"custom\"||props.customPatternSizing===\"stretch\"},customPatternMode:{type:ControlType.Enum,title:\"Mode\",defaultValue:\"alpha\",options:[\"alpha\",\"luminance\"],optionTitles:[\"Alpha\",\"Luminance\"],hidden:props=>props.patternPreset!==\"custom\"},flip:{type:ControlType.Boolean,title:\"Flip\",defaultValue:false,hidden:props=>props.patternPreset!==\"checkerboard\"&&props.patternPreset!==\"triangles\"&&props.patternPreset!==\"diagonalLines\"},lineWidth:{type:ControlType.Number,title:\"Line Width\",defaultValue:2,min:1,step:1,displayStepper:true,hidden:props=>props.patternPreset!==\"horizontalLines\"&&props.patternPreset!==\"verticalLines\"&&props.patternPreset!==\"diagonalLines\"&&props.patternPreset!==\"grid\"},tileSize:{type:ControlType.Number,title:\"Tile Size\",defaultValue:50,min:1,step:1,hidden:props=>props.patternPreset===\"custom\"&&props.customPatternSizing!==\"tile\"},dotSize:{type:ControlType.Number,title:\"Dot Size\",defaultValue:10,min:1,step:1,displayStepper:true,hidden:props=>props.patternPreset!==\"dots\"},radius:{type:ControlType.BorderRadius,title:\"Border Radius\",defaultValue:\"0px\",description:\"More components at [Framer University](https://frameruni.link/cc).\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ShimmerGrid\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"400\",\"framerDisableUnlink\":\"* @framerIntrinsicWidth 400\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ShimmerGrid.map"],"mappings":"mKAAmsB,SAAS,EAAc,EAAiB,CAC3uB,GAAG,OAAO,GAAmB,UAAU,MAAM,EAAiB,EAAE,GAAkB,EAAG,OAAO,EAG5F,IAAM,EAAW,KAAK,KAAc,GAAiB,EAAG,EAAE,CAC1D,OAAO,OAAO,EAAW,QAAQ,EAAE,CAAC,CAMjC,SAAwB,EAAY,CAAC,QAAM,2BAA2B,gBAAc,OAAO,OAAK,GAAM,YAAU,EAAE,qBAAmB,sBAAoB,OAAO,WAAS,GAAG,oBAAkB,QAAQ,wBAAsB,SAAS,UAAQ,GAAG,SAAO,MAAM,SAAO,CAAgB,EAAa,SAAS,CAAG,EAAa,OAAO,IAAM,EAAS,IAAgB,SAAe,EAAW,GAAU,IAAsB,UAAU,EAAa,GAAuB,EAAa,OAAW,EAAQ,GAAO,EAAO,GAAG,EAAS,KAAK,EAAS,IAAQ,EAAS,SAAS,OAAO,EAAP,CAAsB,IAAI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