{"version":3,"file":"Counter.douXm01B.mjs","names":[],"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,SAAgB,EAAQ,CAAC,Q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