{"version":3,"file":"Countdown.DUSadhPs.mjs","names":["useState","React"],"sources":["https:/framerusercontent.com/modules/yA6uErpUSmA7qn18dMZl/td3R4fv5pLhefKExkBTS/Countdown.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import React,{useState,useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function Countdown({fontSize,numberFontFamily,labelFontFamily,fontColor,fontWeight,labelFontWeight,displayDays,displayHours,displayMinutes,displaySeconds,endDate,endTime,endMessage,numberColor,numberFontSize,labelColor,labelFontSize,colonColor,colonFontSize,gap}){const[timeLeft,setTimeLeft]=useState(calculateTimeLeft());useEffect(()=>{const timer=setTimeout(()=>{setTimeLeft(calculateTimeLeft());},1e3);return()=>clearTimeout(timer);});function calculateTimeLeft(){const difference=+new Date(`${endDate}T${endTime}`)-+new Date;let timeLeft={};if(difference>0){timeLeft={days:displayDays?Math.floor(difference/(1e3*60*60*24)):null,hours:displayHours?Math.floor(difference/(1e3*60*60)%24):null,minutes:displayMinutes?Math.floor(difference/1e3/60%60):null,seconds:displayMinutes?Math.floor(difference/1e3%60):null};}return timeLeft;}const timerComponents=[];Object.keys(timeLeft).forEach((interval,idx,arr)=>{if(!timeLeft[interval]&&timeLeft[interval]!==0){return;}timerComponents.push(/*#__PURE__*/_jsxs(React.Fragment,{children:[/*#__PURE__*/_jsxs(\"span\",{style:{display:\"flex\",alignItems:\"center\",flexDirection:\"column\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{fontWeight:fontWeight,color:numberColor,fontSize:numberFontSize},children:timeLeft[interval]}),/*#__PURE__*/_jsx(\"span\",{style:{fontSize:labelFontSize,fontWeight:labelFontWeight,color:labelColor,fontFamily:labelFontFamily},children:interval.toLowerCase()})]}),idx<arr.length-1?/*#__PURE__*/_jsx(\"span\",{style:{fontSize:colonFontSize,margin:`0 ${gap/2}px`,color:colonColor,fontFamily:numberFontFamily},children:\": \"}):null]},interval));});return /*#__PURE__*/_jsx(\"div\",{style:{fontSize,fontFamily:numberFontFamily,color:fontColor,fontWeight,display:\"flex\",gap:gap},children:timerComponents.length?timerComponents:/*#__PURE__*/_jsx(\"span\",{children:endMessage})});}addPropertyControls(Countdown,{fontSize:{type:ControlType.Number,unit:\"px\",defaultValue:30},numberFontFamily:{type:ControlType.String,title:\"Number Font\",defaultValue:\"Inter\"},labelFontFamily:{type:ControlType.String,title:\"Label Font\",defaultValue:\"Inter\"},fontColor:{type:ControlType.Color,defaultValue:\"black\"},numberColor:{type:ControlType.Color,title:\"Number Color\",defaultValue:\"black\"},numberFontSize:{type:ControlType.Number,title:\"Number Size\",unit:\"px\",defaultValue:30},labelColor:{type:ControlType.Color,title:\"Label Color\",defaultValue:\"black\"},labelFontSize:{type:ControlType.Number,title:\"Label Size\",unit:\"px\",defaultValue:12},colonColor:{type:ControlType.Color,title:\"Colon Color\",defaultValue:\"black\"},colonFontSize:{type:ControlType.Number,title:\"Colon Size\",unit:\"px\",defaultValue:30},gap:{type:ControlType.Number,title:\"Element Gap\",defaultValue:20,min:0,max:60,unit:\"px\"},fontWeight:{type:ControlType.Enum,defaultValue:400,options:[\"normal\",\"bold\",\"bolder\",\"lighter\",100,200,300,400,500,600,700,800,900],title:\"Number Weight\"},labelFontWeight:{type:ControlType.Enum,defaultValue:400,options:[\"normal\",\"bold\",\"bolder\",\"lighter\",100,200,300,400,500,600,700,800,900],title:\"Label Weight\"},displayDays:{type:ControlType.Boolean,defaultValue:true},displayHours:{type:ControlType.Boolean,defaultValue:true},displayMinutes:{type:ControlType.Boolean,defaultValue:true},displaySeconds:{type:ControlType.Boolean,defaultValue:true},endDate:{type:ControlType.String,defaultValue:\"2023-04-25\",description:\"YYYY-MM-DD\"},endTime:{type:ControlType.String,defaultValue:\"00:00:00\",description:\"HH:MM:SS\"},endMessage:{type:ControlType.String,defaultValue:\"Time's up!\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Countdown\",\"slots\":[],\"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