{"version":3,"file":"DecimalNumberInput.DneX5Frp.mjs","names":["useState","useRef","__esmMin","init_npm_react_18_3_1","_e","de","c","init_jsx_runtime","ce","useInView","init_framer_motion_DhsWWWsN","init_framer_DKgW_P28","addPropertyControls","ControlType","DecimalNumberInput","props","displayValue","setDisplayValue","initialValue","animationRef","startTimeRef","startValueRef","containerRef","isInView","enableAnimation","targetValue","animate","elapsed","currentTime","progress","animationDuration","easeOutQuart","currentValue","isFixedWidth","font","textColor","init_DecimalNumberInput"],"sources":["https:/framerusercontent.com/modules/CIZwBJ1t3xod8TpKZHRy/Zxug11ci6xHyagHqmoyy/DecimalNumberInput.js"],"sourcesContent":["// Component that adds a number with 1 decimal place\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{useInView}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function DecimalNumberInput(props){const{initialValue,targetValue,backgroundColor,textColor,font,borderRadius,animationDuration,enableAnimation}=props;const[displayValue,setDisplayValue]=useState(initialValue);const animationRef=useRef();const startTimeRef=useRef();const startValueRef=useRef(initialValue);const containerRef=useRef(null);const isInView=useInView(containerRef,{once:true});useEffect(()=>{if(!enableAnimation||!isInView){setDisplayValue(initialValue);return;}if(displayValue===targetValue)return;startValueRef.current=initialValue;startTimeRef.current=performance.now();const animate=currentTime=>{if(!startTimeRef.current)return;const elapsed=currentTime-startTimeRef.current;const progress=Math.min(elapsed/animationDuration,1);// Easing function for smooth animation\nconst easeOutQuart=1-Math.pow(1-progress,4);const currentValue=startValueRef.current+(targetValue-startValueRef.current)*easeOutQuart;setDisplayValue(Math.round(currentValue*10)/10);if(progress<1){animationRef.current=requestAnimationFrame(animate);}};animationRef.current=requestAnimationFrame(animate);return()=>{if(animationRef.current){cancelAnimationFrame(animationRef.current);}};},[isInView,targetValue,enableAnimation,animationDuration,initialValue]);const isFixedWidth=props?.style&&props.style.width===\"100%\";return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...props.style,position:\"relative\",...isFixedWidth?{...props?.style}:{minWidth:\"max-content\"},display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:/*#__PURE__*/_jsx(\"div\",{style:{...font,color:textColor,fontSize:\"32px\",textAlign:\"center\"},children:displayValue.toFixed(1).replace(\".\",\",\")})});}addPropertyControls(DecimalNumberInput,{initialValue:{type:ControlType.Number,title:\"Initial Value\",defaultValue:90,step:.01},targetValue:{type:ControlType.Number,title:\"Target Value\",defaultValue:100,step:.01},enableAnimation:{type:ControlType.Boolean,title:\"Enable Animation\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},animationDuration:{type:ControlType.Number,title:\"Animation Duration\",defaultValue:800,min:100,max:3e3,step:100,unit:\"ms\",hidden:({enableAnimation})=>!enableAnimation},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Number Font\",defaultValue:{fontSize:\"32px\",variant:\"Bold\",letterSpacing:\"-0.02em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DecimalNumberInput\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DecimalNumberInput.map"],"mappings":"A,yOAIG,SAAwBc,EAAmB,EAAM,CAAC,GAAK,CAAC,eAAa,cAAY,kBAAgB,YAAU,OAAK,eAAa,oBAAkB,mBAAiBC,EAAW,CAACC,EAAaC,GAAiBjB,EAASkB,CAAY,EAAQC,EAAalB,EAAO,EAAQmB,EAAanB,EAAO,EAAQoB,EAAcpB,EAAOiB,CAAY,EAAQI,EAAarB,EAAO,IAAI,EAAQsB,EAASd,EA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