{"version":3,"file":"Counter.Do3W2_0F.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/0yd5Y0fqNDmGFCmWnnzg/ElO5TIWyDbOuMAtgUrE4/Counter.js"],"sourcesContent":["// Counting numbers component that animates when in view with editable properties\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useRef,startTransition}from\"react\";import{motion,useInView,useMotionValue,useSpring}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */function CountingNumbers(props){const{startValue,endValue,duration,prefix,suffix,textColor,backgroundColor,font,showBackground,borderRadius,padding}=props;const ref=useRef(null);const isInView=useInView(ref,{once:true,margin:\"-10px\"});const motionValue=useMotionValue(startValue);const springValue=useSpring(motionValue,{duration:duration*1e3});const[displayValue,setDisplayValue]=useState(startValue);useEffect(()=>{if(isInView){startTransition(()=>{motionValue.set(endValue);});}},[isInView,endValue,motionValue]);useEffect(()=>{const unsubscribe=springValue.on(\"change\",latest=>{startTransition(()=>{setDisplayValue(Math.round(latest));});});return unsubscribe;},[springValue]);return /*#__PURE__*/_jsxs(motion.div,{ref:ref,style:{display:\"flex\",alignItems:\"center\",justifyContent:\"center\",color:textColor,backgroundColor:showBackground?backgroundColor:\"transparent\",borderRadius:showBackground?borderRadius:0,padding:showBackground?padding:0,...font,minWidth:\"max-content\",textAlign:\"center\",position:\"relative\"},children:[prefix&&/*#__PURE__*/_jsx(\"span\",{style:{position:\"absolute\",right:\"100%\",whiteSpace:\"pre\"},children:prefix}),/*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-block\",minWidth:1,textAlign:\"center\"},children:displayValue}),suffix&&/*#__PURE__*/_jsx(\"span\",{style:{position:\"absolute\",left:\"100%\",whiteSpace:\"pre\"},children:suffix})]});}export default CountingNumbers;addPropertyControls(CountingNumbers,{startValue:{type:ControlType.Number,title:\"Start Value\",defaultValue:0,step:1},endValue:{type:ControlType.Number,title:\"End Value\",defaultValue:100,step:1},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:2,min:.1,max:10,step:.1,unit:\"s\"},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\",placeholder:\"$\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\",placeholder:\"%\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},showBackground:{type:ControlType.Boolean,title:\"Show Background\",defaultValue:false,enabledTitle:\"Show\",disabledTitle:\"Hide\"},backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"#F5F5F5\",hidden:({showBackground})=>!showBackground},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:50,unit:\"px\",hidden:({showBackground})=>!showBackground},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:16,min:0,max:50,unit:\"px\",hidden:({showBackground})=>!showBackground},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"32px\",variant:\"Bold\",letterSpacing:\"-0.03em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CountingNumbers\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Counter.map"],"mappings":"4QAIG,SAAS,EAAgB,EAAM,CAAC,GAAK,CAAC,aAAW,WAAS,WAAS,SAAO,SAAO,YAAU,kBAAgB,OAAK,iBAAe,eAAa,WAAS,EAAY,EAAIA,EAAO,KAAK,CAAO,EAAS,EAAU,EAAI,CAAC,KAAK,GAAK,OAAO,QAAQ,CAAC,CAAO,EAAY,EAAe,EAAW,CAAO,EAAY,EAAU,EAAY,CAAC,SAAS,EAAS,IAAI,CAAC,CAAM,CAAC,EAAa,GAAiBC,E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