UNPKG

@public-ui/components

Version:

Contains all web components that belong to KoliBri - The accessible HTML-Standard.

4 lines 2.03 kB
/*! * KoliBri - The accessible HTML-Standard */ "use strict";var tslib_es6=require("./tslib.es6-7DbU_BSw.js"),index=require("./index-C4Loo2IH.js"),Input=require("./Input-mtjTLTjx.js"),FormFieldStateWrapper=require("./FormFieldStateWrapper-Ci-xqnPO.js");const SuggestionsFc=e=>{var{id:t,suggestions:i}=e,s=tslib_es6.__rest(e,["id","suggestions"]);return i?index.h("datalist",Object.assign({id:`${t}-list`},s),i.map(e=>index.h("option",{value:e}))):null};function getInputProps(e,t,i){var s;const n=[...FormFieldStateWrapper.getRenderStates(e).ariaDescribedBy,...null!==(s=t.ariaDescribedBy)&&void 0!==s?s:[]],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&&!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:n})}const InputStateWrapper=e=>{var{state:t,customSuggestions:i}=e,s=tslib_es6.__rest(e,["state","customSuggestions"]);return index.h(Input.InputFc,Object.assign({},getInputProps(t,s,i)))};exports.InputStateWrapper=InputStateWrapper,exports.SuggestionsFc=SuggestionsFc;