{"version":3,"file":"PhoneInput.oGIPiQmc.mjs","names":["useId","useState","useRef"],"sources":["https:/framerusercontent.com/modules/PohRC11rtBzaVo2TTxqS/C0Y9LIio4GnYwvIOKXeg/PhoneInput.js"],"sourcesContent":["// Clean, modern phone number input component with flexible layout control and design system integration\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useRef,useEffect,startTransition,useId}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function PhoneInput(props){const{placeholder,borderRadius,paddingTop,paddingRight,paddingBottom,paddingLeft,font,backgroundColor,borderColor,placeholderColor,gap,button,successButton,url,onSubmit,boxShadow,useLayeredShadow,shadowLayer1,shadowLayer2,shadowLayer3,shadowLayer4,shadowLayer5,shadowLayer6,termsUrl,termsLabel,termsLinkLabel,accentColor,termsTextColor}=props;const inputId=useId();const inputClassName=`framer-phone-input-${inputId.replace(/[:]/g,\"\")}`;const resolvedBoxShadow=useLayeredShadow?[shadowLayer1,shadowLayer2,shadowLayer3,shadowLayer4,shadowLayer5,shadowLayer6].map(s=>(s||\"\").trim()).filter(Boolean).join(\", \"):(boxShadow||\"\").trim();const[value,setValue]=useState(\"\");const[isSubmitting,setIsSubmitting]=useState(false);const[isSuccess,setIsSuccess]=useState(false);const[acceptedTerms,setAcceptedTerms]=useState(false);const successTimeoutRef=useRef(null);useEffect(()=>{return()=>{if(successTimeoutRef.current){clearTimeout(successTimeoutRef.current);}};},[]);const handleInputChange=e=>{const input=e.target.value;const cleaned=input.replace(/[^\\d+]/g,\"\");startTransition(()=>setValue(cleaned));// If the user starts typing again, dismiss the success state\nif(isSuccess)setIsSuccess(false);};// Submit is disabled if no number, no terms accepted, or already submitting\nconst canSubmit=value.trim().length>0&&acceptedTerms&&!isSubmitting;const handleSubmit=async()=>{const phoneNumber=value.trim();if(!canSubmit)return;let didSucceed=false;if(url){setIsSubmitting(true);try{const response=await fetch(url,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({number:phoneNumber,acceptedTerms:true})});if(response.ok){didSucceed=true;}else{console.error(\"Phone submission failed:\",response.status,response.statusText);}}catch(error){console.error(\"Phone submission error:\",error);}finally{setIsSubmitting(false);}}else{// No URL configured — still treat as a successful local submit\ndidSucceed=true;}if(didSucceed){setValue(\"\");setIsSuccess(true);if(successTimeoutRef.current){clearTimeout(successTimeoutRef.current);}successTimeoutRef.current=window.setTimeout(()=>{setIsSuccess(false);},2e3);onSubmit?.({phoneNumber});}};const handleKeyDown=e=>{if(e.key===\"Enter\"){handleSubmit();}};return /*#__PURE__*/_jsxs(\"div\",{style:{...props.style,width:\"100%\",display:\"flex\",flexDirection:\"column\",gap:12},children:[/*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",position:\"relative\",overflow:\"visible\",display:\"flex\",alignItems:\"center\",justifyContent:\"space-between\",backgroundColor,border:`1px solid ${borderColor}`,borderRadius:`${borderRadius}px`,paddingTop:`${paddingTop}px`,paddingRight:`${paddingRight}px`,paddingBottom:`${paddingBottom}px`,paddingLeft:`${paddingLeft}px`,gap:`${gap}px`,boxSizing:\"border-box\",boxShadow:resolvedBoxShadow},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                        .${inputClassName}::placeholder {\n                            color: ${placeholderColor};\n                        }\n                    `}),/*#__PURE__*/_jsx(\"input\",{type:\"tel\",value:value,onChange:handleInputChange,onKeyDown:handleKeyDown,placeholder:placeholder,className:inputClassName,style:{flex:1,border:\"none\",outline:\"none\",background:\"transparent\",...font,minWidth:0},\"aria-label\":\"Phone number input\",disabled:isSubmitting}),isSuccess?/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},\"aria-label\":\"Submitted successfully\",role:\"status\",children:successButton??/*#__PURE__*/_jsxs(\"svg\",{width:\"28\",height:\"28\",viewBox:\"0 0 24 24\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",children:[/*#__PURE__*/_jsx(\"circle\",{cx:\"12\",cy:\"12\",r:\"12\",fill:\"#10B981\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M7 12.5L10.5 16L17 9\",stroke:\"white\",strokeWidth:\"2.2\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})]})}):/*#__PURE__*/_jsx(\"div\",{onClick:handleSubmit,style:{display:\"flex\",cursor:canSubmit?\"pointer\":\"not-allowed\",opacity:canSubmit?1:.5,pointerEvents:isSubmitting||!canSubmit?\"none\":\"auto\",transition:\"opacity 0.15s ease\"},\"aria-disabled\":!canSubmit,children:button})]}),/*#__PURE__*/_jsxs(\"div\",{onClick:()=>setAcceptedTerms(!acceptedTerms),style:{display:\"flex\",alignItems:\"center\",gap:10,cursor:\"pointer\",userSelect:\"none\",paddingLeft:4},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:18,height:18,border:`1.5px solid ${acceptedTerms?accentColor:borderColor}`,borderRadius:5,backgroundColor:acceptedTerms?accentColor:\"transparent\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",flexShrink:0,transition:\"background-color 0.15s ease, border-color 0.15s ease\"},children:acceptedTerms&&/*#__PURE__*/_jsx(\"svg\",{width:\"11\",height:\"11\",viewBox:\"0 0 12 12\",fill:\"none\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M2 6L5 9L10 3\",stroke:\"white\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})})}),/*#__PURE__*/_jsxs(\"span\",{style:{fontSize:13,color:termsTextColor,letterSpacing:\"-0.01em\",lineHeight:\"1.4em\"},children:[termsLabel,\" \",/*#__PURE__*/_jsx(\"a\",{href:termsUrl||\"#\",target:\"_blank\",rel:\"noopener noreferrer\",onClick:e=>e.stopPropagation(),style:{color:accentColor,textDecoration:\"underline\"},children:termsLinkLabel})]})]})]});}addPropertyControls(PhoneInput,{placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Enter Phone number\"},url:{type:ControlType.String,title:\"POST URL\",defaultValue:\"\",placeholder:\"https://api.example.com/submit\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:22,min:0,max:50,step:1,unit:\"px\"},paddingTop:{type:ControlType.Number,title:\"Padding Top\",defaultValue:14,min:0,max:32,step:1,unit:\"px\"},paddingRight:{type:ControlType.Number,title:\"Padding Right\",defaultValue:14,min:0,max:32,step:1,unit:\"px\"},paddingBottom:{type:ControlType.Number,title:\"Padding Bottom\",defaultValue:14,min:0,max:32,step:1,unit:\"px\"},paddingLeft:{type:ControlType.Number,title:\"Padding Left\",defaultValue:14,min:0,max:32,step:1,unit:\"px\"},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"16px\",variant:\"Regular\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#E5E7EB\"},placeholderColor:{type:ControlType.Color,title:\"Placeholder Color\",defaultValue:\"#9CA3AF\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:10,min:0,max:24,step:1,unit:\"px\"},useLayeredShadow:{type:ControlType.Boolean,title:\"Shadow\",defaultValue:false,enabledTitle:\"Layers\",disabledTitle:\"Single\"},shadowLayer1:{type:ControlType.String,title:\"Shadow 1\",defaultValue:\"\",hidden:({useLayeredShadow})=>!useLayeredShadow},shadowLayer2:{type:ControlType.String,title:\"Shadow 2\",defaultValue:\"\",hidden:({useLayeredShadow})=>!useLayeredShadow},shadowLayer3:{type:ControlType.String,title:\"Shadow 3\",defaultValue:\"\",hidden:({useLayeredShadow})=>!useLayeredShadow},shadowLayer4:{type:ControlType.String,title:\"Shadow 4\",defaultValue:\"\",hidden:({useLayeredShadow})=>!useLayeredShadow},shadowLayer5:{type:ControlType.String,title:\"Shadow 5\",defaultValue:\"\",hidden:({useLayeredShadow})=>!useLayeredShadow},shadowLayer6:{type:ControlType.String,title:\"Shadow 6\",defaultValue:\"\",hidden:({useLayeredShadow})=>!useLayeredShadow},boxShadow:{type:ControlType.BoxShadow,title:\"Shadow (Single)\",defaultValue:\"none\",hidden:({useLayeredShadow})=>useLayeredShadow},button:{type:ControlType.ComponentInstance,title:\"Button\"},successButton:{type:ControlType.ComponentInstance,title:\"Success Button\"},termsLabel:{type:ControlType.String,title:\"Terms Text\",defaultValue:\"Acepto los\"},termsLinkLabel:{type:ControlType.String,title:\"Terms Link Text\",defaultValue:\"T\\xe9rminos y Condiciones\"},termsUrl:{type:ControlType.Link,title:\"Terms URL\",defaultValue:\"\"},accentColor:{type:ControlType.Color,title:\"Accent\",defaultValue:\"#4F46E5\"},termsTextColor:{type:ControlType.Color,title:\"Terms Text Color\",defaultValue:\"#6B7280\"},onSubmit:{type:ControlType.EventHandler}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PhoneInput\",\"slots\":[\"button\",\"successButton\"],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PhoneInput.map"],"mappings":"sNAIG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,cAAY,eAAa,aAAW,eAAa,gBAAc,cAAY,OAAK,kBAAgB,cAAY,mBAAiB,MAAI,SAAO,gBAAc,MAAI,WAAS,YAAU,mBAAiB,eAAa,eAAa,eAAa,eAAa,eAAa,eAAa,WAAS,aAAW,iBAAe,cAAY,kBAAgB,EAAkC,EAAe,sBAA7BA,EAAyD,CAAC,CAAC,QAAQ,OAAO,EAAE,IAAU,EAAkB,EAAiB,CAAC,EAAa,EAAa,EAAa,EAAa,EAAa,CAAY,CAAC,CAAC,IAAI,IAAI,GAAG,GAAA,CAAI,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO,CAAC,CAA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