{"version":3,"file":"Counter_1.D_AxKTWq.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/G5AzTBmpwYyf8zdbfxhg/nfb89kCSdBmmKnzjRolT/Counter_1.js"],"sourcesContent":["// Counter die van 0 tot het ingevulde getal oploopt als hij in beeld komt. Punten worden genegeerd, komma's zijn decimalen.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * Counter die van 0 tot het ingevulde getal oploopt als hij in beeld komt. Punten worden genegeerd, komma's zijn decimalen.\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function Counter(props){const{target,duration,font,color,decimals,style,showPercent,showPlus,alignment=\"left\",verticalAlignment=\"center\",prefix=\"\",suffix=\"\"}=props;const isStatic=useIsStaticRenderer();const[value,setValue]=useState(0);const[hasAnimated,setHasAnimated]=useState(false);const ref=useRef(null);const alignItemsValue=verticalAlignment===\"top\"?\"flex-start\":verticalAlignment===\"center\"?\"baseline\":\"flex-end\";// Parse input: ignore dots, treat comma as decimal\nfunction parseInput(input){if(!input)return 0;// Remove all dots (thousand separators)\nlet cleaned=input.replace(/\\./g,\"\");// Replace comma with dot for decimal\ncleaned=cleaned.replace(/,/g,\".\");const num=parseFloat(cleaned);return isNaN(num)?0:num;}const endValue=parseInput(target);// Animate when in view\nuseEffect(()=>{if(isStatic||hasAnimated){startTransition(()=>setValue(endValue));return;}let frame;let start=null;function animate(ts){if(start===null)start=ts;const progress=Math.min((ts-start)/(duration*1e3),1);const current=endValue*progress;startTransition(()=>setValue(progress<1?current:endValue));if(progress<1){frame=requestAnimationFrame(animate);}else{startTransition(()=>setHasAnimated(true));}}// Intersection observer\nconst node=ref.current;let observer=null;if(node){observer=new window.IntersectionObserver(entries=>{if(entries[0].isIntersecting&&!hasAnimated){requestAnimationFrame(animate);}},{threshold:.2});observer.observe(node);}return()=>{if(frame)cancelAnimationFrame(frame);if(observer&&node)observer.unobserve(node);};// eslint-disable-next-line\n},[endValue,duration,isStatic,hasAnimated]);return /*#__PURE__*/_jsxs(\"div\",{ref:ref,style:{...style,color,...font,width:\"max-content\",minWidth:\"max-content\",position:\"relative\",display:\"flex\",alignItems:alignItemsValue},\"aria-label\":(showPlus?\"+\":\"\")+(prefix||\"\")+value.toLocaleString(\"nl-NL\",{minimumFractionDigits:decimals,maximumFractionDigits:decimals})+(showPercent?\"%\":\"\")+(suffix||\"\"),children:[showPlus?/*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-block\",height:\"1em\",lineHeight:1,marginRight:2,fontSize:\"inherit\",verticalAlign:\"middle\",textAlign:\"center\",alignSelf:\"baseline\",position:\"relative\",top:0},children:\"+\"}):null,prefix?/*#__PURE__*/_jsx(\"span\",{style:{marginRight:2,alignSelf:\"baseline\",position:\"relative\",top:0},children:prefix}):null,/*#__PURE__*/_jsx(\"span\",{children:value.toLocaleString(\"nl-NL\",{minimumFractionDigits:decimals,maximumFractionDigits:decimals})}),showPercent?\"%\":null,suffix?/*#__PURE__*/_jsx(\"span\",{style:{marginLeft:2,alignSelf:\"baseline\",position:\"relative\",top:0},children:suffix}):null]});}addPropertyControls(Counter,{target:{type:ControlType.String,title:\"Doelgetal\",defaultValue:\"1000\",placeholder:\"Bijv. 1.000,50\"},duration:{type:ControlType.Number,title:\"Duur (s)\",defaultValue:1.5,min:.2,max:10,step:.1,unit:\"s\"},decimals:{type:ControlType.Number,title:\"Decimalen\",defaultValue:0,min:0,max:4,step:1,displayStepper:true},color:{type:ControlType.Color,title:\"Kleur\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Lettertype\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"40px\",variant:\"Bold\",letterSpacing:\"-0.04em\",lineHeight:\"1em\"}},showPercent:{type:ControlType.Boolean,title:\"Toon %\",defaultValue:false,enabledTitle:\"Aan\",disabledTitle:\"Uit\"},showPlus:{type:ControlType.Boolean,title:\"Toon +\",defaultValue:false,enabledTitle:\"Aan\",disabledTitle:\"Uit\"},prefix:{type:ControlType.String,title:\"Voorvoegsel\",defaultValue:\"\",placeholder:\"+ of % of tekst\"},suffix:{type:ControlType.String,title:\"Achtervoegsel\",defaultValue:\"\",placeholder:\"+ of % of tekst\"},alignment:{type:ControlType.Enum,title:\"Uitlijning\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Links\",\"Midden\",\"Rechts\"],defaultValue:\"left\",displaySegmentedControl:true,hidden:true},verticalAlignment:{type:ControlType.Enum,title:\"Hoogte uitlijning\",options:[\"top\",\"center\",\"bottom\"],optionTitles:[\"Boven\",\"Midden\",\"Onder\"],defaultValue:\"center\",displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Counter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Counter_1.map"],"mappings":"uNAMG,SAAwB,EAAQ,EAAM,CAAC,GAAK,CAAC,SAAO,WAAS,OAAK,QAAM,WAAS,QAAM,cAAY,WAAS,YAAU,OAAO,oBAAkB,SAAS,SAAO,GAAG,SAAO,IAAI,EAAY,EAAS,GAAqB,CAAM,CAAC,EAAM,GAAUA,EAAS,EAAE,CAAM,CAAC,EAAY,GAAgBA,EAAS,GAAM,CAAO,EAAIC,EAAO,KAAK,CAAO,EAAgB,IAAoB,MAAM,aAAa,IAAoB,SAAS,WAAW,WAC3a,SAAS,EAAW,EAAM,CAAC,GAAG,CAAC,EAAM,MAAO,GAC5C,IAAI,EAAQ,EAAM,QAAQ,MAAM,GAAG,CACnC,EAAQ,EAAQ,QAAQ,KAAK,IAAI,CAAC,IAAM,EAAI,WAAW,EAAQ,CAAC,OAAO,MAAM,EAAI,CAAC,EAAE,EAAK,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