{"version":3,"file":"Delivery_Address.ColnlrfC.mjs","names":["useRef","useState","useId"],"sources":["https:/framerusercontent.com/modules/zYXMh7tohKKLTFfM2rjM/8Ns44NrKMVudZBlUzGH7/Delivery_Address.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useId,useRef,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function DeliveryAddressInput(props){const inputRef=useRef(null);const[address,setAddress]=useState(\"\");const uid=useId().replace(/:/g,\"\");const inputClass=`delivery-input-${uid}`;useEffect(()=>{loadGoogleMaps(props.apiKey,()=>{if(!inputRef.current)return;const autocomplete=new window.google.maps.places.Autocomplete(inputRef.current,{types:[\"geocode\"],componentRestrictions:{country:\"aus\"}});autocomplete.addListener(\"place_changed\",()=>{const place=autocomplete.getPlace();const formattedAddress=place.formatted_address||inputRef.current.value;setAddress(formattedAddress);props.onAddressSelected&&props.onAddressSelected(place);});});},[props.apiKey]);return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",backgroundColor:props.formBackground,padding:`${props.formPadding}px`,borderRadius:`${props.formCornerRadius}px`,boxSizing:\"border-box\"},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                  .${inputClass}::placeholder {\n                      color: ${props.placeholderColor};\n                      opacity: 1;\n                  }\n                  .${inputClass}::-webkit-input-placeholder { color: ${props.placeholderColor}; opacity: 1; }\n                  .${inputClass}::-moz-placeholder { color: ${props.placeholderColor}; opacity: 1; }\n                  .${inputClass}:-ms-input-placeholder { color: ${props.placeholderColor}; opacity: 1; }\n              `}),props.labelText&&/*#__PURE__*/_jsx(\"label\",{style:{...props.labelFont,color:props.labelColor,marginBottom:\"8px\",display:\"block\"},children:props.labelText}),/*#__PURE__*/_jsx(\"input\",{ref:inputRef,className:inputClass,name:props.name,value:address,onChange:e=>setAddress(e.target.value),placeholder:props.placeholderText,style:{...props.inputFont,width:\"100%\",height:`${props.inputHeight}px`,padding:\"12px\",textAlign:\"left\",color:props.inputTextColor,backgroundColor:props.inputBackgroundColor,border:props.inputBorderStyle===\"none\"?\"none\":`${props.inputBorderWidth}px ${props.inputBorderStyle} ${props.inputBorderColor}`,borderRadius:`${props.cornerRadius}px`,outline:\"none\",boxSizing:\"border-box\"}})]});}function loadGoogleMaps(apiKey,callback){if(window.google&&window.google.maps&&window.google.maps.places){callback();return;}const existingScript=document.getElementById(\"google-maps\");if(existingScript){existingScript.addEventListener(\"load\",callback);return;}const script=document.createElement(\"script\");script.id=\"google-maps\";script.src=`https://maps.googleapis.com/maps/api/js?key=${apiKey}&libraries=places`;script.async=true;script.onload=callback;document.body.appendChild(script);}addPropertyControls(DeliveryAddressInput,{apiKey:{type:ControlType.String,title:\"Google Maps API Key\"},name:{type:ControlType.String,title:\"Form Field Name\",defaultValue:\"delivery_address\"},// Form wrapper\nformBackground:{type:ControlType.Color,title:\"Form Background\",defaultValue:\"rgba(0,0,0,0)\"},formPadding:{type:ControlType.Number,title:\"Form Padding\",defaultValue:0,min:0,max:64,step:1,unit:\"px\"},formCornerRadius:{type:ControlType.Number,title:\"Form Radius\",defaultValue:0,min:0,max:100,step:1,unit:\"px\"},// Label\nlabelText:{type:ControlType.String,title:\"Label Text\",defaultValue:\"Delivery Address\"},labelFont:{type:ControlType.Font,title:\"Label Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:14,variant:\"Medium\",lineHeight:\"1.4em\",letterSpacing:\"0em\"}},labelColor:{type:ControlType.Color,title:\"Label Color\",defaultValue:\"#7D7D7D\"},// Input\nplaceholderText:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Enter delivery address\"},placeholderColor:{type:ControlType.Color,title:\"Placeholder Color\",defaultValue:\"#A0A0A0\"},inputHeight:{type:ControlType.Number,title:\"Input Height\",defaultValue:40,min:24,max:120,step:1,unit:\"px\"},inputFont:{type:ControlType.Font,title:\"Input Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:14,variant:\"Regular\",lineHeight:\"1.4em\",letterSpacing:\"0em\"}},inputTextColor:{type:ControlType.Color,title:\"Input Text Color\",defaultValue:\"#212121\"},inputBackgroundColor:{type:ControlType.Color,title:\"Input Background\",defaultValue:\"#F5F5F5\"},inputBorderStyle:{type:ControlType.Enum,title:\"Border Style\",options:[\"solid\",\"dashed\",\"dotted\",\"none\"],optionTitles:[\"Solid\",\"Dashed\",\"Dotted\",\"None\"],defaultValue:\"solid\"},inputBorderWidth:{type:ControlType.Number,title:\"Border Width\",defaultValue:1,min:0,max:12,step:1,unit:\"px\",hidden:props=>props.inputBorderStyle===\"none\"},inputBorderColor:{type:ControlType.Color,title:\"Input Border\",defaultValue:\"rgba(136, 136, 136, 0.1)\",hidden:props=>props.inputBorderStyle===\"none\"},cornerRadius:{type:ControlType.Number,title:\"Input Radius\",defaultValue:12,min:0,max:100,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DeliveryAddressInput\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Delivery_Address.map"],"mappings":"oNAAgK,SAAwB,EAAqB,EAAM,CAAC,IAAM,EAASA,EAAO,KAAK,CAAM,CAAC,EAAQ,GAAYC,EAAS,GAAG,CAA0C,EAAW,kBAA1CC,GAAO,CAAC,QAAQ,KAAK,GAAG,GAAsgB,OAA5d,MAAc,CAAC,EAAe,EAAM,WAAW,CAAC,GAAG,CAAC,EAAS,QAAQ,OAAO,IAAM,EAAa,IAAI,EAAO,OAAO,KAAK,OAAO,aAAa,EAAS,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,sBAAsB,CAAC,QAAQ,MAAM,CAAC,CAAC,CAAC,EAAa,YAAY,oBAAoB,CAAC,IAAM,EAAM,EAAa,UAAU,CAAwE,EAAhD,EAAM,mBAAmB,EAAS,QAAQ,MAAkC,CAAC,EAAM,mBAAmB,EAAM,kBAAkB,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