import{defineProperty as e}from"../../../_virtual/_rollupPluginBabelHelpers.js";import o from"classnames";import a,{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"../../hooks/useDebounceEvent/index.js";import m from"../IconButton/IconButton.js";import{ComponentVibeId as u}from"../../tests/constants.js";import p from"../../../components/loader/dist/Loader/Loader.js";import f from"../../../base/dist/BaseInput/BaseInput.js";import v from"../../../icons/dist/react/CloseSmall.js";import h from"../../../components/icon/dist/Icon/Icon.js";import C from"../../../icons/dist/react/Search.js";var b=r((function(r,b){var I,j,E,R,N,g,x,y,A,B,S=r.searchIconName,L=void 0===S?C:S,w=r.clearIconName,z=void 0===w?v:w,F=r.clearIconLabel,H=void 0===F?"Clear":F,_=r.renderAction,k=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,oe=r.onKeyDown,ae=r.className,re=r.ariaExpanded,te=r.ariaHasPopup,ne=r.showClearIcon,se=void 0===ne||ne,ie=r.id,le=r["data-testid"];return I=t(null),j=s(b,I),E=d({delay:J,onChange:Y,initialStateValue:D}),R=E.inputValue,N=E.onEventChanged,x=n((function(){var e,o;K||(null===(o=null===(e=I.current)||void 0===e?void 0:e.focus)||void 0===o||o.call(e),g(),null==ee||ee())}),[K,g=E.clearValue,ee]),y=a.createElement(h,{icon:L,className:c.icon,iconType:"font",iconSize:"small"===V?"16px":"20px"}),A=a.createElement(m,{className:o(c.icon,e({},c.empty,!R)),icon:z,ariaLabel:H,onClick:x,size:"small"===V?"xs":"small","data-testid":i(l.CLEAN_SEARCH_BUTTON,ie)}),B=a.createElement(a.Fragment,null,O&&a.createElement(p,{size:"small"===V?"xs":20,color:"secondary",wrapperClassName:o(e({},c.loader,!R&&!_))}),se&&R&&!K&&A,!(k&&R)&&_),a.createElement(f,{ref:j,id:ie,type:"search","data-testid":le||i(l.SEARCH,ie),"data-vibe":u.SEARCH,className:o(c.searchWrapper,ae),inputClassName:c.search,value:R,renderLeft:y,renderRight:B,autoFocus:M,placeholder:P,disabled:K,onChange:N,onBlur:$,onFocus:Z,onKeyDown:oe,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{b as default};
//# sourceMappingURL=Search.js.map
