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