import{defineProperty as e}from"../../../_virtual/_rollupPluginBabelHelpers.js";import a from"classnames";import o,{forwardRef as r,useRef as t,useCallback as n}from"react";import s from"../../hooks/useMergeRef.js";import{getTestId as i,ComponentDefaultTestId as l}from"../../tests/testIds.js";import c from"./Search.module.scss.js";import d from"../BaseInput/BaseInput.js";import m from"../../hooks/useDebounceEvent/index.js";import p from"../IconButton/IconButton.js";import{ComponentVibeId as u}from"../../tests/constants.js";import f from"../../../components/loader/dist/Loader/Loader.js";import v from"../../../packages/icons/dist/react/CloseSmall.js";import h from"../../../components/icon/dist/Icon/Icon.js";import C from"../../../packages/icons/dist/react/Search.js";var I=r((function(r,I){var b,j,E,g,R,N,x,y,A,B,S=r.searchIconName,L=void 0===S?C:S,k=r.clearIconName,w=void 0===k?v:k,z=r.clearIconLabel,F=void 0===z?"Clear":z,H=r.renderAction,_=r.hideRenderActionOnInput,D=r.value,P=r.placeholder,T=r.size,V=void 0===T?"medium":T,K=r.disabled,O=r.loading,M=r.autoFocus,U=r.autoComplete,W=void 0===U?"off":U,q=r.inputAriaLabel,G=r.debounceRate,J=void 0===G?400:G,Q=r.searchResultsContainerId,X=r.currentAriaResultId,Y=r.onChange,Z=r.onFocus,$=r.onBlur,ee=r.onClear,ae=r.onKeyDown,oe=r.className,re=r.ariaExpanded,te=r.ariaHasPopup,ne=r.showClearIcon,se=void 0===ne||ne,ie=r.id,le=r["data-testid"];return b=t(null),j=s(I,b),E=m({delay:J,onChange:Y,initialStateValue:D}),g=E.inputValue,R=E.onEventChanged,x=n((function(){var e,a;K||(null===(a=null===(e=b.current)||void 0===e?void 0:e.focus)||void 0===a||a.call(e),N(),null==ee||ee())}),[K,N=E.clearValue,ee]),y=o.createElement(h,{icon:L,className:c.icon,iconType:"font",iconSize:"small"===V?"16px":"20px"}),A=o.createElement(p,{className:a(c.icon,e({},c.empty,!g)),icon:w,ariaLabel:F,onClick:x,size:"small"===V?"xs":"small","data-testid":i(l.CLEAN_SEARCH_BUTTON,ie)}),B=o.createElement(o.Fragment,null,O&&o.createElement(f,{size:"small"===V?"xs":20,color:"secondary",wrapperClassName:a(e({},c.loader,!g&&!H))}),se&&g&&!K&&A,!(_&&g)&&H),o.createElement(d,{ref:j,id:ie,type:"search","data-testid":le||i(l.SEARCH,ie),"data-vibe":u.SEARCH,className:a(c.searchWrapper,oe),inputClassName:c.search,value:g,renderLeft:y,renderRight:B,autoFocus:M,placeholder:P,disabled:K,onChange:R,onBlur:$,onFocus:Z,onKeyDown:ae,autoComplete:W,size:V,wrapperRole:"search",inputRole:Q?"combobox":void 0,"aria-label":q,"aria-busy":O,"aria-controls":re?Q:void 0,"aria-activedescendant":X,"aria-haspopup":te,"aria-expanded":re})}));export{I as default};
//# sourceMappingURL=Search.js.map
