{"version":3,"file":"TermsCheckbox.BBTemGw5.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/dcjxWHhdRaBG8JNijN5t/iXxkC7dl1aYrxExM8DDu/TermsCheckbox.js"],"sourcesContent":["// Checkbox component for Terms and Conditions and Privacy Policy with linkable pages\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,startTransition,useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Terms and Conditions Checkbox\n *\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 40\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function TermsCheckbox(props){const{label=\"I agree to\",termsText=\"Terms and Conditions\",termsLink=\"\",andText=\"and\",privacyText=\"Privacy Police\",privacyLink=\"\",defaultChecked=false,required=true,checkboxColor=\"#D97706\",textColor=\"#000000\",linkColor=\"#D97706\",font,linkFont,checkboxSize=24,spacing=12,toastMessage=\"Please accept the terms and conditions\",toastBackgroundColor=\"#EF4444\",toastTextColor=\"#FFFFFF\",toastFont}=props;const[checked,setChecked]=useState(defaultChecked);const[showToast,setShowToast]=useState(false);const handleCheckboxChange=()=>{startTransition(()=>setChecked(!checked));};// Handle invalid event from the hidden input\nuseEffect(()=>{const handleInvalid=e=>{e.preventDefault();if(!checked&&required){startTransition(()=>setShowToast(true));}};const inputs=document.querySelectorAll('input[type=\"checkbox\"]');inputs.forEach(input=>{input.addEventListener(\"invalid\",handleInvalid);});return()=>{inputs.forEach(input=>{input.removeEventListener(\"invalid\",handleInvalid);});};},[checked,required]);// Auto-hide toast after 3 seconds\nuseEffect(()=>{if(showToast){const timer=setTimeout(()=>{startTransition(()=>setShowToast(false));},3e3);return()=>clearTimeout(timer);}},[showToast]);const isFixedWidth=props?.style&&props.style.width===\"100%\";return /*#__PURE__*/_jsxs(\"div\",{style:{...props.style,position:\"relative\",display:\"flex\",flexDirection:\"column\",gap:8},children:[showToast&&/*#__PURE__*/_jsxs(\"div\",{style:{backgroundColor:toastBackgroundColor,color:toastTextColor,padding:\"12px 16px\",borderRadius:8,boxShadow:\"0 4px 12px rgba(0, 0, 0, 0.15)\",display:\"flex\",alignItems:\"center\",justifyContent:\"space-between\",gap:12,animation:\"slideDown 0.3s ease-out\",...toastFont},children:[/*#__PURE__*/_jsx(\"span\",{children:toastMessage}),/*#__PURE__*/_jsx(\"button\",{onClick:e=>{e.stopPropagation();startTransition(()=>setShowToast(false));},style:{background:\"transparent\",border:\"none\",color:toastTextColor,cursor:\"pointer\",fontSize:\"20px\",lineHeight:1,padding:0,opacity:.8},\"aria-label\":\"Close\",children:\"\\xd7\"})]}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"center\",gap:spacing,cursor:\"pointer\",...isFixedWidth?{}:{minWidth:\"max-content\"}},onClick:handleCheckboxChange,children:[/*#__PURE__*/_jsx(\"input\",{type:\"checkbox\",checked:checked,required:required,onChange:()=>{},style:{position:\"absolute\",opacity:0,width:0,height:0,pointerEvents:\"none\"},\"aria-hidden\":\"true\"}),/*#__PURE__*/_jsx(\"div\",{style:{width:checkboxSize,height:checkboxSize,minWidth:checkboxSize,minHeight:checkboxSize,borderRadius:4,border:`2px solid ${checked?checkboxColor:\"#CCCCCC\"}`,backgroundColor:checked?checkboxColor:\"#FFFFFF\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",transition:\"all 0.2s ease\",marginTop:2},children:checked&&/*#__PURE__*/_jsxs(\"svg\",{width:checkboxSize*.6,height:checkboxSize*.6,viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"#FFFFFF\",strokeWidth:\"3\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:[/*#__PURE__*/_jsx(\"title\",{children:\"Checked\"}),/*#__PURE__*/_jsx(\"polyline\",{points:\"20 6 9 17 4 12\"})]})}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexWrap:\"wrap\",alignItems:\"baseline\",gap:\"0.3em\",color:textColor},children:[/*#__PURE__*/_jsx(\"span\",{style:font,children:label}),/*#__PURE__*/_jsx(\"a\",{href:termsLink,target:\"_blank\",rel:\"noopener noreferrer\",style:{...linkFont,color:linkColor,textDecoration:\"underline\",cursor:\"pointer\"},onClick:e=>e.stopPropagation(),children:termsText}),/*#__PURE__*/_jsx(\"span\",{style:font,children:andText}),/*#__PURE__*/_jsx(\"a\",{href:privacyLink,target:\"_blank\",rel:\"noopener noreferrer\",style:{...linkFont,color:linkColor,textDecoration:\"underline\",cursor:\"pointer\"},onClick:e=>e.stopPropagation(),children:privacyText})]})]})]});}addPropertyControls(TermsCheckbox,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"I agree to\"},termsText:{type:ControlType.String,title:\"Terms Text\",defaultValue:\"Terms and Conditions\"},termsLink:{type:ControlType.Link,title:\"Terms Link\"},andText:{type:ControlType.String,title:\"And Text\",defaultValue:\"and\"},privacyText:{type:ControlType.String,title:\"Privacy Text\",defaultValue:\"Privacy Police\"},privacyLink:{type:ControlType.Link,title:\"Privacy Link\"},defaultChecked:{type:ControlType.Boolean,title:\"Default Checked\",defaultValue:false,enabledTitle:\"Checked\",disabledTitle:\"Unchecked\"},required:{type:ControlType.Boolean,title:\"Required\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},checkboxColor:{type:ControlType.Color,title:\"Checkbox Color\",defaultValue:\"#D97706\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},linkColor:{type:ControlType.Color,title:\"Link Color\",defaultValue:\"#D97706\"},font:{type:ControlType.Font,title:\"Text Font\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},linkFont:{type:ControlType.Font,title:\"Link Font\",defaultValue:{fontSize:\"15px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},checkboxSize:{type:ControlType.Number,title:\"Checkbox Size\",defaultValue:24,min:16,max:40,step:2,unit:\"px\"},spacing:{type:ControlType.Number,title:\"Spacing\",defaultValue:12,min:4,max:24,step:2,unit:\"px\"},toastMessage:{type:ControlType.String,title:\"Toast Message\",defaultValue:\"Please accept the terms and conditions\"},toastBackgroundColor:{type:ControlType.Color,title:\"Toast Background\",defaultValue:\"#EF4444\"},toastTextColor:{type:ControlType.Color,title:\"Toast Text Color\",defaultValue:\"#FFFFFF\"},toastFont:{type:ControlType.Font,title:\"Toast Font\",defaultValue:{fontSize:\"14px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},controls:\"extended\",defaultFontType:\"sans-serif\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TermsCheckbox\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"40\",\"framerIntrinsicWidth\":\"400\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TermsCheckbox.map"],"mappings":"+LASG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,QAAM,aAAa,YAAU,uBAAuB,YAAU,GAAG,UAAQ,MAAM,cAAY,iBAAiB,cAAY,GAAG,iBAAe,GAAM,WAAS,GAAK,gBAAc,UAAU,YAAU,UAAU,YAAU,UAAU,OAAK,WAAS,eAAa,GAAG,UAAQ,GAAG,eAAa,yCAAyC,uBAAqB,UAAU,iBAAe,UAAU,aAAW,EAAW,CAAC,EAAQ,GAAYA,EAAS,EAAe,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAO,MAAyB,CAAC,MAAoB,EAAW,CAAC,EAAQ,CAAC,EACtmB,MAAc,CAAC,IAAM,EAAc,GAAG,CAAC,EAAE,gBAAgB,CAAI,CAAC,GAAS,GAAU,MAAoB,EAAa,GAAK,CAAC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