{"version":3,"file":"StoreStatusIndicator.1QM-RZoR.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/FBa9RxtNw60dXBxDrmlk/5Xu8cVI3MjeU6a5X5Q9H/StoreStatusIndicator.js"],"sourcesContent":["// Component that shows whether a service or store is open based on current time\n// Displays green dot with custom text when open, red dot with custom text when closed\n// Opening hours are configurable via property controls\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useState,startTransition}from\"react\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function StoreStatusIndicator(props){const{openText,closedText,openTime,closeTime,weekendOpenTime,weekendCloseTime,dotSize,openColor,closedColor,textColor,font,fontSize,gap}=props;const[isOpen,setIsOpen]=useState(false);const[isLoading,setIsLoading]=useState(true);useEffect(()=>{if(typeof window===\"undefined\"){setIsOpen(true);setIsLoading(false);return;}const checkIfOpen=()=>{const now=new Date;const currentHours=now.getHours();const currentMinutes=now.getMinutes();const currentTimeInMinutes=currentHours*60+currentMinutes;const dayOfWeek=now.getDay()// 0 = Sunday, 6 = Saturday\n;// Use weekend times for Saturday (6) and Sunday (0)\nconst isWeekend=dayOfWeek===0||dayOfWeek===6;const effectiveOpenTime=isWeekend?weekendOpenTime:openTime;const effectiveCloseTime=isWeekend?weekendCloseTime:closeTime;const[openHours,openMinutes]=effectiveOpenTime.split(\":\").map(Number);const openTimeInMinutes=openHours*60+openMinutes;const[closeHours,closeMinutes]=effectiveCloseTime.split(\":\").map(Number);const closeTimeInMinutes=closeHours*60+closeMinutes;let open=false;if(closeTimeInMinutes>openTimeInMinutes){open=currentTimeInMinutes>=openTimeInMinutes&&currentTimeInMinutes<closeTimeInMinutes;}else{open=currentTimeInMinutes>=openTimeInMinutes||currentTimeInMinutes<closeTimeInMinutes;}startTransition(()=>{setIsOpen(open);setIsLoading(false);});};checkIfOpen();const interval=setInterval(checkIfOpen,6e4);return()=>clearInterval(interval);},[openTime,closeTime,weekendOpenTime,weekendCloseTime]);const displayText=isOpen?openText:closedText;const dotColor=isOpen?openColor:closedColor;return /*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"center\",gap:`${gap}px`,width:\"max-content\"},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                @keyframes pulse {\n                    0%, 100% {\n                        transform: scale(1);\n                        opacity: 1;\n                    }\n                    50% {\n                        transform: scale(1.1);\n                        opacity: 0.8;\n                    }\n                }\n                @keyframes spin {\n                    0% {\n                        transform: rotate(0deg);\n                    }\n                    100% {\n                        transform: rotate(360deg);\n                    }\n                }\n            `}),isLoading?/*#__PURE__*/_jsx(\"div\",{style:{width:`${dotSize}px`,height:`${dotSize}px`,border:`${Math.max(2,dotSize/6)}px solid rgba(0, 153, 255, 0.2)`,borderTop:`${Math.max(2,dotSize/6)}px solid #0099FF`,borderRadius:\"50%\",animation:\"spin 0.8s linear infinite\",flexShrink:0}}):/*#__PURE__*/_jsx(\"div\",{style:{width:`${dotSize}px`,height:`${dotSize}px`,borderRadius:\"50%\",backgroundColor:dotColor,flexShrink:0,animation:isOpen?\"pulse 2s ease-in-out infinite\":\"none\"}}),!isLoading&&/*#__PURE__*/_jsx(\"span\",{style:{color:textColor,...font,fontSize:`${fontSize}px`,whiteSpace:\"nowrap\",opacity:isLoading?.5:1},children:displayText})]});}addPropertyControls(StoreStatusIndicator,{openText:{type:ControlType.String,title:\"Open Text\",defaultValue:\"We're Open\"},closedText:{type:ControlType.String,title:\"Closed Text\",defaultValue:\"We're Closed\"},openTime:{type:ControlType.String,title:\"Weekday Opening\",defaultValue:\"09:00\",placeholder:\"HH:MM\"},closeTime:{type:ControlType.String,title:\"Weekday Closing\",defaultValue:\"17:00\",placeholder:\"HH:MM\"},weekendOpenTime:{type:ControlType.String,title:\"Weekend Opening\",defaultValue:\"10:00\",placeholder:\"HH:MM\"},weekendCloseTime:{type:ControlType.String,title:\"Weekend Closing\",defaultValue:\"16:00\",placeholder:\"HH:MM\"},dotSize:{type:ControlType.Number,title:\"Dot Size\",defaultValue:12,min:4,max:32,step:1,unit:\"px\"},openColor:{type:ControlType.Color,title:\"Open Color\",defaultValue:\"#22CC66\"},closedColor:{type:ControlType.Color,title:\"Closed Color\",defaultValue:\"#FF5588\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Text Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"16px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:16,min:8,max:72,step:1,unit:\"px\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:8,min:0,max:32,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"StoreStatusIndicator\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./StoreStatusIndicator.map"],"mappings":"yMAMG,SAAwB,EAAqB,EAAM,CAAC,GAAK,CAAC,WAAS,aAAW,WAAS,YAAU,kBAAgB,mBAAiB,UAAQ,YAAU,cAAY,YAAU,OAAK,WAAS,OAAK,EAAW,CAAC,EAAO,GAAWA,EAAS,GAAM,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAK,CAAC,MAAc,CAAC,GAAU,IAAS,OAAY,CAAC,EAAU,GAAK,CAAC,EAAa,GAAM,CAAC,OAAQ,IAAM,MAAgB,CAAC,IAAM,EAAI,IAAI,KAAW,EAAa,EAAI,UAAU,CAAO,EAAe,EAAI,YAAY,CAAO,EAAqB,EAAa,GAAG,EAAqB,EAAU,EAAI,QAAQ,CAExjB,EAAU,IAAY,GAAG,IAAY,EAAQ,EAAkB,EAAU,EAAgB,EAAe,EAAmB,EAAU,EA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