{"version":3,"file":"CountdownTimer.D-RQD5cW.mjs","names":["React","_Fragment"],"sources":["https:/framerusercontent.com/modules/77OOoYh70Nl9mjbSiQzD/R8ru49qDJKsHM5iPdUEr/CountdownTimer.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import React from\"react\";export default function RandomCountdownTimer({showSeconds,direction,gap,typography,labelSize,labelColor,borderWidth,borderColor,borderRadius,paddingX,paddingY,translations,colonColor}){const getRandomTimerValues=()=>{return{days:0,hours:Math.floor(Math.random()*5),minutes:Math.floor(Math.random()*60),seconds:Math.floor(Math.random()*60)};};const[timer,setTimer]=React.useState(getRandomTimerValues);const containerStyle={height:\"100%\",width:\"100%\",display:\"flex\",flexDirection:direction===\"horizontal\"?\"row\":\"column\",gap:gap,justifyContent:\"center\",alignItems:\"center\"};const itemStyle={font:`${typography.weight} ${typography.size}px/1 ${typography.font}`,color:typography.color,textAlign:\"center\",border:`${borderWidth}px solid ${borderColor}`,borderRadius:`${borderRadius}px`,padding:`${paddingY}px ${paddingX}px`};const labelStyle={marginTop:4,fontSize:`${labelSize}px`,color:labelColor};const colonStyle={color:colonColor,font:`${typography.weight} ${typography.size}px/1 ${typography.font}`};React.useEffect(()=>{const interval=setInterval(()=>{setTimer(prevTimer=>{let{days,hours,minutes,seconds}=prevTimer;if(seconds>0){seconds-=1;}else if(minutes>0){seconds=59;minutes-=1;}else if(hours>0){minutes=59;seconds=59;hours-=1;}else{return getRandomTimerValues();}return{days,hours,minutes,seconds};});},1e3);return()=>clearInterval(interval);},[]);return /*#__PURE__*/_jsxs(\"div\",{style:containerStyle,children:[/*#__PURE__*/_jsxs(\"div\",{style:itemStyle,children:[/*#__PURE__*/_jsx(\"div\",{children:timer.days.toString().padStart(2,\"0\")}),/*#__PURE__*/_jsx(\"div\",{style:labelStyle,children:translations.days})]}),/*#__PURE__*/_jsx(\"div\",{style:colonStyle,children:\":\"}),/*#__PURE__*/_jsxs(\"div\",{style:itemStyle,children:[/*#__PURE__*/_jsx(\"div\",{children:timer.hours.toString().padStart(2,\"0\")}),/*#__PURE__*/_jsx(\"div\",{style:labelStyle,children:translations.hours})]}),/*#__PURE__*/_jsx(\"div\",{style:colonStyle,children:\":\"}),/*#__PURE__*/_jsxs(\"div\",{style:itemStyle,children:[/*#__PURE__*/_jsx(\"div\",{children:timer.minutes.toString().padStart(2,\"0\")}),/*#__PURE__*/_jsx(\"div\",{style:labelStyle,children:translations.minutes})]}),showSeconds&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"div\",{style:colonStyle,children:\":\"}),/*#__PURE__*/_jsxs(\"div\",{style:itemStyle,children:[/*#__PURE__*/_jsx(\"div\",{children:timer.seconds.toString().padStart(2,\"0\")}),/*#__PURE__*/_jsx(\"div\",{style:labelStyle,children:translations.seconds})]})]})]});}addPropertyControls(RandomCountdownTimer,{showSeconds:{type:ControlType.Boolean,defaultValue:true},direction:{type:ControlType.Enum,defaultValue:\"horizontal\",options:[\"horizontal\",\"vertical\"],optionTitles:[\"Horizontal\",\"Vertical\"]},gap:{type:ControlType.Number,defaultValue:16,displayStepper:true,unit:\"px\"},typography:{type:ControlType.Object,controls:{font:{type:ControlType.String,defaultValue:\"Inter\"},weight:{type:ControlType.Enum,defaultValue:\"400\",options:[\"200\",\"300\",\"400\",\"500\",\"600\",\"700\",\"800\"]},color:{title:\"Font Color\",type:ControlType.Color,defaultValue:\"#FFFFFF\"},size:{type:ControlType.Number,defaultValue:32,unit:\"px\"}}},labelSize:{type:ControlType.Number,title:\"Label Size\",defaultValue:14,unit:\"px\"},labelColor:{type:ControlType.Color,title:\"Label Color\",defaultValue:\"#ffffff\"},borderWidth:{type:ControlType.Number,title:\"Border Width\",defaultValue:2,unit:\"px\"},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#CCCCCC\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,unit:\"px\"},paddingX:{type:ControlType.Number,title:\"Padding X\",defaultValue:8,unit:\"px\"},paddingY:{type:ControlType.Number,title:\"Padding Y\",defaultValue:8,unit:\"px\"},colonColor:{type:ControlType.Color,title:\"Colon Color\",defaultValue:\"#FFFFFF\"},translations:{type:ControlType.Object,controls:{days:{type:ControlType.String,defaultValue:\"Days\"},hours:{type:ControlType.String,defaultValue:\"Hours\"},minutes:{type:ControlType.String,defaultValue:\"Minutes\"},seconds:{type:ControlType.String,defaultValue:\"Seconds\"}}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RandomCountdownTimer\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CountdownTimer.map"],"mappings":"wLAA4J,SAAwB,EAAqB,CAAC,cAAY,YAAU,MAAI,aAAW,YAAU,aAAW,cAAY,cAAY,eAAa,WAAS,WAAS,eAAa,cAAY,CAAC,IAAM,OAAgC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,KAAK,QAAQ,CAAC,EAAE,CAAC,QAAQ,KAAK,MAAM,KAAK,QAAQ,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,KAAK,QAAQ,CAAC,GAAG,CAAC,EAAQ,CAAC,EAAM,GAAUA,EAAM,SAAS,EAAqB,CAAO,EAAe,CAAC,OAAO,OAAO,MAAM,OAAO,QAAQ,OAAO,cAAc,IAAY,aAAa,MAAM,SAAa,MAAI,eAAe,SAAS,WAAW,SAAS,CAAO,EAAU,CAAC,KAAK,GAAG,EAAW,OAAO,GAAG,EAAW,KAAK,OAAO,EAAW,OAAO,MAAM,EAAW,MAAM,UAAU,SAAS,OAAO,GAAG,EAAY,WAAW,IAAc,aAAa,GAAG,EAAa,IAAI,QAAQ,GAAG,EAAS,KAAK,EAAS,IAAI,CAAO,EAAW,CAAC,UAAU,EAAE,SAAS,GAAG,EAAU,IAAI,MAAM,EAAW,C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