{"version":3,"file":"TimeDisplay.CYcAX9Ma.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/wjkfHTVh6uAxsELvoP7W/w6CoEpdyG6qDofYckFne/TimeDisplay.js"],"sourcesContent":["// Text override that displays the current time, with a toggle to switch between local time and a user-selected location\nimport{jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * TimeDisplay\n *\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 40\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function TimeDisplay(props){const{useCustomLocation,location,customLocation,font,color,style}=props;const[time,setTime]=useState(\"\");// List of supported IANA time zones for dropdown\nconst supportedTimeZones=[\"Europe/London\",\"America/New_York\",\"America/Los_Angeles\",\"Europe/Paris\",\"Asia/Tokyo\",\"Australia/Sydney\",\"Asia/Kolkata\",\"Europe/Berlin\",\"America/Chicago\",\"America/Sao_Paulo\",\"Africa/Johannesburg\",\"Pacific/Auckland\"];useEffect(()=>{let timer;function updateTime(){if(useCustomLocation){if(location===\"Custom\"){startTransition(()=>setTime(\"Custom not supported\"));return;}try{const now=new Date;const formatted=new Intl.DateTimeFormat(undefined,{hour:\"2-digit\",minute:\"2-digit\",second:\"2-digit\",hour12:false,timeZone:location}).format(now);startTransition(()=>setTime(formatted));}catch{startTransition(()=>setTime(\"Invalid location\"));}}else{const now=new Date;startTransition(()=>setTime(now.toLocaleTimeString()));}}updateTime();timer=window.setInterval(updateTime,1e3);return()=>clearInterval(timer);},[useCustomLocation,location]);// Map location to city label\nconst cityLabels={\"Europe/London\":\"LON\",\"America/New_York\":\"NY\",\"America/Los_Angeles\":\"LA\",\"Europe/Paris\":\"PAR\",\"Asia/Tokyo\":\"TYO\",\"Australia/Sydney\":\"SYD\",\"Asia/Kolkata\":\"CCU\",\"Europe/Berlin\":\"BER\",\"America/Chicago\":\"CHI\",\"America/Sao_Paulo\":\"SAO\",\"Africa/Johannesburg\":\"JNB\",\"Pacific/Auckland\":\"AKL\"};let cityLabel=\"\";if(useCustomLocation){if(location===\"Custom\"){cityLabel=customLocation||\"Custom\";}else{cityLabel=cityLabels[location]||location;}}return /*#__PURE__*/_jsxs(\"span\",{style:{...font,color,...style,width:\"max-content\",minWidth:\"max-content\",display:\"inline-block\"},children:[time,\" \",useCustomLocation?cityLabel:\"\"]});}addPropertyControls(TimeDisplay,{useCustomLocation:{type:ControlType.Boolean,title:\"Custom Location\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Local\"},location:{type:ControlType.Enum,title:\"Location\",options:[\"Europe/London\",\"America/New_York\",\"America/Los_Angeles\",\"Europe/Paris\",\"Asia/Tokyo\",\"Australia/Sydney\",\"Asia/Kolkata\",\"Europe/Berlin\",\"America/Chicago\",\"America/Sao_Paulo\",\"Africa/Johannesburg\",\"Pacific/Auckland\",\"Custom\"],optionTitles:[\"London\",\"New York\",\"Los Angeles\",\"Paris\",\"Tokyo\",\"Sydney\",\"Kolkata\",\"Berlin\",\"Chicago\",\"Sao Paulo\",\"Johannesburg\",\"Auckland\",\"Custom...\"],defaultValue:\"Europe/London\",hidden:({useCustomLocation})=>!useCustomLocation},customLocation:{type:ControlType.String,title:\"Custom Location\",placeholder:\"e.g. Europe/Lisbon\",defaultValue:\"Europe/Lisbon\",hidden:({useCustomLocation,location})=>!useCustomLocation||location!==\"Custom\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"32px\",variant:\"Semibold\",letterSpacing:\"-0.03em\",lineHeight:\"1em\"}},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TimeDisplay\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerIntrinsicHeight\":\"40\",\"framerSupportedLayoutHeight\":\"auto\",\"framerIntrinsicWidth\":\"200\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