{"version":3,"file":"Counter_1.DFd9mHws.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,EAAoB,EAAO,CAAC,EAAM,GAAUA,EAAS,CAAC,EAAO,CAAC,EAAY,GAAgBA,EAAS,EAAK,EAAQ,EAAIC,EAAO,IAAI,EAAQ,EAAgB,IAAoB,MAAM,aAAa,IAAoB,SAAS,WAAW,WAC3a,SAAS,EAAW,EAAM,CAAC,GAAG,CAAC,EAAM,MAAO,GAC5C,IAAI,EAAQ,EAAM,QAAQ,MAAM,EAAE,EAClC,EAAQ,EAAQ,QAAQ,KAAK,GAAG,EAAE,IAAM,EAAI,WAAW,CAAO,EAAE,OAAO,MAAM,CAAG,EAAE,EAAE,CAAI,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