{"version":3,"file":"TextCounter.qQKgOhbc.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/6YOVDz1LjDskTSIchrxf/hp2VzSudM1ciaRD97QYT/TextCounter.js"],"sourcesContent":["// Text counter component with Inter Medium font, white color, 14px size, 1.2 line height\nimport{jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function TextCounter(props){const{targetNumber,duration,prefix,suffix,textColor,font}=props;const[count,setCount]=useState(0);useEffect(()=>{let startTime=null;let animationFrame;const animate=timestamp=>{if(!startTime)startTime=timestamp;const progress=Math.min((timestamp-startTime)/duration,1);const easeOutQuart=1-Math.pow(1-progress,4);const currentCount=Math.floor(easeOutQuart*targetNumber);startTransition(()=>setCount(currentCount));if(progress<1){animationFrame=requestAnimationFrame(animate);}};animationFrame=requestAnimationFrame(animate);return()=>{if(animationFrame){cancelAnimationFrame(animationFrame);}};},[targetNumber,duration]);return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"max-content\",minWidth:\"max-content\",color:textColor,...font},children:[prefix,count,suffix]});}addPropertyControls(TextCounter,{targetNumber:{type:ControlType.Number,title:\"Target Number\",defaultValue:100,min:0,step:1},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:2e3,min:100,max:1e4,step:100,unit:\"ms\"},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\",placeholder:\"$\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\",placeholder:\"+\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#FFFFFF\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"14px\",variant:\"Medium\",lineHeight:\"1.2em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextCounter\",\"slots\":[],\"annotations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