{"version":3,"file":"Number_Counter.Dd015VB8.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/V0AUrF21rxqxsicqp0kD/64NqTl1msUOdOzwfdxYC/Number_Counter.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{motion,useMotionValue,useSpring,useTransform}from\"framer-motion\";import{useEffect,useState}from\"react\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 80\n */export default function NumberCounter(props){const{from=0,to=100,duration=2,decimalPoints=0,font={},color=\"#000000\",delay=100}=props;const[hasStarted,setHasStarted]=useState(false);// Create motion value for the counter\nconst motionValue=useMotionValue(from);// Spring animation configuration for smooth counting\nconst spring=useSpring(motionValue,{duration:duration*1e3,bounce:0,restDelta:.001});// Transform the motion value to formatted display value\nconst displayValue=useTransform(spring,latest=>{const value=Math.round(latest*Math.pow(10,decimalPoints))/Math.pow(10,decimalPoints);return decimalPoints>0?value.toFixed(decimalPoints):Math.round(value).toString();});// Handle animation trigger - start automatically after component mounts\nuseEffect(()=>{if(!hasStarted){// Reset to 'from' value first\nmotionValue.set(from);// Configurable delay before animation starts\nconst timer=setTimeout(()=>{motionValue.set(to);setHasStarted(true);},delay);return()=>clearTimeout(timer);}},[hasStarted,from,to,motionValue,delay]);// Reset animation when props change\nuseEffect(()=>{setHasStarted(false);motionValue.set(from);},[from,to,duration,delay,motionValue]);// Show static value in canvas mode\nconst isCanvas=RenderTarget.current()===RenderTarget.canvas;if(isCanvas){const staticValue=decimalPoints>0?to.toFixed(decimalPoints):to.toString();return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",color:color,...font,...props.style},children:staticValue});}return /*#__PURE__*/_jsx(motion.div,{style:{width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",color:color,userSelect:\"none\",...font,...props.style},initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.3,ease:\"easeOut\"},children:/*#__PURE__*/_jsx(motion.span,{style:{display:\"inline-block\",fontVariantNumeric:\"tabular-nums\"},children:displayValue})});}NumberCounter.displayName=\"Number Counter\";addPropertyControls(NumberCounter,{from:{type:ControlType.Number,title:\"From\",defaultValue:0,step:1,displayStepper:true},to:{type:ControlType.Number,title:\"To\",defaultValue:100,step:1,displayStepper:true},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:2,min:.1,max:10,step:.1,displayStepper:true,unit:\"s\"},decimalPoints:{type:ControlType.Number,title:\"Decimal Points\",defaultValue:0,min:0,max:5,step:1,displayStepper:true},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultValue:{fontSize:48,fontWeight:600,fontFamily:\"Inter, system-ui, sans-serif\",lineHeight:1.2,textAlign:\"center\"}},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"},delay:{type:ControlType.Number,title:\"Delay\",defaultValue:100,min:0,max:1e4,step:100,displayStepper:true,unit:\"ms\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"NumberCounter\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"200\",\"framerIntrinsicHeight\":\"80\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Number_Counter.map"],"mappings":"8PAKG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,OAAK,EAAE,KAAG,IAAI,WAAS,EAAE,gBAAc,EAAE,OAAK,CAAC,EAAE,QAAM,UAAU,QAAM,KAAK,EAAW,CAAC,EAAW,GAAeA,EAAS,EAAK,EAChL,EAAY,EAAe,CAAI,EAE/B,EAAa,EADN,EAAU,EAAY,CAAC,SAAS,EAAS,IAA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