{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/sEoT3kmeKeZS17GbDdMn/tdRN2FUuCGQ5HraB8bEl/UncodeNumber.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{useFormValue}from\"https://framer.com/m/Store-nhJr.js\";// Lista de pa\u00EDses\nconst defaultCountryOptions=[{code:\"+49\",name:\"Germany\",flag:\"\uD83C\uDDE9\uD83C\uDDEA\",format:\"+49 (###) ###-####\"},{code:\"+33\",name:\"France\",flag:\"\uD83C\uDDEB\uD83C\uDDF7\",format:\"+33 ## ## ## ##\"},{code:\"+34\",name:\"Spain\",flag:\"\uD83C\uDDEA\uD83C\uDDF8\",format:\"+34 ### ## ## ##\"},{code:\"+39\",name:\"Italy\",flag:\"\uD83C\uDDEE\uD83C\uDDF9\",format:\"+39 ### ### ####\"},{code:\"+31\",name:\"Netherlands\",flag:\"\uD83C\uDDF3\uD83C\uDDF1\",format:\"+31 ## #### ####\"},{code:\"+351\",name:\"Portugal\",flag:\"\uD83C\uDDF5\uD83C\uDDF9\",format:\"+351 ### ### ###\"},{code:\"+44\",name:\"UK\",flag:\"\uD83C\uDDEC\uD83C\uDDE7\",format:\"+44 #### ### ####\"},{code:\"+55\",name:\"Brazil\",flag:\"\uD83C\uDDE7\uD83C\uDDF7\",format:\"+55 (##) # ####-####\"},{code:\"+1\",name:\"USA\",flag:\"\uD83C\uDDFA\uD83C\uDDF8\",format:\"+1 (###) ###-####\"}];const useStore=createStore({selectedValue:\"\"});const formatPhoneNumber=(numbers,format)=>{let result=format;let numberIndex=0;for(let i=0;i<format.length&&numberIndex<numbers.length;i++){if(format[i]===\"#\"){result=result.substring(0,i)+numbers[numberIndex]+result.substring(i+1);numberIndex++;}}return result.indexOf(\"#\")>=0?result.substring(0,result.indexOf(\"#\")):result;};export function withFormInput(Component){return props=>{const[inputValue,setInputValue]=useFormValue(props.name,props.defaultValue);const[wasBlurred,setWasBlurred]=useState(false);const handleChange=event=>{const newValue=event.target.value;const selectedCountry=defaultCountryOptions.find(country=>country.code===props.selectedCountry);if(selectedCountry){const formattedValue=formatPhoneNumber(newValue,selectedCountry.format);setInputValue(formattedValue);}const isValid=!newValue.includes(\"#\")&&newValue.trim()!==\"\";props.onValidationChange&&props.onValidationChange(isValid);};return /*#__PURE__*/_jsx(Component,{...props,value:inputValue,onChange:handleChange,required:props.isRequired});};}export function UncodeNumber(props){const{name,placeholder,padding,textColor,backgroundColor,borderColor,borderRadius,font,fontSize,placeholderColor,countryOptions=defaultCountryOptions,isRequired,codeBy,gap,onValidationChange}=props;const[selectedCountry,setSelectedCountry]=useState(countryOptions[0].code);const[inputValue,setInputValue]=useState(\"\");const containerRef=useRef(null);const handleCountryChange=event=>{setSelectedCountry(event.target.value);};const handleChange=event=>{const rawValue=event.target.value;const selectedCountryObj=countryOptions.find(country=>country.code===selectedCountry);if(selectedCountryObj){// Se estiver apagando, permite\nif(rawValue.length<inputValue.length){setInputValue(rawValue);return;}// Remove o c\u00F3digo do pa\u00EDs do come\u00E7o do valor se existir\nlet valueWithoutCountryCode=rawValue;if(rawValue.startsWith(selectedCountryObj.code)){valueWithoutCountryCode=rawValue.substring(selectedCountryObj.code.length);}// Remove tudo exceto n\u00FAmeros\nconst numbersOnly=valueWithoutCountryCode.replace(/\\D/g,\"\");// Limita ao m\u00E1ximo de n\u00FAmeros do formato\nconst maxNumbers=selectedCountryObj.format.split(\"\").filter(char=>char===\"#\").length;const limitedNumbers=numbersOnly.slice(0,maxNumbers);// Aplica a formata\u00E7\u00E3o usando o formato completo com c\u00F3digo do pa\u00EDs\nconst formattedValue=formatPhoneNumber(limitedNumbers,selectedCountryObj.format);setInputValue(formattedValue);// Valida\u00E7\u00E3o\nconst isValid=limitedNumbers.length===maxNumbers;onValidationChange&&onValidationChange(isValid);}};const styles={container:{display:\"flex\",flexDirection:\"row\",padding:`${padding}px`,color:textColor,backgroundColor:backgroundColor,borderRadius:`${borderRadius}px`,alignItems:\"center\"},input:{padding:\"10px\",borderRadius:\"24px\",color:textColor,backgroundColor:backgroundColor,flex:1,marginLeft:gap,border:`1px solid ${borderColor}`,transition:\"border 0.3s ease\",fontFamily:font.fontFamily,fontSize:`${fontSize}px`},select:{display:countryOptions.length>1?\"block\":\"none\",padding:\"10px\",borderRadius:\"24px\",border:`1px solid ${borderColor}`,color:\"#284348\",backgroundColor:\"#ffff\",fontSize:`${fontSize}px`,appearance:\"none\",WebkitAppearance:\"none\",MozAppearance:\"none\"}};return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,children:[/*#__PURE__*/_jsxs(\"div\",{style:styles.container,children:[/*#__PURE__*/_jsx(\"select\",{style:styles.select,value:selectedCountry,onChange:handleCountryChange,children:countryOptions.map(country=>/*#__PURE__*/_jsxs(\"option\",{value:country.code,children:[country.flag,\" \",country.code]},country.code))}),/*#__PURE__*/_jsx(\"input\",{type:\"text\",name:name,placeholder:placeholder,value:inputValue,onChange:handleChange,style:styles.input,required:isRequired})]}),/*#__PURE__*/_jsx(\"style\",{children:`\n                   ::placeholder {\n                       color: ${placeholderColor};\n                   }\n               `})]});}addPropertyControls(UncodeNumber,{countryOptions:{type:ControlType.Array,title:\"Country Options\",defaultValue:defaultCountryOptions,propertyControl:{type:ControlType.Object,controls:{code:{type:ControlType.String,title:\"Country Code\",description:\"C\\xf3digo do pa\\xeds / Country code\"},name:{type:ControlType.String,title:\"Country Name\",description:\"Nome do pa\\xeds / Country name\"},flag:{type:ControlType.String,title:\"Flag Emoji\",description:\"Emoji da bandeira do pa\\xeds / Country flag emoji\"},format:{type:ControlType.String,title:\"Phone Number Format\",description:\"Formato do n\\xfamero de telefone / Phone number format\"}}}},name:{type:ControlType.String,title:\"Name\",defaultValue:\"numberInputValue\",description:\"Nome do campo de entrada / Input field name\"},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Enter your phone number\",description:\"Texto de espa\\xe7o reservado / Placeholder text\"},padding:{type:ControlType.FusedNumber,title:\"Padding\",toggleKey:\"paddingPerSide\",toggleTitles:[\"All Sides\",\"Individual\"],valueKeys:[\"paddingTop\",\"paddingRight\",\"paddingBottom\",\"paddingLeft\"],valueLabels:[\"T\",\"R\",\"B\",\"L\"],min:0,defaultValue:10,description:\"Espa\\xe7amento interno do campo / Internal field spacing\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:10,description:\"Espa\\xe7amento entre o seletor e o campo / Spacing between selector and field\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#ffffff\",description:\"Cor do texto no campo / Text color in field\"},backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"#1B2622\",description:\"Cor de fundo do campo / Field background color\"},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#ffffff\",description:\"Cor da borda do campo / Field border color\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:24,description:\"Raio da borda do campo / Field border radius\"},font:{type:ControlType.Font,controls:\"extended\",displayFontSize:true,displayTextAlignment:false,defaultFontType:\"monospace\",defaultValue:{fontSize:14,lineHeight:\"1.5em\"},description:\"Fonte a ser utilizada no campo / Font to be used in field\"},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:16,description:\"Tamanho da fonte do campo / Field font size\"},placeholderColor:{type:ControlType.Color,title:\"Placeholder Color\",defaultValue:\"#ffffff\",description:\"Cor do texto do placeholder / Placeholder text color\"},isRequired:{type:ControlType.Boolean,title:\"Required\",defaultValue:false,description:\"Campo \\xe9 obrigat\\xf3rio / Field is required\"},codeBy:{type:ControlType.String,title:\" \",defaultValue:\"Autor:\",readOnly:true,description:\"Este componente foi criado por @omatusaelhorch / This component was created by @omatusaelhorch\"}})// Code by @omatusaelhorch\n;\nexport const __FramerMetadata__ = {\"exports\":{\"withFormInput\":{\"type\":\"reactComponent\",\"name\":\"withFormInput\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"UncodeNumber\":{\"type\":\"reactComponent\",\"name\":\"UncodeNumber\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./UncodeNumber.map"],
  "mappings": "uHACA,IAAMA,EAAsB,CAAC,CAAC,KAAK,MAAM,KAAK,UAAU,KAAK,qBAAO,OAAO,oBAAoB,EAAE,CAAC,KAAK,MAAM,KAAK,SAAS,KAAK,qBAAO,OAAO,iBAAiB,EAAE,CAAC,KAAK,MAAM,KAAK,QAAQ,KAAK,qBAAO,OAAO,kBAAkB,EAAE,CAAC,KAAK,MAAM,KAAK,QAAQ,KAAK,qBAAO,OAAO,kBAAkB,EAAE,CAAC,KAAK,MAAM,KAAK,cAAc,KAAK,qBAAO,OAAO,kBAAkB,EAAE,CAAC,KAAK,OAAO,KAAK,WAAW,KAAK,qBAAO,OAAO,kBAAkB,EAAE,CAAC,KAAK,MAAM,KAAK,KAAK,KAAK,qBAAO,OAAO,mBAAmB,EAAE,CAAC,KAAK,MAAM,KAAK,SAAS,KAAK,qBAAO,OAAO,sBAAsB,EAAE,CAAC,KAAK,KAAK,KAAK,MAAM,KAAK,qBAAO,OAAO,mBAAmB,CAAC,EAAQC,EAASC,EAAY,CAAC,cAAc,EAAE,CAAC,EAAQC,EAAkB,CAACC,EAAQC,IAAS,CAAC,IAAIC,EAAOD,EAAWE,EAAY,EAAE,QAAQC,EAAE,EAAEA,EAAEH,EAAO,QAAQE,EAAYH,EAAQ,OAAOI,IAAQH,EAAOG,CAAC,IAAI,MAAKF,EAAOA,EAAO,UAAU,EAAEE,CAAC,EAAEJ,EAAQG,CAAW,EAAED,EAAO,UAAUE,EAAE,CAAC,EAAED,KAAgB,OAAOD,EAAO,QAAQ,GAAG,GAAG,EAAEA,EAAO,UAAU,EAAEA,EAAO,QAAQ,GAAG,CAAC,EAAEA,CAAO,EAAksB,SAASG,EAAaC,EAAM,CAAC,GA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QAAQ,MAAM,WAAW,aAAa,GAAM,YAAY,+CAA+C,EAAE,OAAO,CAAC,KAAKA,EAAY,OAAO,MAAM,IAAI,aAAa,SAAS,SAAS,GAAK,YAAY,gGAAgG,CAAC,CAAC",
  "names": ["defaultCountryOptions", "useStore", "createStore", "formatPhoneNumber", "numbers", "format", "result", "numberIndex", "i", "UncodeNumber", "props", "name", "placeholder", "padding", "textColor", "backgroundColor", "borderColor", "borderRadius", "font", "fontSize", "placeholderColor", "countryOptions", "defaultCountryOptions", "isRequired", "codeBy", "gap", "onValidationChange", "selectedCountry", "setSelectedCountry", "ye", "inputValue", "setInputValue", "containerRef", "pe", "handleCountryChange", "event", "handleChange", "rawValue", "selectedCountryObj", "country", "valueWithoutCountryCode", "numbersOnly", "maxNumbers", "char", "limitedNumbers", "formattedValue", "formatPhoneNumber", "isValid", "styles", "u", "p", "addPropertyControls", "ControlType"]
}
