{"version":3,"file":"PhoneNumberInput.SwspIA21.mjs","names":["useState","useCallback"],"sources":["https:/framerusercontent.com/modules/ofn5hlgq5kzyWwNu9vZf/lvs9lPP5a6lGuKN6yRji/PhoneNumberInput.js"],"sourcesContent":["// Professional React Code Component acting as a Phone Number Input with a Brazilian mask\n// - Accepts only numeric characters\n// - Applies mask automatically: (XX) XXXXX-XXXX\n// - Limits input to 11 digits (excluding formatting)\n// - Mask updates when user deletes characters\n// - Exposes onChange event to pass raw value\n// - Works correctly within HTML Form or Framer Form containers\n// - Variable Name property for form data submission\n// - Customizable text styling: Font, Size, Weight, Color\n// - Customizable container: Background, Border Color, Border Width, Radius\n// - Customizable Placeholder text and color\n// - Focus Color control for active border\n// - Padding controls (horizontal and vertical)\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useCallback,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function PhoneNumberInput(props){const{variableName,placeholder,placeholderColor,textColor,backgroundColor,borderColor,borderWidth,borderRadius,focusColor,paddingHorizontal,paddingVertical,font,onChange,onValueChange,style,required}=props;const[value,setValue]=useState(\"\");const[isFocused,setIsFocused]=useState(false);const applyMask=useCallback(rawValue=>{const digits=rawValue.replace(/\\D/g,\"\").slice(0,11);if(digits.length===0)return\"\";if(digits.length<=2)return`(${digits}`;if(digits.length<=7)return`(${digits.slice(0,2)}) ${digits.slice(2)}`;return`(${digits.slice(0,2)}) ${digits.slice(2,7)}-${digits.slice(7)}`;},[]);const handleChange=useCallback(e=>{const inputValue=e.target.value;const digits=inputValue.replace(/\\D/g,\"\");if(digits.length<=11){const maskedValue=applyMask(inputValue);startTransition(()=>setValue(maskedValue));// Trigger both onChange and onValueChange with raw digits\nif(onChange){onChange(digits);}if(onValueChange){onValueChange(digits);}}},[applyMask,onChange,onValueChange]);const handleFocus=useCallback(()=>{startTransition(()=>setIsFocused(true));},[]);const handleBlur=useCallback(()=>{startTransition(()=>setIsFocused(false));},[]);const currentBorderColor=isFocused?focusColor:borderColor;return /*#__PURE__*/_jsxs(\"div\",{style:{...style,position:\"relative\",width:\"100%\"},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                    .phone-input::placeholder {\n                        color: ${placeholderColor};\n                        opacity: 1;\n                    }\n                    .phone-input::-webkit-outer-spin-button,\n                    .phone-input::-webkit-inner-spin-button {\n                        -webkit-appearance: none;\n                        margin: 0;\n                    }\n                    .phone-input[type=number] {\n                        -moz-appearance: textfield;\n                    }\n                `}),/*#__PURE__*/_jsx(\"input\",{type:\"tel\",name:variableName,inputMode:\"numeric\",className:\"phone-input\",value:value,onChange:handleChange,onFocus:handleFocus,onBlur:handleBlur,placeholder:placeholder,required:required,style:{width:\"100%\",backgroundColor,color:textColor,border:`${borderWidth}px solid ${currentBorderColor}`,borderRadius:`${borderRadius}px`,paddingLeft:`${paddingHorizontal}px`,paddingRight:`${paddingHorizontal}px`,paddingTop:`${paddingVertical}px`,paddingBottom:`${paddingVertical}px`,outline:\"none\",boxSizing:\"border-box\",transition:\"border-color 0.2s ease\",...font}})]});}addPropertyControls(PhoneNumberInput,{variableName:{type:ControlType.String,title:\"Variable Name\",defaultValue:\"phone\"},required:{type:ControlType.Boolean,title:\"Required\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"(00) 00000-0000\"},placeholderColor:{type:ControlType.Color,title:\"Placeholder Color\",defaultValue:\"#CCCCCC\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#EEEEEE\"},borderWidth:{type:ControlType.Number,title:\"Border Width\",defaultValue:1,min:0,max:10,step:1,unit:\"px\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:50,step:1,unit:\"px\"},focusColor:{type:ControlType.Color,title:\"Focus Color\",defaultValue:\"#000000\"},paddingHorizontal:{type:ControlType.Number,title:\"Padding X\",defaultValue:16,min:0,max:100,step:1,unit:\"px\"},paddingVertical:{type:ControlType.Number,title:\"Padding Y\",defaultValue:12,min:0,max:100,step:1,unit:\"px\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"}},onChange:{type:ControlType.EventHandler},onValueChange:{type:ControlType.EventHandler}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PhoneNumberInput\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PhoneNumberInput.map"],"mappings":"0LAgBG,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,eAAa,cAAY,mBAAiB,YAAU,kBAAgB,cAAY,cAAY,eAAa,aAAW,oBAAkB,kBAAgB,OAAK,WAAS,gBAAc,QAAM,YAAU,EAAW,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAO,EAAUC,EAAY,GAAU,CAAC,IAAM,EAAO,EAAS,QAAQ,MAAM,GAAG,CAAC,MAAM,EAAE,GAAG,CAA4I,OAAxI,EAAO,SAAS,EAAQ,GAAM,EAAO,QAAQ,EAAQ,IAAI,IAAY,EAAO,QAAQ,EAAQ,IAAI,EAAO,MAAM,EAAE,EAAE,CAAC,IAAI,EAAO,MAAM,EAAE,GAAS,IAAI,EAAO,MAAM,EAAE,EAAE,CAAC,IAAI,EAAO,MAAM,EAAE,EAAE,CAAC,GAAG,EAAO,MAAM,EAAE,IAAK,EAAE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