@public-ui/components
Version:
Contains all web components that belong to KoliBri - The accessible HTML-Standard.
4 lines • 2.05 kB
JavaScript
/*!
* KoliBri - The accessible HTML-Standard
*/
;var Heading=require("./Heading-DNsjTrzP.js"),index=require("./index-DxCCX-ts.js"),Input=require("./Input-Cv54fo72.js");require("./common-BHv-S8J5.js");var FormFieldStateWrapper=require("./FormFieldStateWrapper-3kG9sQmm.js");const SuggestionsFc=e=>{var{id:t,suggestions:i}=e,n=Heading.__rest(e,["id","suggestions"]);return i?index.h("datalist",Object.assign({id:`${t}-list`},n),i.map((e=>index.h("option",{value:e})))):null};function getInputProps(e,t,i){var n;const s=[...FormFieldStateWrapper.getRenderStates(e).ariaDescribedBy,...null!==(n=t.ariaDescribedBy)&&void 0!==n?n:[]],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=FormFieldStateWrapper.convertMsgToInternMsg(e._msg)),"_suggestions"in e&&!i){Array.isArray(e._suggestions)&&e._suggestions.length>0&&(a.suggestions=index.h(SuggestionsFc,{id:e._id,suggestions:e._suggestions}))}return Object.assign(Object.assign(Object.assign({},a),t),{ariaDescribedBy:s})}const InputStateWrapper=e=>{var{state:t,customSuggestions:i}=e,n=Heading.__rest(e,["state","customSuggestions"]);return index.h(Input.InputFc,Object.assign({},getInputProps(t,n,i)))};exports.InputStateWrapper=InputStateWrapper,exports.SuggestionsFc=SuggestionsFc;