@public-ui/components
Version:
Contains all web components that belong to KoliBri - The accessible HTML-Standard.
4 lines • 1.75 kB
JavaScript
/*!
* KoliBri - The accessible HTML-Standard
*/
import{_ as __rest}from"./tslib.es6-1173d062.js";import{h}from"./index-136f59ac.js";import{I as InputFc}from"./Input-ce53cfae.js";import"./index-88dea7b1.js";import{g as getRenderStates,a as convertMsgToInternMsg}from"./getRenderStates-dba2a9a8.js";const SuggestionsFc=e=>{var{id:t,suggestions:s}=e,n=__rest(e,["id","suggestions"]);return s?h("datalist",Object.assign({id:`${t}-list`},n),s.map((e=>h("option",{value:e})))):null};function getInputProps(e,t){const{ariaDescribedBy:s}=getRenderStates(e),n={id:e._id,hideLabel:e._hideLabel,label:e._label,accessKey:e._accessKey,disabled:e._disabled,name:e._name,ariaDescribedBy:s};if("_type"in e&&(n.type=e._type),"_value"in e&&(n.value=e._value),"_required"in e&&(n.required=e._required),"_maxLength"in e&&(n.maxlength=e._maxLength),"_placeholder"in e&&(n.placeholder=e._placeholder),"_autoComplete"in e&&(n.autoComplete=e._autoComplete),"_spellCheck"in e&&(n.spellcheck=e._spellCheck),"_pattern"in e&&(n.pattern=e._pattern),"_readOnly"in e&&(n.readonly=e._readOnly),"_min"in e&&(n.min=e._min),"_max"in e&&(n.max=e._max),"_step"in e&&(n.step=e._step),"_multiple"in e&&(n.multiple=e._multiple),"_checked"in e&&(n.checked=e._checked),"_indeterminate"in e&&(n.indeterminate=e._indeterminate),"_touched"in e&&(n.touched=e._touched),"_msg"in e&&(n.msg=convertMsgToInternMsg(e._msg)),"_suggestions"in e&&!t){Array.isArray(e._suggestions)&&e._suggestions.length>0&&(n.suggestions=h(SuggestionsFc,{id:e._id,suggestions:e._suggestions}))}return n}const InputStateWrapper=e=>{var{state:t,customSuggestions:s}=e,n=__rest(e,["state","customSuggestions"]);return h(InputFc,Object.assign({},getInputProps(t,s),n))};export{InputStateWrapper as I,SuggestionsFc as S};