{"version":3,"file":"AnimatedNumber.CSS47U3P.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/EcxzDHNTOVOprnS81VXz/bRtQ2y1MPdtWu2E00X7E/AnimatedNumber.js"],"sourcesContent":["// Animated Number Counter with configurable speed, font, and color\nimport{jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * AnimatedNumber\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function AnimatedNumber(props){const{target,speed,font,fontSize,color,prefix=\"\",suffix=\"\",useThousandsSeparator=false,style}=props;const[value,setValue]=useState(0);const raf=useRef(null);const isStatic=useIsStaticRenderer();useEffect(()=>{if(isStatic){startTransition(()=>setValue(target));return;}let start=null;let from=value;let to=target;let duration=Math.max(100,speed);if(from===to)return;function animate(ts){if(start===null)start=ts;const progress=Math.min(1,(ts-start)/duration);const current=from+(to-from)*progress;startTransition(()=>setValue(Math.round(current)));if(progress<1){raf.current=requestAnimationFrame(animate);}else{startTransition(()=>setValue(to));}}raf.current=requestAnimationFrame(animate);return()=>{if(raf.current)cancelAnimationFrame(raf.current);};// eslint-disable-next-line\n},[target,speed]);// Format number with dot as thousands separator if enabled\nconst formattedValue=useThousandsSeparator?value.toLocaleString(\"de-DE\"):value;return /*#__PURE__*/_jsxs(\"div\",{style:{...style,...font,fontSize:fontSize?fontSize:font?.fontSize,color,width:\"max-content\",minWidth:\"max-content\",whiteSpace:\"nowrap\",display:\"block\",textAlign:font?.textAlign||\"left\",overflow:\"visible\"},children:[prefix,formattedValue,suffix]});}addPropertyControls(AnimatedNumber,{target:{type:ControlType.Number,title:\"Target\",defaultValue:100,min:0,max:1e6,step:1},speed:{type:ControlType.Number,title:\"Speed (ms)\",defaultValue:1200,min:100,max:1e4,step:50,unit:\"ms\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"40px\",variant:\"Bold\",letterSpacing:\"-0.04em\",lineHeight:\"1em\"}},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:40,min:8,max:200,step:1,unit:\"px\"},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\",placeholder:\"e.g. +\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\",placeholder:\"e.g. %\"},useThousandsSeparator:{type:ControlType.Boolean,title:\"Thousands Dot\",defaultValue:false,enabledTitle:\"1.000\",disabledTitle:\"1000\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AnimatedNumber\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AnimatedNumber.map"],"mappings":"uMAMG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,SAAO,QAAM,OAAK,WAAS,QAAM,SAAO,GAAG,SAAO,GAAG,wBAAsB,GAAM,SAAO,EAAW,CAAC,EAAM,GAAUA,EAAS,EAAE,CAAO,EAAIC,EAAO,KAAK,CAAO,EAAS,GAAqB,CAAC,MAAc,CAAC,GAAG,EAAS,CAAC,MAAoB,EAAS,EAAO,CAAC,CAAC,OAAQ,IAAI,EAAM,KAAS,EAAK,EAAU,EAAG,EAAW,EAAS,KAAK,IAAI,IAAI,EAAM,CAAC,GAAG,IAAO,EAAG,OAAO,SAAS,EAAQ,EAAG,CAAI,IAAQ,OAAK,EAAM,GAAG,IAAM,EAAS,KAAK,IAAI,GAAG,EAAG,GAAO,EAAS,CAAO,EAAQ,GAAM,EAAG,GAAM,EAAS,MAAoB,EAAS,KAAK,MAAM,EAAQ,CAAC,CAAC,CAAI,EAAS,EAAG,EAAI,QAAQ,sBAAsB,EAAQ,CAAO,M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