{"version":3,"file":"CountdownTimer.CsTNoVM5.mjs","names":["useState","useRef","useMemo"],"sources":["https:/framerusercontent.com/modules/2Eh3cILvCVYn2XWTYpLR/DmLKU6eW72GUMciD3WbH/CountdownTimer.js"],"sourcesContent":["// Countdown timer with white background, counting down from 1 day, 11 hours, 54 minutes, and 17 seconds\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useMemo,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function CountdownTimer(props){const{backgroundColor,textColor,labelColor,font,labelFont,showLabels,separator,size}=props;const INITIAL_TIME=1*24*60*60+11*60*60+54*60+17;const[timeLeft,setTimeLeft]=useState(INITIAL_TIME);const containerRef=useRef(null);useEffect(()=>{const interval=setInterval(()=>{startTransition(()=>{setTimeLeft(prev=>{if(prev<=0)return INITIAL_TIME;return prev-1;});});},1e3);return()=>clearInterval(interval);},[]);const timeUnits=useMemo(()=>{const days=Math.floor(timeLeft/(24*60*60));const hours=Math.floor(timeLeft%(24*60*60)/(60*60));const minutes=Math.floor(timeLeft%(60*60)/60);const seconds=timeLeft%60;return{days:String(days).padStart(2,\"0\"),hours:String(hours).padStart(2,\"0\"),minutes:String(minutes).padStart(2,\"0\"),seconds:String(seconds).padStart(2,\"0\")};},[timeLeft]);const isFixedWidth=props?.style&&props.style.width===\"100%\";return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{...props.style,position:\"relative\",backgroundColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",gap:20*size,padding:20*size,borderRadius:8,...isFixedWidth?{}:{minWidth:\"max-content\"}},children:[/*#__PURE__*/_jsx(TimeUnit,{value:timeUnits.days,label:\"Days\",textColor:textColor,labelColor:labelColor,font:font,labelFont:labelFont,showLabel:showLabels,scale:size}),/*#__PURE__*/_jsx(Separator,{separator:separator,textColor:textColor,font:font,scale:size}),/*#__PURE__*/_jsx(TimeUnit,{value:timeUnits.hours,label:\"Hours\",textColor:textColor,labelColor:labelColor,font:font,labelFont:labelFont,showLabel:showLabels,scale:size}),/*#__PURE__*/_jsx(Separator,{separator:separator,textColor:textColor,font:font,scale:size}),/*#__PURE__*/_jsx(TimeUnit,{value:timeUnits.minutes,label:\"Minutes\",textColor:textColor,labelColor:labelColor,font:font,labelFont:labelFont,showLabel:showLabels,scale:size}),/*#__PURE__*/_jsx(Separator,{separator:separator,textColor:textColor,font:font,scale:size}),/*#__PURE__*/_jsx(TimeUnit,{value:timeUnits.seconds,label:\"Seconds\",textColor:textColor,labelColor:labelColor,font:font,labelFont:labelFont,showLabel:showLabels,scale:size})]});}function TimeUnit({value,label,textColor,labelColor,font,labelFont,showLabel,scale}){return /*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",alignItems:\"center\",gap:4*scale},children:[/*#__PURE__*/_jsx(\"span\",{style:{color:textColor,...font,fontSize:`calc(${font.fontSize} * ${scale})`},children:value}),showLabel&&/*#__PURE__*/_jsx(\"span\",{style:{color:labelColor,...labelFont,fontSize:`calc(${labelFont.fontSize} * ${scale})`},children:label})]});}function Separator({separator,textColor,font,scale}){if(!separator)return null;return /*#__PURE__*/_jsx(\"span\",{style:{color:textColor,...font,fontSize:`calc(${font.fontSize} * ${scale})`},children:separator});}addPropertyControls(CountdownTimer,{backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},labelColor:{type:ControlType.Color,title:\"Label Color\",defaultValue:\"#CCCCCC\"},size:{type:ControlType.Number,title:\"Size\",defaultValue:1,min:.3,max:2,step:.1},font:{type:ControlType.Font,title:\"Number Font\",defaultValue:{fontSize:\"40px\",variant:\"Bold\",letterSpacing:\"-0.04em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},labelFont:{type:ControlType.Font,title:\"Label Font\",defaultValue:{fontSize:\"14px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},showLabels:{type:ControlType.Boolean,title:\"Show Labels\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},separator:{type:ControlType.String,title:\"Separator\",defaultValue:\":\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CountdownTimer\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CountdownTimer.map"],"mappings":"wMAIG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,kBAAgB,YAAU,aAAW,OAAK,YAAU,aAAW,YAAU,QAAM,EAAY,EAAa,OAAkC,CAAC,EAAS,GAAaA,EAAS,EAAa,CAAO,EAAaC,EAAO,KAAK,CAAC,MAAc,CAAC,IAAM,EAAS,gBAAgB,CAAC,MAAoB,CAAC,EAAY,GAAU,GAAM,EAAS,EAAoB,EAAK,EAAI,EAAG,EAAG,IAAI,CAAC,UAAU,cAAc,EAAS,EAAG,EAAE,CAAC,CAAC,IAAM,EAAUC,MAAY,CAAC,IAAM,EAAK,KAAK,MAAM,GAAU,KAAM,IAAI,CAAO,EAAM,KAAK,MAAM,GAAU,KAAM,IAAK,KAAO,CAAO,EAAQ,KAAK,MAAM,EAAU,KAAO,GAAG,CAAO,EAAQ,EAAS,GAAG,MAAM,CAAC,KAAK,OAAO,EAAK,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,OAAO,EAAM,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,OAAO,EAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,OAAO,EAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,EAAG,CAAC,EAAS,CAAC,CA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