{"version":3,"file":"DecimalNumberInput.CQJ2WDIp.mjs","names":["useState","useRef"],"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":"yOAIG,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,eAAa,cAAY,kBAAgB,YAAU,OAAK,eAAa,oBAAkB,mBAAiB,EAAW,CAAC,EAAa,GAAiBA,EAAS,CAAY,EAAQ,EAAaC,EAAO,EAAQ,EAAaA,EAAO,EAAQ,EAAcA,EAAO,CAAY,EAAQ,EAAaA,EAAO,IAAI,EAAQ,EAAS,EAAU,EAAa,CAAC,KAAK,EAAI,CAAC,EAAE,MAAc,CAAC,GAAG,CAAC,GAAiB,CAAC,EAAS,CAAC,EAAgB,CAAY,EAAE,MAAO,CAAC,GAAG,IAAe,EAAY,OAAO,EAAc,QAAQ,EAAa,EAAa,QAAQ,YAAY,IAAI,EAAE,IAAM,EAAQ,GAAa,CAAC,GAAG,CAAC,EAAa,QAAQ,OAAO,IAAM,EAAQ,EAAY,EA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