{"version":3,"file":"TorontoDateTime.H1psb-UX.mjs","names":["useState","startTransition","useMemo"],"sources":["https:/framerusercontent.com/modules/5SuAjS4ITN9dmJVCJOd8/frCSsrrF4B2oayzYzuSR/TorontoDateTime.js"],"sourcesContent":["import{jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useMemo,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * Instructions:\n * Create a simple text component that shows the local time and date in specifically Toronto.\n *//**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function TorontoDateTime(props){const{locale,timeZone,showSeconds,dateStyle,timeStyle,separator,prefixEnabled,prefixText,suffixEnabled,suffixText,textColor,font,backgroundColor,padding,borderRadius,style}=props;const isStatic=useIsStaticRenderer();const[now,setNow]=useState(()=>new Date);useEffect(()=>{if(isStatic)return;if(typeof window===\"undefined\")return;const tick=()=>startTransition(()=>setNow(new Date));tick();const intervalMs=showSeconds?1e3:1e3*30;const id=window.setInterval(tick,intervalMs);return()=>window.clearInterval(id);},[isStatic,showSeconds]);const formatted=useMemo(()=>{try{const resolvedLocale=(locale||\"\").trim()||undefined;const dtf=new Intl.DateTimeFormat(resolvedLocale,{timeZone,dateStyle,timeStyle});return dtf.format(now);}catch{try{const dtfFallback=new Intl.DateTimeFormat(undefined,{timeZone:\"America/Toronto\",dateStyle:\"medium\",timeStyle:\"short\"});return dtfFallback.format(now);}catch{return now.toISOString();}}},[now,locale,timeZone,dateStyle,timeStyle]);const isFixedWidth=style?.width===\"100%\";const isFixedHeight=style?.height===\"100%\";const containerStyle={position:\"relative\",display:\"inline-flex\",alignItems:\"center\",justifyContent:\"flex-start\",color:textColor,background:backgroundColor,padding,borderRadius,whiteSpace:\"pre\",...isFixedWidth?{width:\"100%\"}:{width:\"max-content\",minWidth:\"max-content\"},...isFixedHeight?{height:\"100%\"}:{},...font,...style};const text=separator&&separator!==\" \"?formatted.replace(\", \",separator):formatted;const prefix=prefixEnabled?prefixText:\"\";const suffix=suffixEnabled?suffixText:\"\";return /*#__PURE__*/_jsxs(\"span\",{style:containerStyle,\"aria-label\":`Toronto date and time: ${formatted}`,children:[prefix,text,suffix]});}addPropertyControls(TorontoDateTime,{locale:{type:ControlType.String,title:\"Locale\",defaultValue:\"\",placeholder:\"e.g. en-CA (leave blank for default)\"},timeZone:{type:ControlType.String,title:\"Time Zone\",defaultValue:\"America/Toronto\",placeholder:\"America/Toronto\"},dateStyle:{type:ControlType.Enum,title:\"Date Style\",defaultValue:\"medium\",options:[\"full\",\"long\",\"medium\",\"short\"],optionTitles:[\"Full\",\"Long\",\"Medium\",\"Short\"],displaySegmentedControl:true},timeStyle:{type:ControlType.Enum,title:\"Time Style\",defaultValue:\"short\",options:[\"full\",\"long\",\"medium\",\"short\"],optionTitles:[\"Full\",\"Long\",\"Medium\",\"Short\"],displaySegmentedControl:true},showSeconds:{type:ControlType.Boolean,title:\"Seconds\",defaultValue:false,enabledTitle:\"Show\",disabledTitle:\"Hide\"},separator:{type:ControlType.String,title:\"Separator\",defaultValue:\" • \",placeholder:\"e.g. •\"},prefixEnabled:{type:ControlType.Boolean,title:\"Prefix\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},prefixText:{type:ControlType.String,title:\"Prefix Text\",defaultValue:\"\",placeholder:\"e.g. Updated: \",hidden:({prefixEnabled})=>!prefixEnabled},suffixEnabled:{type:ControlType.Boolean,title:\"Suffix\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},suffixText:{type:ControlType.String,title:\"Suffix Text\",defaultValue:\"\",placeholder:\"e.g. EST\",hidden:({suffixEnabled})=>!suffixEnabled},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#000000\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"rgba(0, 0, 0, 0)\"},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"0px\"},borderRadius:{type:ControlType.BorderRadius,title:\"Radius\",defaultValue:\"0px\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TorontoDateTime\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TorontoDateTime.map"],"mappings":"qNAMG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,SAAO,WAAS,cAAY,YAAU,YAAU,YAAU,gBAAc,aAAW,gBAAc,aAAW,YAAU,OAAK,kBAAgB,UAAQ,eAAa,SAAO,EAAY,EAAS,GAAqB,CAAM,CAAC,EAAI,GAAQA,MAAa,IAAI,KAAK,CAAC,MAAc,CAAoB,GAAhB,GAA0B,IAAS,OAAY,OAAO,IAAM,MAASC,MAAoB,EAAO,IAAI,KAAK,CAAC,CAAC,GAAM,CAAC,IAAM,EAAW,EAAY,IAAI,IAAI,GAAS,EAAG,EAAO,YAAY,EAAK,EAAW,CAAC,UAAU,EAAO,cAAc,EAAG,EAAG,CAAC,EAAS,EAAY,CAAC,CAAC,IAAM,EAAUC,MAAY,CAAC,GAAG,CAAC,IAAM,GAAgB,GAAQ,IAAI,MAAM,EAAE,IAAA,GAA2F,OAAvE,IAAI,KAAK,eAAe,EAAe,CAAC,WAAS,YAAU,YAAU,CAAC,CAAY,OAAO,EAAI,MAAO,CAAC,GAAG,CAAwH,OAArG,IAAI,KAAK,eAAe,IAAA,GAAU,CAAC,SAAS,kBAAkB,UAAU,SAAS,UAAU,QAAQ,CAAC,CAAoB,OAAO,EAAI,MAAO,CAAC,OAAO,EAAI,aAAa,IAAK,CAAC,EAAI,EAAO,EAAS,EAAU,EAAU,CAAC,CAAO,EAAa,GAAO,QAAQ,OAA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