import{o as e}from"./rolldown-runtime.C0FnF6B9.js";import{r as t}from"./emotion-is-prop-valid.esm.CuYlOKOk.js";import{S as n,ct as r,q as i,x as a}from"./Tooltip.bbzhtE2V.js";import{t as o}from"./useFocusable.IPfYJBxF.js";import{t as s}from"./useField.P41RsUO3.js";import{a as c,t as l}from"./useFormValidation.DAea014h.js";import{ft as u}from"./index.ByR4Z2EF.js";var d=e(t(),1);function f(e,t){let{inputElementType:f=`input`,isDisabled:p=!1,isRequired:m=!1,isReadOnly:h=!1,type:g=`text`,validationBehavior:_=`aria`}=e,[v,y]=n(e.value,e.defaultValue||``,e.onChange),{focusableProps:b}=o(e,t),x=c({...e,value:v}),{isInvalid:S,validationErrors:C,validationDetails:w}=x.displayValidation,{labelProps:T,fieldProps:E,descriptionProps:D,errorMessageProps:O}=s({...e,isInvalid:S,errorMessage:e.errorMessage||C}),k=a(e,{labelable:!0}),A={type:g,pattern:e.pattern},[j]=(0,d.useState)(v);return u(t,e.defaultValue??j,y),l(e,x,t),{labelProps:T,inputProps:r(k,f===`input`?A:void 0,{disabled:p,readOnly:h,required:m&&_===`native`,"aria-required":m&&_===`aria`||void 0,"aria-invalid":S||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-activedescendant":e[`aria-activedescendant`],"aria-autocomplete":e[`aria-autocomplete`],"aria-haspopup":e[`aria-haspopup`],"aria-controls":e[`aria-controls`],value:v,onChange:e=>y(i(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,enterKeyHint:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...b,...E}),descriptionProps:D,errorMessageProps:O,isInvalid:S,validationErrors:C,validationDetails:w}}export{f as t};