{"version":3,"file":"Counter.DITFbjSP.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/dsrMzBVXX4HLKmkmDTJ5/vvugFDHxhe3ULsDJyYFJ/Counter.js"],"sourcesContent":["// Simple counter with customizable text to the right\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{useInView}from\"framer-motion\";import{useRef}from\"react\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function Counter(props){const{startValue,endValue,duration,autoStart,rightText,numberColor,textColor,numberFont,textFont,gap}=props;const[currentValue,setCurrentValue]=useState(startValue);const ref=useRef(null);const isInView=useInView(ref,{once:true});useEffect(()=>{if(!autoStart||!isInView)return;const totalSteps=Math.abs(endValue-startValue);const stepDuration=duration/totalSteps;const increment=endValue>startValue?1:-1;let current=startValue;const interval=setInterval(()=>{current+=increment;startTransition(()=>setCurrentValue(current));if(current===endValue){clearInterval(interval);}},stepDuration);return()=>clearInterval(interval);},[startValue,endValue,duration,autoStart,isInView]);const isFixedWidth=props?.style&&props.style.width===\"100%\";return /*#__PURE__*/_jsxs(\"div\",{ref:ref,style:{...props.style,display:\"flex\",alignItems:\"baseline\",gap:`${gap}px`,...isFixedWidth?{}:{width:\"max-content\"},position:\"relative\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{color:numberColor,...numberFont},children:currentValue}),/*#__PURE__*/_jsx(\"span\",{style:{color:textColor,...textFont},children:rightText})]});}addPropertyControls(Counter,{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:2e3,min:100,max:1e4,step:100,unit:\"ms\"},autoStart:{type:ControlType.Boolean,title:\"Auto Start\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},rightText:{type:ControlType.String,title:\"Right Text\",defaultValue:\"items\"},numberColor:{type:ControlType.Color,title:\"Number Color\",defaultValue:\"#000000\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},numberFont:{type:ControlType.Font,title:\"Number Font\",defaultValue:{fontSize:\"32px\",variant:\"Bold\",letterSpacing:\"-0.03em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},textFont:{type:ControlType.Font,title:\"Text Font\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:8,min:0,max:50,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Counter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Counter.map"],"mappings":"kPAIG,SAAwB,EAAQ,EAAM,CAAC,GAAK,CAAC,aAAW,WAAS,WAAS,YAAU,YAAU,cAAY,YAAU,aAAW,WAAS,OAAK,EAAW,CAAC,EAAa,GAAiBA,EAAS,EAAW,CAAO,EAAIC,EAAO,KAAK,CAAO,EAAS,EAAU,EAAI,CAAC,KAAK,GAAK,CAAC,CAAC,MAAc,CAAC,GAAG,CAAC,GAAW,CAAC,EAAS,OAAsD,IAAM,EAAa,EAAjD,KAAK,IAAI,EAAS,EAAW,CAA8C,EAAU,EAAS,EAAW,EAAE,GAAO,EAAQ,EAAiB,EAAS,gBAAgB,CAAC,GAAS,EAAU,MAAoB,EAAgB,EAAQ,CAAC,CAAI,IAAU,GAAU,cAAc,EAAS,EAAI,EAAa,CAAC,UAAU,cAAc,EAAS,EAAG,CAAC,EAAW,EAAS,EAAS,EAAU,EAAS,CAAC,CAAC,IAAM,EAAa,GAAO,OAA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