import{K as B,L as E,h as V,O as w}from"./OdysseyThemeProvider-Bh0Bu-2o.js";import{r as t}from"./index-NdkWRN8K.js";import{M as L}from"./Field-DH3L8v09.js";import{g as O,u as W}from"./inputUtils-Dbi8XkA6.js";import{j as e}from"./jsx-runtime-CnH95YSl.js";import{I as g}from"./InputBase-DeB4_faH.js";import{I as z}from"./InputAdornment-CdR3XT6f.js";import{M as D}from"./Search-C5TVrLyE.js";import{I as K}from"./IconButton-5qShmnSr.js";const P=["outline","filled"],N=V("div")({width:"100%"}),q=t.forwardRef(({ariaDescribedBy:C,autoCompleteType:l,defaultValue:d,hasInitialFocus:n,id:k,isDisabled:r=!1,isFullWidth:R=!1,label:T,name:c,onChange:o,onFocus:m,onBlur:u,onClear:a,placeholder:f,tabIndex:h,testId:x,translate:p,value:j,variant:b="outline"},y)=>{const{t:F}=B(),M=t.useCallback(i=>{o==null||o(i)},[o]),S=t.useCallback(()=>{a==null||a()},[a]),v=t.useRef(O({controlledValue:j,uncontrolledValue:d})),s=W({defaultValue:d,value:j,controlState:v.current}),A=t.useCallback(({ariaDescribedBy:i,id:I})=>e.jsx(g,{...s,"aria-describedby":i,autoComplete:l,autoFocus:n,"data-ods-type":"search","data-ods-variant":b,"data-se":x,endAdornment:((s==null?void 0:s.defaultValue)||(s==null?void 0:s.value))&&e.jsx(z,{position:"end",children:e.jsx(K,{"aria-label":F("clear.text"),disabled:r,onClick:S,size:"small",children:e.jsx(E,{})})}),id:I,inputProps:{tabIndex:h},name:c??I,onBlur:u,onChange:M,onFocus:m,placeholder:f,ref:y,startAdornment:e.jsx(z,{position:"start",children:e.jsx(D,{})}),translate:p,type:"search"}),[l,n,s,r,c,u,M,S,m,f,y,F,h,x,p,b]);return e.jsx(N,{children:e.jsx(w,{children:e.jsx(L,{ariaDescribedBy:C,fieldType:"single",hasVisibleLabel:!1,id:k,isDisabled:r,isFullWidth:R,isOptional:!0,label:T,renderFieldComponent:A})})})}),G=t.memo(q);G.displayName="SearchField";export{G as M,P as s};
