{"version":3,"file":"Counter_1.CDSM-Rnl.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/9Mdru14WdnZtqM1LQYCr/kyEAItATn8P3HaHMfrt9/Counter_1.js"],"sourcesContent":["// Welcome to Code in Framer\n// Get Started: https://www.framer.com/developers/\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{useInView,useMotionValue,useSpring}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function Counter({decimal,value,decimalValue,direction,stiffness,damping,prefix,prefixText,suffix,suffixText,color,fontStyle,numberFontSize,suffixFontSize,suffixFontColor,preffixFontSize}){const initialValue=0;const ref=useRef(null);const updatedDecimalValue=decimal===true?decimalValue:value;const motionValue=useMotionValue(direction===\"down\"?updatedDecimalValue:initialValue);const springValue=useSpring(motionValue,{damping:damping,stiffness:stiffness});const isInView=useInView(ref,{once:true,amount:.3});useEffect(()=>{if(isInView){motionValue.set(direction===\"down\"?initialValue:updatedDecimalValue);}},[motionValue,isInView]);useEffect(()=>springValue.on(\"change\",latest=>{if(ref.current){ref.current.textContent=Intl.NumberFormat(\"en-US\").format(Number(latest.toFixed(decimal===true?2:0)));}}),[springValue]);return /*#__PURE__*/_jsxs(\"div\",{style:{alignItems:\"center\",display:\"flex\",justifyContent:\"center\",width:\"100%\"},children:[prefix?/*#__PURE__*/_jsx(\"span\",{style:{...fontStyle,color:color,fontSize:preffixFontSize},children:prefixText}):null,/*#__PURE__*/_jsx(\"span\",{ref:ref,style:{...fontStyle,color:color,fontSize:numberFontSize},children:initialValue}),suffix?/*#__PURE__*/_jsx(\"span\",{style:{...fontStyle,color:suffixFontColor,fontSize:suffixFontSize},children:suffixText}):null]});}addPropertyControls(Counter,{decimal:{title:\"Decimal\",type:ControlType.Boolean,enabledTitle:\"Yes\",disabledTitle:\"No\",defaultValue:false},value:{title:\"Value\",type:ControlType.Number,min:0,max:5e3,defaultValue:100,hidden(props){return props.decimal===true;}},decimalValue:{title:\"Value\",type:ControlType.Number,min:0,max:1e3,step:.01,defaultValue:100,hidden(props){return props.decimal===false;}},prefix:{title:\"Prefix\",type:ControlType.Boolean,enabledTitle:\"Yes\",disabledTitle:\"No\",defaultValue:false},prefixText:{title:\"Prefix Value\",type:ControlType.String,defaultValue:\"\",hidden(props){return props.prefix===false;}},suffix:{title:\"Suffix\",type:ControlType.Boolean,enabledTitle:\"Yes\",disabledTitle:\"No\",defaultValue:false},suffixText:{title:\"Suffix Value\",type:ControlType.String,defaultValue:\"\",hidden(props){return props.suffix===false;}},direction:{title:\"Direction\",type:ControlType.Enum,options:[\"up\",\"down\"],defaultValue:\"up\"},stiffness:{title:\"Stiffness\",type:ControlType.Number,min:1,max:1e3,defaultValue:300},damping:{title:\"Damping\",type:ControlType.Number,min:0,max:100,defaultValue:100},color:{title:\"Color\",type:ControlType.Color,defaultValue:\"#000000\"},suffixFontColor:{title:\"Suffic Color\",type:ControlType.Color,defaultValue:\"#0E1B2B\"},fontStyle:{title:\"Font Style\",type:ControlType.Font,controls:\"extended\",defaultFontType:\"sans-serif\"},numberFontSize:{title:\"Number Size\",type:ControlType.Number,min:8,max:200,defaultValue:48,unit:\"px\"},suffixFontSize:{title:\"Suffix Size\",type:ControlType.Number,min:8,max:200,defaultValue:24,unit:\"px\",hidden(props){return props.suffix===false;}},preffixFontSize:{title:\"Preffix Size\",type:ControlType.Number,min:8,max:200,defaultValue:24,unit:\"px\",hidden(props){return props.suffix===false;}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Counter\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Counter_1.map"],"mappings":"uPAKG,SAAwB,EAAQ,CAAC,UAAQ,QAA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