{"version":3,"file":"Counter.DuBR7flp.mjs","names":["useRef","_Fragment"],"sources":["https:/framerusercontent.com/modules/qoph9dv2QwHzXxK0zZbx/x1rYCt2pv84JfO6bOEk6/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":"8PAQG,SAAwB,EAAQ,CAAC,UAAQ,QAAM,eAAa,YAAU,YAAU,UAAQ,SAAO,aAAW,SAAO,aAAW,QAAM,aAAW,CAAC,IAA2B,EAAIA,EAAO,KAAK,CAAO,EAAoB,IAAU,GAAK,EAAa,EAAY,EAAY,EAAe,IAAY,OAAO,EAAoB,EAAa,CAAO,EAAY,EAAU,EAAY,CAAS,UAAkB,YAAU,CAAC,CAAO,EAAS,EAAU,EAAI,CAAC,KAAK,GAAK,OAAO,SAAS,CAAC,CAA6S,OAA5S,MAAc,CAAI,GAAU,EAAY,IAAI,IAAY,OAAO,EAAa,EAAoB,EAAI,CAAC,EAAY,EAAS,CAAC,CAAC,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