{"version":3,"file":"Smooth_Counter.DmaJToas.mjs","names":["React.useCallback","endChars","startChars","React.useMemo","React.useState","React.useRef"],"sources":["https:/framerusercontent.com/modules/PN2tagOG9lleBLQzdhQz/kbvxkau1PfWteOBPS4FI/Smooth_Counter.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";// Code component provided by Eleveight Supply. All rights reserved 2024/2025.\n/**\n * @framerDisableUnlink\n * @framerSupportedLayoutWidth 100%\n * @framerSupportedLayoutHeight 100%\n */export default function SmoothCounter(props){const{start,end,font,fontProps,trigger,lineHeight,transition,label,labelPosition,loop,loopDelay,padding,cutoffOffsetY,useMask,digitStagger,groupThousands}=props;const{Color,Size,letterSpacing,verticalSpacing}=fontProps;// ------- sizing -------\nconst computedLineHeight=lineHeight||(verticalSpacing===0?Size*.9:Size);const computedDigitWidth=Size*.65;// ------- helpers -------\nconst DIGIT=/\\d/;const stripDigits=s=>(s??\"\").toString().replace(/\\D+/g,\"\");const groupWithCommas=digits=>digits.replace(/\\B(?=(\\d{3})+(?!\\d))/g,\",\");const normalizePair=React.useCallback((rawStart,rawEnd)=>{const endDigits=stripDigits(rawEnd);const startDigits=stripDigits(rawStart);const targetDigitLen=Math.max(1,endDigits.length);const padLeft=(d,len)=>d.padStart(len,\"0\");const normEndDigits=padLeft(endDigits,targetDigitLen);const normStartDigits=padLeft(startDigits,targetDigitLen);const endText=groupThousands?groupWithCommas(normEndDigits):normEndDigits;const startText=groupThousands?groupWithCommas(normStartDigits):normStartDigits;const endChars=endText.split(\"\");const startChars=startText.split(\"\");while(startChars.length<endChars.length)startChars.unshift(\"0\");while(startChars.length>endChars.length)startChars.shift();return{startChars,endChars};},[groupThousands]);const{startChars,endChars}=React.useMemo(()=>normalizePair(start,end),[start,end,normalizePair]);// ------- trigger -------\nconst[hasAnimated,setHasAnimated]=React.useState(false);const numberRef=React.useRef(null);React.useEffect(()=>{if(trigger===\"onAppear\"){setHasAnimated(true);return;}const observer=new IntersectionObserver(entries=>{for(const e of entries)if(e.isIntersecting)setHasAnimated(true);},{threshold:.1});if(numberRef.current)observer.observe(numberRef.current);return()=>observer.disconnect();},[trigger]);// ------- render -------\nconst renderScrollingDigits=(sChars,eChars)=>{const computedPunctuationWidth=computedDigitWidth*.65;return eChars.map((char,index)=>{const targetChar=char;const startChar=sChars[index]??\"0\";const marginRight=index<eChars.length-1?`${letterSpacing}px`:\"0px\";const marginLeft=letterSpacing<0&&index>0?`${letterSpacing}px`:\"0px\";if(DIGIT.test(targetChar)){const targetDigit=parseInt(targetChar,10);const startDigit=DIGIT.test(startChar)?parseInt(startChar,10):0;const step=computedLineHeight+Math.max(0,verticalSpacing);const y0=-startDigit*step;const y1=-targetDigit*step;const delay=(digitStagger??0)*index;const animateValue=hasAnimated?loop?{translateY:[y0,y1]}:{translateY:y1}:{translateY:y0};const perColumnTransition=loop?{...transition,duration:(transition&&transition.duration)??3.2,delay,repeat:Infinity,repeatType:\"reverse\",repeatDelay:loopDelay}:{...transition,delay};return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",height:`${computedLineHeight}px`,overflow:\"visible\",width:`${computedDigitWidth}px`,display:\"inline-flex\",justifyContent:\"center\",marginRight,marginLeft,willChange:\"transform\",letterSpacing:\"0px\"},children:/*#__PURE__*/_jsx(motion.div,{initial:loop?false:{translateY:y0},animate:animateValue,transition:perColumnTransition,style:{display:\"flex\",flexDirection:\"column\",willChange:\"transform\",transform:\"translateZ(0)\"},children:Array.from({length:10}).map((_,i)=>/*#__PURE__*/_jsx(\"div\",{style:{height:`${computedLineHeight}px`,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",fontSize:`${Size}px`,lineHeight:`${computedLineHeight}px`,color:Color,...font,marginBottom:verticalSpacing>0?`${verticalSpacing}px`:\"0px\",letterSpacing:\"0px\"},children:i},i))})},`d-${index}`);}// punctuation (commas) — only when grouping is ON\nreturn groupThousands?/*#__PURE__*/_jsx(\"div\",{style:{height:`${computedLineHeight}px`,width:`${computedPunctuationWidth}px`,display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",fontSize:`${Size}px`,lineHeight:`${computedLineHeight}px`,color:Color,...font,marginRight,marginLeft,letterSpacing:\"0px\"},children:targetChar},`p-${index}`):null;});};// ------- styles -------\nconst rowStyle={display:\"inline-flex\",alignItems:\"baseline\",gap:0,overflow:\"visible\",userSelect:\"none\"};// Compute asymmetric padding from base padding + offset\nconst offsetY=Number.isFinite(cutoffOffsetY)?cutoffOffsetY:0;const paddingTop=Math.max(0,padding+offsetY);const paddingBottom=Math.max(0,padding-offsetY);const digitsMaskStyle={position:\"relative\",display:\"inline-block\",overflow:\"hidden\",paddingTop:`${paddingTop}px`,paddingBottom:`${paddingBottom}px`,...useMask&&{WebkitMaskImage:\"linear-gradient(to bottom, transparent 5%, black 25%, black 75%, transparent 95%)\",maskImage:\"linear-gradient(to bottom, transparent 5%, black 25%, black 75%, transparent 95%)\"}};const digitsInlineStyle={display:\"inline-flex\",flexDirection:\"row\",lineHeight:`${computedLineHeight}px`,color:Color,...font,letterSpacing:`${letterSpacing}px`};const labelStyle={display:\"inline-block\",whiteSpace:\"nowrap\",fontSize:`${Size}px`,lineHeight:`${computedLineHeight}px`,color:Color,...font,letterSpacing:`${letterSpacing}px`,transform:\"translateZ(0)\"};return /*#__PURE__*/_jsxs(\"div\",{ref:numberRef,style:rowStyle,children:[labelPosition===\"Before\"&&/*#__PURE__*/_jsx(\"span\",{style:{...labelStyle,marginRight:6},children:label}),/*#__PURE__*/_jsx(\"span\",{style:digitsMaskStyle,children:/*#__PURE__*/_jsx(\"span\",{style:digitsInlineStyle,children:renderScrollingDigits(startChars,endChars)})}),labelPosition===\"After\"&&/*#__PURE__*/_jsx(\"span\",{style:{...labelStyle,marginLeft:6},children:label})]});}SmoothCounter.defaultProps={start:\"00\",end:\"1,234\",font:{family:\"Inter\",weight:400,style:\"normal\",fontSize:40},fontProps:{Color:\"#929292\",Size:40,letterSpacing:-2,verticalSpacing:0},trigger:\"onAppear\",transition:{type:\"tween\",ease:[.5,.02,.16,.99],duration:3.2},label:\"\",labelPosition:\"After\",loop:false,loopDelay:0,padding:7,cutoffOffsetY:0,useMask:false,digitStagger:.08,groupThousands:true};addPropertyControls(SmoothCounter,{font:{type:ControlType.Font,title:\"Font\",defaultValue:\"Inter\"},fontProps:{type:ControlType.Object,title:\"Font Props\",controls:{Color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#929292\"},Size:{type:ControlType.Number,title:\"Size\",defaultValue:40,min:8,max:500,step:1,displayStepper:true},letterSpacing:{type:ControlType.Number,title:\"Letter\",defaultValue:-2,min:-50,max:100,step:1,displayStepper:true},verticalSpacing:{type:ControlType.Number,title:\"Line\",defaultValue:0,min:0,max:50,step:1,displayStepper:true}}},start:{type:ControlType.String,title:\"Start\",defaultValue:SmoothCounter.defaultProps.start},end:{type:ControlType.String,title:\"End\",defaultValue:SmoothCounter.defaultProps.end},groupThousands:{type:ControlType.Boolean,title:\"Thousands\",defaultValue:SmoothCounter.defaultProps.groupThousands,enabledTitle:\"On\",disabledTitle:\"Off\"},trigger:{type:ControlType.Enum,title:\"Trigger\",options:[\"onAppear\",\"inView\"],optionTitles:[\"On Appear\",\"In View\"],defaultValue:\"onAppear\",displaySegmentedControl:true,segmentedControlDirection:\"vertical\"},transition:{type:ControlType.Transition,title:\"Transition\",defaultValue:{type:\"tween\",ease:[.5,.02,.16,.99],duration:3.2}},label:{type:ControlType.String,title:\"Label\",defaultValue:\"\",placeholder:\"ex: %,+,etc...\"},labelPosition:{type:ControlType.SegmentedEnum,title:\"Label\",options:[\"Before\",\"After\"],optionTitles:[\"Before\",\"After\"],defaultValue:\"After\"},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"},loopDelay:{type:ControlType.Number,title:\"Delay\",defaultValue:0,min:0,max:10,step:.1,unit:\"s\",hidden:({loop})=>!loop},useMask:{type:ControlType.Boolean,title:\"Gradient\",defaultValue:SmoothCounter.defaultProps.useMask,enabledTitle:\"Yes\",disabledTitle:\"No\"},padding:{type:ControlType.Number,title:\"Cut-off\",defaultValue:SmoothCounter.defaultProps.padding,min:0,max:200,step:1,displayStepper:true},cutoffOffsetY:{type:ControlType.Number,title:\"Y Offset\",defaultValue:SmoothCounter.defaultProps.cutoffOffsetY,min:-200,max:200,step:1,displayStepper:true,tooltip:\"Bias the visible window vertically. + moves up (more bottom padding); – moves down (more top padding).\"},digitStagger:{type:ControlType.Number,title:\"Stagger\",defaultValue:SmoothCounter.defaultProps.digitStagger,min:0,max:1,step:.01,unit:\"s\",displayStepper:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SmoothCounter\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth 100%\",\"framerSupportedLayoutHeight\":\"100%\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Smooth_Counter.map"],"mappings":"8PAKG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,QAAM,MAAI,OAAK,YAAU,UAAQ,aAAW,aAAW,QAAM,gBAAc,OAAK,YAAU,UAAQ,gBAAc,UAAQ,eAAa,kBAAgB,EAAW,CAAC,QAAM,OAAK,gBAAc,mBAAiB,EAC3P,EAAmB,IAAa,IAAkB,EAAE,EAAK,GAAG,GAAY,EAAmB,EAAK,IAChG,EAAM,KAAW,EAAY,IAAI,GAAG,IAAI,UAAU,CAAC,QAAQ,OAAO,GAAG,CAAO,EAAgB,GAAQ,EAAO,QAAQ,wBAAwB,IAAI,CAAO,EAAcA,GAAmB,EAAS,IAAS,CAAC,IAAM,EAAU,EAAY,EAAO,CAAO,EAAY,EAAY,EAAS,CAAO,EAAe,KAAK,IAAI,EAAE,EAAU,OAAO,CAAO,GAAS,EAAE,IAAM,EAAE,SAAS,E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