{"version":3,"file":"Countdown.CYbTwEhV.mjs","names":["useState","timeLeft"],"sources":["https:/framerusercontent.com/modules/ArmgD38l44en0dAf2YiY/eLt9XctNt6mmkaarMQCo/Countdown.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function Countdown({fontSize,fontFamily,fontColor,fontWeight,displayDays,displayHours,displayMinutes,displaySeconds,endDate,endTime,endMessage,endMessageColor,unitBackgroundColor,unitPadding,unitBorderColor,unitBorderWidth,unitBorderRadius,numberColor,labelColor,labelSpacing,labelFontSize,unitMinWidth,unitMinHeight}){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:displaySeconds?Math.floor(difference/1e3%60):null};}return timeLeft;}const timerComponents=[];Object.keys(timeLeft).forEach(interval=>{if(timeLeft[interval]===null){return;}timerComponents.push(/*#__PURE__*/_jsxs(\"span\",{style:{display:\"flex\",alignItems:\"center\",flexDirection:\"column\",justifyContent:\"center\",backgroundColor:unitBackgroundColor,padding:`${unitPadding}px`,border:`${unitBorderWidth}px solid ${unitBorderColor}`,borderRadius:`${unitBorderRadius}px`,minWidth:`${unitMinWidth}px`,minHeight:`${unitMinHeight}px`},children:[/*#__PURE__*/_jsx(\"span\",{style:{color:numberColor,fontSize,fontFamily,fontWeight},children:timeLeft[interval]}),/*#__PURE__*/_jsx(\"span\",{style:{color:labelColor,fontSize:`${labelFontSize}px`,marginTop:`${labelSpacing}px`},children:interval.toLowerCase()})]},interval));});return /*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",justifyContent:\"center\",alignItems:\"center\",gap:\"20px\",textAlign:\"center\"},children:timerComponents.length?timerComponents:/*#__PURE__*/_jsx(\"span\",{style:{color:endMessageColor},children:endMessage})});}addPropertyControls(Countdown,{fontSize:{type:ControlType.Number,unit:\"px\",defaultValue:30},fontFamily:{type:ControlType.String,defaultValue:\"Inter\"},fontColor:{type:ControlType.Color,defaultValue:\"black\"},fontWeight:{type:ControlType.Enum,defaultValue:400,options:[\"normal\",\"bold\",\"bolder\",\"lighter\",100,200,300,400,500,600,700,800,900]},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!\"},endMessageColor:{type:ControlType.Color,defaultValue:\"red\"},unitBackgroundColor:{type:ControlType.Color,defaultValue:\"#ffffff\"},unitPadding:{type:ControlType.Number,defaultValue:10},unitBorderColor:{type:ControlType.Color,defaultValue:\"#000000\"},unitBorderWidth:{type:ControlType.Number,defaultValue:1},unitBorderRadius:{type:ControlType.Number,defaultValue:5},numberColor:{type:ControlType.Color,defaultValue:\"black\"},labelColor:{type:ControlType.Color,defaultValue:\"gray\"},labelSpacing:{type:ControlType.Number,defaultValue:5},labelFontSize:{type:ControlType.Number,unit:\"px\",defaultValue:12},unitMinWidth:{type:ControlType.Number,unit:\"px\",defaultValue:50},unitMinHeight:{type:ControlType.Number,unit:\"px\",defaultValue:70}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Countdown\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMapping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