{"version":3,"file":"Counter.BzTC866U.mjs","names":["useCallback","useState","useMemo","p"],"sources":["https:/framerusercontent.com/modules/inw8Osg29JYBahP1Epwg/B4a49qfAsHDen2O5AnOB/Counter.js"],"sourcesContent":["// Instructions: Create a counter only Number not any symbol\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import React,{startTransition,useCallback,useMemo,useState}from\"react\";/**\n * Counter (Numbers Only)\n *\n * @framerIntrinsicWidth 160\n * @framerIntrinsicHeight 56\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function Counter(props){const{initialValue,start,end,step,mode,autoIntervalMs,prefix,suffix,textColor,borderRadius,padding,font}=props;const clamp=useCallback(n=>{if(!Number.isFinite(n))return start;return Math.min(end,Math.max(start,n));},[start,end]);const[value,setValue]=useState(()=>clamp(Math.round(initialValue)));React.useEffect(()=>{// Keep state in sync when the user changes initial value/min/max on the canvas\nstartTransition(()=>setValue(clamp(Math.round(initialValue))));// eslint-disable-next-line react-hooks/exhaustive-deps\n},[initialValue,start,end]);React.useEffect(()=>{if(typeof window===\"undefined\")return;if(mode!==\"auto\")return;const interval=window.setInterval(()=>{startTransition(()=>setValue(v=>{const next=clamp(Math.round(v+step));return next;}));},Math.max(20,autoIntervalMs));return()=>window.clearInterval(interval);},[mode,autoIntervalMs,clamp,step]);const displayValue=useMemo(()=>{const safe=clamp(Math.round(value));return`${prefix}${safe}${suffix}`;},[clamp,prefix,suffix,value]);const isFixedWidth=props?.style?.width===\"100%\";return /*#__PURE__*/_jsx(\"div\",{style:{...props.style,position:\"relative\",width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",padding,background:\"transparent\",borderRadius,boxSizing:\"border-box\",overflow:\"hidden\",...isFixedWidth?{}:{minWidth:\"max-content\"}},\"aria-label\":\"Counter\",role:\"status\",children:/*#__PURE__*/_jsx(\"span\",{style:{...font,color:textColor,width:\"max-content\",userSelect:\"none\",fontVariantNumeric:\"tabular-nums\"},\"aria-live\":\"polite\",children:displayValue})});}addPropertyControls(Counter,{initialValue:{type:ControlType.Number,title:\"Initial\",defaultValue:0,step:1},start:{type:ControlType.Number,title:\"Start\",defaultValue:0,step:1},end:{type:ControlType.Number,title:\"End\",defaultValue:9999,step:1},step:{type:ControlType.Number,title:\"Step\",defaultValue:1,min:1,max:1e3,step:1},mode:{type:ControlType.Enum,title:\"Mode\",defaultValue:\"auto\",options:[\"manual\",\"auto\"],optionTitles:[\"Manual\",\"Auto\"],displaySegmentedControl:true},autoIntervalMs:{type:ControlType.Number,title:\"Auto ms\",defaultValue:20,min:20,max:1e4,step:1,hidden:p=>p.mode!==\"auto\"},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\"},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#000000\"},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"10px\"},borderRadius:{type:ControlType.BorderRadius,title:\"Radius\",defaultValue:\"12px\"},font:{type:ControlType.Font,title:\"Number Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"22px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Counter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"160\",\"framerIntrinsicHeight\":\"56\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Counter.map"],"mappings":"+MASG,SAAwB,EAAQ,EAAM,CAAC,GAAK,CAAC,eAAa,QAAM,MAAI,OAAK,OAAK,iBAAe,SAAO,SAAO,YAAU,eAAa,UAAQ,QAAM,EAAY,EAAMA,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