{"version":3,"file":"LineCheckedCMS.Hyo5M7tu.mjs","names":["useMemo","useState","useCallback"],"sources":["https:/framerusercontent.com/modules/Rt4Dj61Q7ItxP3sN4VoC/pgxRZLhaoYVpFBYU6Dr2/LineCheckedCMS.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useLayoutEffect,useMemo,useCallback}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function LineCheckedCMS(props){const{text=\"Words\",textColor=\"#333\",hoverColor=\"#000\",activeColor=\"#22C55E\",lineThrough=true,checkmarkPos=\"Left\",resetHours=24,font,style}=props;const storageKey=useMemo(()=>{const sanitized=text.trim().toLowerCase().replace(/\\s+/g,\"_\");return`sf_v44_lc_${sanitized}`;},[text]);const[isChecked,setIsChecked]=useState(false);const[isHovered,setIsHovered]=useState(false);const[isUserAction,setIsUserAction]=useState(false);useLayoutEffect(()=>{if(typeof window===\"undefined\")return;try{const stored=localStorage.getItem(storageKey);if(!stored)return;const{value,timestamp}=JSON.parse(stored);const isExpired=Date.now()-timestamp>resetHours*36e5;if(isExpired){localStorage.removeItem(storageKey);}else if(value){setIsChecked(true);}}catch{localStorage.removeItem(storageKey);}},[storageKey,resetHours]);const handleToggle=useCallback(()=>{if(isChecked||typeof window===\"undefined\")return;setIsUserAction(true);setIsChecked(true);try{localStorage.setItem(storageKey,JSON.stringify({value:true,timestamp:Date.now()}));}catch(error){console.error(\"Failed to save state:\",error);}},[isChecked,storageKey]);const handleMouseEnter=useCallback(()=>{if(!isChecked)setIsHovered(true);},[isChecked]);const handleMouseLeave=useCallback(()=>setIsHovered(false),[]);const currentColor=isChecked?activeColor:isHovered?hoverColor:textColor;const transition=isUserAction?\"0.4s cubic-bezier(0.4, 0, 0.2, 1)\":\"none\";const showCheckmark=checkmarkPos!==\"None\";return /*#__PURE__*/_jsxs(\"div\",{style:{...style,width:\"100%\",height:\"100%\",position:\"relative\",display:\"flex\",alignItems:\"center\",gap:\"0.5em\",color:currentColor,cursor:isChecked?\"default\":\"pointer\",userSelect:\"none\",fontFamily:font?.fontFamily,fontSize:font?.fontSize,fontWeight:font?.fontWeight,fontStyle:font?.fontStyle,letterSpacing:font?.letterSpacing,lineHeight:font?.lineHeight,whiteSpace:\"nowrap\",transition:isUserAction?\"color 0.2s ease\":\"none\"},onClick:handleToggle,onMouseEnter:handleMouseEnter,onMouseLeave:handleMouseLeave,role:\"checkbox\",\"aria-checked\":isChecked,\"aria-label\":text,tabIndex:isChecked?-1:0,onKeyDown:e=>{if((e.key===\"Enter\"||e.key===\" \")&&!isChecked){e.preventDefault();handleToggle();}},children:[showCheckmark&&checkmarkPos===\"Left\"&&/*#__PURE__*/_jsx(Checkmark,{color:currentColor,isVisible:isChecked,transition:transition}),/*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",display:\"inline-block\"},children:[/*#__PURE__*/_jsx(\"span\",{children:text}),lineThrough&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:\"55%\",left:0,right:0,height:\"1.5px\",backgroundColor:\"currentColor\",width:isChecked?\"100%\":\"0%\",opacity:isChecked?1:0,transition,transformOrigin:\"left\",pointerEvents:\"none\"},\"aria-hidden\":\"true\"})]}),showCheckmark&&checkmarkPos===\"Right\"&&/*#__PURE__*/_jsx(Checkmark,{color:currentColor,isVisible:isChecked,transition:transition})]});}function Checkmark({color,isVisible,transition}){return /*#__PURE__*/_jsx(\"div\",{style:{opacity:isVisible?1:0,transform:isVisible?\"scale(1)\":\"scale(0.8)\",transition,display:\"flex\"},\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"svg\",{width:\"1.1em\",height:\"1.1em\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:color,strokeWidth:\"4\",style:{flexShrink:0},\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"polyline\",{points:\"20 6 9 17 4 12\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})})});}addPropertyControls(LineCheckedCMS,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Words\"},textColor:{type:ControlType.Color,title:\"Color (Default)\",defaultValue:\"#333\"},hoverColor:{type:ControlType.Color,title:\"Color (Hover)\",defaultValue:\"#000\"},activeColor:{type:ControlType.Color,title:\"Color (Checked)\",defaultValue:\"#22C55E\"},lineThrough:{type:ControlType.Boolean,title:\"Line Through\",defaultValue:true},checkmarkPos:{type:ControlType.Enum,title:\"Icon Position\",options:[\"None\",\"Left\",\"Right\"],defaultValue:\"Left\"},resetHours:{type:ControlType.Number,title:\"Reset (Hours)\",min:1,max:720,defaultValue:24},font:{type:ControlType.Font,title:\"Typography\",controls:\"extended\",defaultFontType:\"sans-serif\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LineCheckedCMS\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LineCheckedCMS.map"],"mappings":"gNAGG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,OAAK,QAAQ,YAAU,OAAO,aAAW,OAAO,cAAY,UAAU,cAAY,GAAK,eAAa,OAAO,aAAW,GAAG,OAAK,SAAO,EAAY,EAAWA,MAAiF,aAApD,EAAK,MAAM,CAAC,aAAa,CAAC,QAAQ,OAAO,IAAI,GAAkC,CAAC,EAAK,CAAC,CAAM,CAAC,EAAU,GAAcC,EAAS,GAAM,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAM,CAAC,EAAa,GAAiBA,EAAS,GAAM,CAAC,MAAoB,CAAI,GAAO,IAAS,OAAmB,GAAG,CAAC,IAAM,EAAO,aAAa,QAAQ,EAAW,CAAC,GAAG,CAAC,EAAO,OAAO,GAAK,CAAC,QAAM,aAAW,KAAK,MAAM,EAAO,CAAiB,KAAK,K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