!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(()=>(()=>{"use strict";var e={3209:(e,t,r)=>{r.d(t,{wU:()=>o});const o=500},692:e=>{e.exports=require("@mui/icons-material/Clear")},8619:e=>{e.exports=require("@mui/material")},7825:e=>{e.exports=require("lodash")},2015:e=>{e.exports=require("react")}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var a=t[o]={exports:{}};return e[o](a,a.exports,r),a.exports}(()=>{r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t}})(),(()=>{r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})}})(),(()=>{r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var o={};r.r(o),r.d(o,{default:()=>f});var n=r(2015),a=r.n(n),u=r(8619);const c=require("@mui/icons-material/Search");var i=r.n(c),l=r(692),s=r.n(l),d=r(7825),p=r(3209);const f=({term:e,onSearch:t,placeholder:r="Search...",debounced:o})=>{const[c,l]=(0,n.useState)(e),f=(0,n.useRef)(t);(0,n.useEffect)((()=>{f.current=t}),[t]);const m=(0,n.useRef)((0,d.debounce)((e=>f.current(e)),p.wU));(0,n.useEffect)((()=>{l(e||"")}),[e]),(0,n.useEffect)((()=>()=>{var e;return null===(e=m.current)||void 0===e?void 0:e.cancel()}),[]);return a().createElement(u.TextField,{variant:"outlined",value:c,placeholder:r,slotProps:{input:{startAdornment:o&&a().createElement(u.InputAdornment,{position:"start"},a().createElement(i(),{sx:{color:"#0000008F"}})),endAdornment:a().createElement(u.InputAdornment,{position:"end"},c?a().createElement(u.IconButton,{size:"small",onClick:()=>{var e;null===(e=m.current)||void 0===e||e.cancel(),l(""),t("")}},a().createElement(s(),{fontSize:"small",sx:{color:"#0000008F"}})):!o&&a().createElement(i(),{sx:{mr:1,color:"#0000008F",position:"absolute",right:0}}))}},onChange:e=>(e=>{var t;l(e),o&&(null===(t=m.current)||void 0===t||t.call(m,e))})(e.target.value),onKeyDown:e=>{o||"Enter"!==e.key||t(c)},fullWidth:!0,sx:{"& .MuiOutlinedInput-root":{height:"36px"}}})};return o})()));
//# sourceMappingURL=search-input.js.map