{"version":3,"file":"Counter.CIdBlmOp.mjs","names":["React.useState","React.useRef"],"sources":["https:/framerusercontent.com/modules/GbsL9kmDxPLicZR1fGj3/zk0KEnC20AB0ISl3t538/Counter.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{animate,useMotionValue,useInView}from\"framer-motion\";import{ControlType}from\"framer\";/**\n * Componente Counter che anima un valore da start a end in duration secondi.\n * L'animazione viene avviata SOLO quando il componente è visibile.\n * Combina le proprietà font, fontColor e style per gestire lo stile del testo.\n */export function Counter({start,end,duration,style,font,fontColor}){const motionValue=useMotionValue(start);const[value,setValue]=React.useState(start);const ref=React.useRef(null);const isInView=useInView(ref,{once:true});React.useEffect(()=>{if(isInView){const controls=animate(motionValue,end,{duration:duration,onUpdate:latest=>setValue(latest)});return()=>controls.stop();}},[isInView,end,duration,motionValue]);return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{...font,color:fontColor,...style},children:Math.round(value).toLocaleString(\"it-IT\")});}Counter.defaultProps={start:1,end:10,duration:2,style:{},font:{fontSize:14,lineHeight:1.4,fontFamily:\"sans-serif\"},fontColor:\"#000\"};Counter.propertyControls={start:{type:ControlType.Number,title:\"Start\"},end:{type:ControlType.Number,title:\"End\"},duration:{type:ControlType.Number,title:\"Duration\",min:.1,step:.1},font:{type:ControlType.Font,controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:14,lineHeight:1.4,fontFamily:\"sans-serif\"}},fontColor:{type:ControlType.Color,title:\"Font Color\",defaultValue:\"#000\"},style:{type:ControlType.Object,title:\"Style\"}};\nexport const __FramerMetadata__ = {\"exports\":{\"CounterProps\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"Counter\":{\"type\":\"reactComponent\",\"name\":\"Counter\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Counter.map"],"mappings":"6WAIG,SAAg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