{"version":3,"file":"CountdownTimer.Mo0OVo7-.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/wxnVejTN5DmM0EnHFV2K/BsLMqgUW4tdZAvP46b4W/CountdownTimer.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect,startTransition}from\"react\";/**\n * A countdown timer component that displays days, hours, minutes, and seconds\n * in separate cards with labels.\n * \n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function CountdownTimer(props){const{endDate,gap,themeMode,cardBackground,lightCardBackground,darkCardBackground,cardBorderRadius,cardPadding,cardShadow,lightNumberColor,lightLabelColor,darkNumberColor,darkLabelColor,numberFont,labelFont,mobileNumberFont,mobileLabelFont,mobileBreakpoint,showDays,showHours,showMinutes,showSeconds,daysLabel,hoursLabel,minutesLabel,secondsLabel,onFinish}=props;const[timeLeft,setTimeLeft]=useState({days:0,hours:0,minutes:0,seconds:0});const[isFinished,setIsFinished]=useState(false);const[isMobile,setIsMobile]=useState(false);// Check if we're on mobile based on screen width\nuseEffect(()=>{if(typeof window===\"undefined\")return;const checkMobile=()=>{startTransition(()=>{setIsMobile(window.innerWidth<=mobileBreakpoint);});};// Check initially\ncheckMobile();// Add resize listener\nwindow.addEventListener(\"resize\",checkMobile);// Clean up\nreturn()=>window.removeEventListener(\"resize\",checkMobile);},[mobileBreakpoint]);useEffect(()=>{const calculateTimeLeft=()=>{const difference=new Date(endDate).getTime()-new Date().getTime();if(difference<=0){// Timer has finished\nif(!isFinished){setIsFinished(true);if(onFinish)onFinish();}startTransition(()=>{setTimeLeft({days:0,hours:0,minutes:0,seconds:0});});return;}// Calculate time units\nconst days=Math.floor(difference/(1e3*60*60*24));const hours=Math.floor(difference%(1e3*60*60*24)/(1e3*60*60));const minutes=Math.floor(difference%(1e3*60*60)/(1e3*60));const seconds=Math.floor(difference%(1e3*60)/1e3);startTransition(()=>{setTimeLeft({days,hours,minutes,seconds});});};// Calculate immediately\ncalculateTimeLeft();// Set up interval\nconst timer=setInterval(calculateTimeLeft,1e3);// Clean up interval\nreturn()=>clearInterval(timer);},[endDate,onFinish,isFinished]);// Determine which units to show\nconst units=[{show:showDays,value:timeLeft.days,label:daysLabel},{show:showHours,value:timeLeft.hours,label:hoursLabel},{show:showMinutes,value:timeLeft.minutes,label:minutesLabel},{show:showSeconds,value:timeLeft.seconds,label:secondsLabel}].filter(unit=>unit.show);// Calculate grid columns based on visible units\nconst visibleUnits=units.length;// Determine colors based on theme mode\nconst effectiveCardBackground=themeMode===\"dark\"?darkCardBackground:lightCardBackground;const effectiveNumberColor=themeMode===\"dark\"?darkNumberColor:lightNumberColor;const effectiveLabelColor=themeMode===\"dark\"?darkLabelColor:lightLabelColor;return /*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",gap:`${gap}px`,width:\"100%\",height:\"100%\",justifyContent:\"center\",alignItems:\"center\"},children:units.map((unit,index)=>/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",flex:1,maxWidth:`calc((100% - (${visibleUnits-1} * ${gap}px)) / ${visibleUnits})`,minWidth:`calc((100% - (${visibleUnits-1} * ${gap}px)) / ${visibleUnits})`},children:/*#__PURE__*/_jsxs(\"div\",{style:{backgroundColor:effectiveCardBackground,borderRadius:`${cardBorderRadius}px`,padding:`${cardPadding}px`,boxShadow:cardShadow?\"0 4px 12px rgba(0,0,0,0.1)\":\"none\",display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",width:\"100%\",aspectRatio:\"1\",boxSizing:\"border-box\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{color:effectiveNumberColor,textAlign:\"center\",...isMobile?mobileNumberFont:numberFont},children:String(unit.value).padStart(2,\"0\")}),/*#__PURE__*/_jsx(\"div\",{style:{color:effectiveLabelColor,textAlign:\"center\",marginTop:\"8px\",...isMobile?mobileLabelFont:labelFont},children:unit.label})]})},index))});}addPropertyControls(CountdownTimer,{endDate:{type:ControlType.Date,title:\"End Date\",defaultValue:new Date(\"2025-10-14T10:00:00\").toISOString(),displayTime:true},themeMode:{type:ControlType.Enum,title:\"Theme Mode\",options:[\"light\",\"dark\"],optionTitles:[\"Light\",\"Dark\"],defaultValue:\"light\",displaySegmentedControl:true},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:16,min:0,max:100,step:1},lightCardBackground:{type:ControlType.Color,title:\"Light Card BG\",defaultValue:\"#FFFFFF\",hidden:({themeMode})=>themeMode===\"dark\"},darkCardBackground:{type:ControlType.Color,title:\"Dark Card BG\",defaultValue:\"#1a1a1a\",hidden:({themeMode})=>themeMode===\"light\"},cardBorderRadius:{type:ControlType.Number,title:\"Card Radius\",defaultValue:8,min:0,max:50,step:1},cardPadding:{type:ControlType.Number,title:\"Card Padding\",defaultValue:16,min:0,max:50,step:1},cardShadow:{type:ControlType.Boolean,title:\"Card Shadow\",defaultValue:true},lightNumberColor:{type:ControlType.Color,title:\"Light Number Color\",defaultValue:\"#000000\",hidden:({themeMode})=>themeMode===\"dark\"},lightLabelColor:{type:ControlType.Color,title:\"Light Label Color\",defaultValue:\"#666666\",hidden:({themeMode})=>themeMode===\"dark\"},darkNumberColor:{type:ControlType.Color,title:\"Dark Number Color\",defaultValue:\"#FFFFFF\",hidden:({themeMode})=>themeMode===\"light\"},darkLabelColor:{type:ControlType.Color,title:\"Dark Label Color\",defaultValue:\"#CCCCCC\",hidden:({themeMode})=>themeMode===\"light\"},numberFont:{type:ControlType.Font,title:\"Number Font\",defaultValue:{fontSize:\"32px\",variant:\"Bold\",lineHeight:1.2},controls:\"extended\",defaultFontType:\"sans-serif\"},labelFont:{type:ControlType.Font,title:\"Label Font\",defaultValue:{fontSize:\"14px\",variant:\"Medium\",lineHeight:1.5},controls:\"extended\",defaultFontType:\"sans-serif\"},showDays:{type:ControlType.Boolean,title:\"Show Days\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},showHours:{type:ControlType.Boolean,title:\"Show Hours\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},showMinutes:{type:ControlType.Boolean,title:\"Show Minutes\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},showSeconds:{type:ControlType.Boolean,title:\"Show Seconds\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},daysLabel:{type:ControlType.String,title:\"Days Label\",defaultValue:\"Days\"},hoursLabel:{type:ControlType.String,title:\"Hours Label\",defaultValue:\"Hours\"},minutesLabel:{type:ControlType.String,title:\"Minutes Label\",defaultValue:\"Minutes\"},secondsLabel:{type:ControlType.String,title:\"Seconds Label\",defaultValue:\"Seconds\"},mobileBreakpoint:{type:ControlType.Number,title:\"Mobile Breakpoint\",defaultValue:768,min:320,max:1200,step:1},mobileNumberFont:{type:ControlType.Font,title:\"Mobile Number Font\",defaultValue:{fontSize:\"24px\",variant:\"Bold\",lineHeight:1.2},controls:\"extended\",defaultFontType:\"sans-serif\"},mobileLabelFont:{type:ControlType.Font,title:\"Mobile Label Font\",defaultValue:{fontSize:\"12px\",variant:\"Medium\",lineHeight:1.5},controls:\"extended\",defaultFontType:\"sans-serif\"},onFinish:{type:ControlType.EventHandler,title:\"On Finish\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CountdownTimer\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CountdownTimer.map"],"mappings":"6MAMG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,UAAQ,MAAI,YAAU,iBAAe,sBAAoB,qBAAmB,mBAAiB,cAAY,aAAW,mBAAiB,kBAAgB,kBAAgB,iBAAe,aAAW,YAAU,mBAAiB,kBAAgB,mBAAiB,WAAS,YAAU,cAAY,cAAY,YAAU,a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