{"version":3,"file":"Counter.OL29icRv.mjs","names":["useRef","_Fragment"],"sources":["https:/framerusercontent.com/modules/tBu2DzBRkRvbCIH0HAij/eo0x9eajAyQgR5GpK3HG/Counter.js"],"sourcesContent":["// Welcome to Code in Framer\n// Get Started: https://www.framer.com/developers/\nimport{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{useInView,useMotionValue,useSpring}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";/**\n * These annotations control how your component sizes\n * Learn more: https://www.framer.com/developers/#code-components-auto-sizing\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function Counter({decimal,value,decimalValue,direction,stiffness,damping,prefix,prefixText,suffix,suffixText,color,fontStyle}){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,margin:\"-100px\"});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(latest.toFixed(decimal===true?2:0));}}),[springValue]);return /*#__PURE__*/_jsxs(_Fragment,{children:[prefix?/*#__PURE__*/_jsx(\"span\",{style:{...fontStyle,color:color},children:prefixText}):null,/*#__PURE__*/_jsx(\"span\",{ref:ref,style:{...fontStyle,color:color},children:initialValue}),suffix?/*#__PURE__*/_jsx(\"span\",{style:{...fontStyle,color:color},children:suffixText}):null]});}Counter.defaultProps={decimal:false,value:100,decimalValue:100,direction:\"up\",stiffness:300,damping:100,prefix:false,prefixText:\"\",suffix:false,suffixText:\"\",color:\"#000000\",fontStyle:\"\"};addPropertyControls(Counter,{decimal:{title:\"Decimal\",type:ControlType.Boolean,enabledTitle:\"Yes\",disabledTitle:\"No\"},value:{title:\"Value\",type:ControlType.Number,min:0,max:1e3,hidden(props){return props.decimal===true;}},decimalValue:{title:\"Value\",type:ControlType.Number,min:0,max:1e3,step:.01,hidden(props){return props.decimal===false;}},prefix:{title:\"Prefix\",type:ControlType.Boolean,enabledTitle:\"Yes\",disabledTitle:\"No\"},prefixText:{title:\"Prefix Value\",type:ControlType.String,hidden(props){return props.prefix===false;}},suffix:{title:\"Suffix\",type:ControlType.Boolean,enabledTitle:\"Yes\",disabledTitle:\"No\"},suffixText:{title:\"Suffix Value\",type:ControlType.String,hidden(props){return props.suffix===false;}},direction:{title:\"Direction\",type:ControlType.Enum,options:[\"up\",\"down\"]},stiffness:{title:\"Stiffness\",type:ControlType.Number,min:1,max:1e3},damping:{title:\"Damping\",type:ControlType.Number,min:0,max:100},color:{title:\"Color\",type:ControlType.Color},fontStyle:{title:\"Font Style\",type:\"font\",controls:\"extended\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Counter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Counter.map"],"mappings":"oPAQG,SAAwB,EAAQ,CAAC,UAAQ,QAAM,eAAa,YAAU,YAAU,UAAQ,SAAO,aAAW,SAAO,aAAW,QAAM,aAAW,CAAC,IAA2B,EAAIA,EAAO,IAAI,EAAQ,EAAoB,IAAU,GAAK,EAAa,EAAY,EAAY,EAAe,IAAY,OAAO,EAAoB,CAAY,EAAQ,EAAY,EAAU,EAAY,CAAS,UAAkB,WAAS,CAAC,EAAQ,EAAS,EAAU,EAAI,CAAC,KAAK,GAAK,OAAO,QAAQ,CAAC,EAA8S,OAA5S,MAAc,CAAI,GAAU,EAAY,IAAI,IAAY,OAAO,EAAa,CAAmB,CAAG,EAAE,CAAC,EAAY,CAAQ,C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