{"version":3,"file":"SearchplusOverride.CSLdJymV.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/cRZO67Az1mtYGYwheHno/n1y3DIZ8ft84iLDLsu71/SearchplusOverride.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";// Learn more: https://www.framer.com/developers/overrides/\n// Create a shared store to track the search input value\n// createStore returns a custom hook that can be used in any override\nconst useStore=createStore({searchValue:\"\"});/**\n * Override for the Search+ component\n * Captures input changes and updates the shared store\n * Apply this to your Search+ component\n */export function SearchInput(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useStore();const hasInteracted=useRef(false);// Clear store on mount if this is a fresh page load\n// This prevents stale values from other pages showing the close button\nuseEffect(()=>{if(!hasInteracted.current){setStore({searchValue:\"\"});}},[]);// Create the onInput handler\nconst handleInput=event=>{hasInteracted.current=true;// Get the current input value\nconst value=event.target.value||\"\";// Update the store with the new value\nsetStore({searchValue:value});// Call the original onInput if it exists\nif(props.onInput){props.onInput(event);}};return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onInput:handleInput});});}/**\n * Override for the close button stack\n * Controls visibility based on whether there's actual user input\n * Apply this to the stack containing your close+ component\n */export function CloseButtonVisibility(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useStore();// Handle click to clear the store\nconst handleClick=event=>{// Clear the store value when close button is clicked\nsetStore({searchValue:\"\"});// Call the original onClick if it exists\nif(props.onClick){props.onClick(event);}};return /*#__PURE__*/_jsx(Component,{ref:ref,...props,style:{...props.style,opacity:store.searchValue.length>0?1:0,pointerEvents:store.searchValue.length>0?\"auto\":\"none\"},onClick:handleClick});});}/**\n * Override for the clear+ component\n * Clears the store when the clear+ button is clicked\n * Apply this to your clear+ component that clears all filters\n */export function ClearAllFilters(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useStore();// Handle click to clear the store\nconst handleClick=event=>{// Clear the store value when clear+ button is clicked\nsetStore({searchValue:\"\"});// Call the original onClick if it exists\nif(props.onClick){props.onClick(event);}};return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onClick:handleClick});});}\nexport const __FramerMetadata__ = {\"exports\":{\"ClearAllFilters\":{\"type\":\"reactHoc\",\"name\":\"ClearAllFilters\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"CloseButtonVisibility\":{\"type\":\"reactHoc\",\"name\":\"CloseButtonVisibility\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"SearchInput\":{\"type\":\"reactHoc\",\"name\":\"SearchInput\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SearchplusOverride.map"],"mappings":"wLAOG,SAAgB,EAAY,EAAU,CAAC,OAAoB,GAAY,EAAM,IAAM,CAAC,GAAK,CAAC,EAAM,GAAU,GAAU,CAAO,EAAcA,EAAO,GAAM,CAEzJ,MAAc,CAAK,EAAc,SAAS,EAAS,CAAC,YAAY,GAAG,CAAC,EAAI,EAAE,CAAC,CAC3E,IAAM,EAAY,GAAO,CAAC,EAAc,QAAQ,GAEhD,EAAS,CAAC,YADE,EAAM,OAAO,OAAO,GACJ,CAAC,CAC1B,EAAM,SAAS,EAAM,QAAQ,EAAM,EAAI,OAAoB,EAAK,EAAU,CAAK,MAAI,GAAG,EAAM,QAAQ,EAAY,CAAC,EAAG,CAIpH,SAAgB,EAAsB,EAAU,CAAC,OAAoB,GAAY,EAAM,IAAM,CAAC,GAAK,CAAC,EAAM,GAAU,GAAU,CAC3H,EAAY,GAAO,CACzB,EAAS,CAAC,YAAY,GAAG,CAAC,CACvB,EAAM,SAAS,EAAM,QAAQ,EAAM,EAAI,OAAoB,EAAK,EAAU,CAAK,MAAI,GAAG,EAAM,MAAM,CAAC,GAAG,EAAM,MAAM,QAAQ,EAAM,YAAY,OAAO,EAAE,EAAE,EAAE,cAAc,EAAM,Y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