{"version":3,"file":"ConditionalPriceFields.CWSvCUFl.mjs","names":["useRef","useState","useCallback","useMemo","__esmMin","ne","init_npm_react_18_3_1","te","pe","window","ce","init_jsx_runtime","p","_e","de","init_ssg_sandbox_shims","addPropertyControls","init_framer_CKT6jEEQ","ControlType","ConditionalPriceFields","props","rootRef","listingType","setListingType","sellingPrice","setSellingPrice","rentalPrice","setRentalPrice","duration","setDuration","applyListingTypeValue","normalized","rawValue","cleanup","rafId","timeoutId","attachToControl","root","form","control","valueReader","handleChange","controlStyle","controlHeight","borderColor","cornerRadius","inputBackground","textColor","fontSize","fontFamily","labelStyle","labelColor","renderSelling","renderRenting","sectionGap","placeholderColor","event","rowGap","init_ConditionalPriceFields"],"sources":["https:/framerusercontent.com/modules/zmthGqjgm2JothLZMf0s/myO3UwZFHAcKvjk4Hllk/ConditionalPriceFields.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{startTransition,useCallback,useEffect,useMemo,useRef,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function ConditionalPriceFields(props){const{inputBackground=\"rgba(0, 0, 0, 0.05)\",borderColor=\"rgba(0, 0, 0, 0.1)\",textColor=\"rgb(51, 51, 51)\",placeholderColor=\"rgba(0, 0, 0, 0.5)\",labelColor=\"rgb(51, 51, 51)\",fontFamily=\"Manrope\",fontSize=16,cornerRadius=4,controlHeight=40,rowGap=10,sectionGap=15}=props;const rootRef=useRef(null);const[listingType,setListingType]=useState(\"\");const[sellingPrice,setSellingPrice]=useState(\"\");const[rentalPrice,setRentalPrice]=useState(\"\");const[duration,setDuration]=useState(\"\");const applyListingTypeValue=useCallback(rawValue=>{const normalized=rawValue===\"sell\"||rawValue===\"rent\"||rawValue===\"sell-rent\"?rawValue:\"\";startTransition(()=>setListingType(normalized));},[]);useEffect(()=>{if(typeof window===\"undefined\"||typeof document===\"undefined\")return;let cleanup;let rafId;let timeoutId;const attachToControl=()=>{const root=rootRef.current;if(!root)return false;const form=root.closest(\"form\");if(!form)return false;const control=form.querySelector('select[name=\"For\"], [name=\"For\"]');if(!control)return false;const valueReader=control;applyListingTypeValue(valueReader.value||\"\");const handleChange=()=>{applyListingTypeValue(valueReader.value||\"\");};control.addEventListener(\"change\",handleChange);control.addEventListener(\"input\",handleChange);cleanup=()=>{control.removeEventListener(\"change\",handleChange);control.removeEventListener(\"input\",handleChange);};return true;};const attachedImmediately=attachToControl();if(!attachedImmediately){rafId=window.requestAnimationFrame(()=>{const attachedOnRaf=attachToControl();if(!attachedOnRaf){timeoutId=window.setTimeout(()=>{attachToControl();},120);}});}return()=>{if(cleanup)cleanup();if(typeof rafId===\"number\")window.cancelAnimationFrame(rafId);if(typeof timeoutId===\"number\")window.clearTimeout(timeoutId);};},[applyListingTypeValue]);const controlStyle=useMemo(()=>({width:\"100%\",boxSizing:\"border-box\",height:`${controlHeight}px`,border:`1px solid ${borderColor}`,borderRadius:`${cornerRadius}px`,background:inputBackground,color:textColor,fontFamily,fontSize:`${fontSize}px`,lineHeight:\"1.2em\",padding:\"0 12px\",outline:\"none\"}),[borderColor,cornerRadius,controlHeight,fontFamily,fontSize,inputBackground,textColor]);const labelStyle=useMemo(()=>({fontFamily,fontSize:\"16px\",lineHeight:\"1.2em\",color:labelColor,fontWeight:400}),[fontFamily,labelColor]);const renderSelling=listingType===\"sell\"||listingType===\"sell-rent\";const renderRenting=listingType===\"rent\"||listingType===\"sell-rent\";return /*#__PURE__*/_jsxs(\"div\",{ref:rootRef,style:{position:\"relative\",width:\"100%\",height:\"auto\",display:\"flex\",flexDirection:\"column\",gap:`${sectionGap}px`},children:[/*#__PURE__*/_jsx(\"style\",{children:`.conditional-price-fields-input::placeholder{color:${placeholderColor};opacity:1;}`}),!renderSelling&&!renderRenting?/*#__PURE__*/_jsx(\"div\",{style:{fontFamily,fontSize:\"14px\",lineHeight:\"1.3em\",color:placeholderColor},children:\"Select a listing type above to set pricing.\"}):null,renderSelling?/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",gap:`${sectionGap}px`},children:[/*#__PURE__*/_jsx(\"label\",{htmlFor:\"conditional-price-selling\",style:labelStyle,children:\"Selling Price\"}),/*#__PURE__*/_jsx(\"input\",{id:\"conditional-price-selling\",className:\"conditional-price-fields-input\",name:\"Selling Price\",type:\"number\",required:true,placeholder:\"0*\",value:sellingPrice,onChange:event=>{startTransition(()=>setSellingPrice(event.target.value));},style:controlStyle})]}):null,renderRenting?/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",gap:`${sectionGap}px`},children:[/*#__PURE__*/_jsx(\"label\",{htmlFor:\"conditional-price-rental\",style:labelStyle,children:\"Rental Price\"}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"stretch\",gap:`${rowGap}px`,width:\"100%\"},children:[/*#__PURE__*/_jsx(\"input\",{id:\"conditional-price-rental\",className:\"conditional-price-fields-input\",name:\"Rental Price\",type:\"number\",required:true,placeholder:\"0*\",value:rentalPrice,onChange:event=>{startTransition(()=>setRentalPrice(event.target.value));},style:{...controlStyle,flex:\"1 1 0%\",minWidth:\"0px\"}}),/*#__PURE__*/_jsxs(\"select\",{id:\"conditional-price-duration\",name:\"Duration\",required:true,value:duration,onChange:event=>{startTransition(()=>setDuration(event.target.value));},style:{...controlStyle,width:\"35%\",minWidth:\"120px\",flex:\"0 0 35%\"},children:[/*#__PURE__*/_jsx(\"option\",{value:\"\",disabled:true,children:\"Duration*\"}),/*#__PURE__*/_jsx(\"option\",{value:\"day\",children:\"/day\"}),/*#__PURE__*/_jsx(\"option\",{value:\"month\",children:\"/month\"}),/*#__PURE__*/_jsx(\"option\",{value:\"year\",children:\"/year\"})]})]})]}):null]});}addPropertyControls(ConditionalPriceFields,{inputBackground:{type:ControlType.Color,defaultValue:\"rgba(0, 0, 0, 0.05)\"},borderColor:{type:ControlType.Color,defaultValue:\"rgba(0, 0, 0, 0.1)\"},textColor:{type:ControlType.Color,defaultValue:\"rgb(51, 51, 51)\"},placeholderColor:{type:ControlType.Color,defaultValue:\"rgba(0, 0, 0, 0.5)\"},labelColor:{type:ControlType.Color,defaultValue:\"rgb(51, 51, 51)\"},fontFamily:{type:ControlType.String,defaultValue:\"Manrope\"},fontSize:{type:ControlType.Number,defaultValue:16,min:10,max:30,step:1},cornerRadius:{type:ControlType.Number,defaultValue:4,min:0,max:24,step:1},controlHeight:{type:ControlType.Number,defaultValue:40,min:28,max:72,step:1},rowGap:{type:ControlType.Number,defaultValue:10,min:0,max:40,step:1},sectionGap:{type:ControlType.Number,defaultValue:15,min:0,max:50,step:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ConditionalPriceFields\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ConditionalPriceFields.map"],"mappings":"A,kOAGG,SAAwBmB,EAAuB,EAAM,CAAC,GAAK,CAAC,kBAAgB,sBAAsB,cAAY,qBAAqB,YAAU,kBAAkB,mBAAiB,qBAAqB,aAAW,kBAAkB,aAAW,UAAU,WAAS,GAAG,eAAa,EAAE,gBAAc,GAAG,SAAO,GAAG,aAAW,IAAIC,EAAYC,EAAQrB,EAAO,IAAI,EAAO,CAACsB,EAAYC,GAAgBtB,EAAS,EAAE,EAAO,CAACuB,EAAaC,GAAiBxB,EAAS,EAAE,EAAO,CAACyB,EAAYC,GAAgB1B,EAAS,EAAE,EAAO,CAAC2B,EAASC,GAAa5B,EAAS,EAAE,EAAQ6B,EAAsB5B,EAAY,GAAU,CAAC,IAAM6B,EAAWC,IAAW,QAAQA,IAAW,QAAQA,IAAW,YAAYA,EAAS,GAAGzB,MAAoBgB,EAAeQ,CAAU,CAAC,CAAE,EAAE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