/*!
 * KoliBri - The accessible HTML-Standard
 */
import{_ as __rest}from"./tslib.es6-CxX45GIN.js";import{h}from"./index-C_yiBYg2.js";import{I as InputFc}from"./Input-D-VKrBBS.js";import{g as getRenderStates}from"./FormFieldStateWrapper-Cj4-CJCr.js";const SuggestionsFc=e=>{var{id:t,suggestions:s}=e,i=__rest(e,["id","suggestions"]);return s?h("datalist",Object.assign({id:`${t}-list`},i),s.map(e=>h("option",{value:e}))):null};function getInputProps(e,t,s){var i;const n=[...getRenderStates(e).ariaDescribedBy,...null!==(i=t.ariaDescribedBy)&&void 0!==i?i:[]],a={id:e._id,hideLabel:e._hideLabel,label:e._label,disabled:e._disabled,name:e._name};if("_accessKey"in e&&(a.accessKey=e._accessKey),"_type"in e&&(a.type=e._type),"_value"in e&&(a.value=e._value),"_required"in e&&(a.required=e._required),"_maxLength"in e&&"_maxLengthBehavior"in e&&"hard"===e._maxLengthBehavior&&(a.maxlength=e._maxLength),"_placeholder"in e&&(a.placeholder=e._placeholder),"_autoComplete"in e&&(a.autoComplete=e._autoComplete),"_spellCheck"in e&&(a.spellcheck=e._spellCheck),"_pattern"in e&&(a.pattern=e._pattern),"_readOnly"in e&&(a.readonly=e._readOnly),"_min"in e&&(a.min=e._min),"_max"in e&&(a.max=e._max),"_step"in e&&(a.step=e._step),"_multiple"in e&&(a.multiple=e._multiple),"_checked"in e&&(a.checked=e._checked),"_indeterminate"in e&&(a.indeterminate=e._indeterminate),"_touched"in e&&(a.touched=e._touched),"_msg"in e&&(a.msg=e._msg),"_shortKey"in e&&(a["aria-keyshortcuts"]=e._shortKey),"_suggestions"in e&&!s){Array.isArray(e._suggestions)&&e._suggestions.length>0&&(a.suggestions=h(SuggestionsFc,{id:e._id,suggestions:e._suggestions}))}return Object.assign(Object.assign(Object.assign({},a),t),{ariaDescribedBy:n})}const InputStateWrapper=e=>{var{state:t,customSuggestions:s}=e,i=__rest(e,["state","customSuggestions"]);return h(InputFc,Object.assign({},getInputProps(t,i,s)))};export{InputStateWrapper as I,SuggestionsFc as S};