UNPKG

@public-ui/components

Version:

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

4 lines 1.8 kB
/*! * KoliBri - The accessible HTML-Standard */ import{w as t,k as i,i as s,b as a}from"./prop.validators-64749272.js";import{I as e}from"./controller-icon-f9b7e1f9.js";import{v as h}from"./has-counter-23a7a06b.js";const o=["default","visibility-toggle"],r=(e,a)=>{t(e,"_variant",(t=>"string"==typeof t&&o.includes(t)),new Set(o),a)};class l extends e{constructor(t,e,a){super(t,e,a),this.afterSyncCharCounter=()=>{"string"==typeof this.component._value&&this.component._value.length>0&&(this.component.state._currentLength=this.component._value.length)},this.component=t}validateAutoComplete(e){t(this.component,"_autoComplete",(t=>"string"==typeof t&&("on"===t||"off"===t)),new Set(["on | off"]),e)}validateHasCounter(t){h(this.component,t,{hooks:{afterPatch:this.afterSyncCharCounter}})}validateVariant(t){r(this.component,t)}validateMaxLength(t){i(this.component,"_maxLength",t,{hooks:{afterPatch:this.afterSyncCharCounter},min:0})}validatePattern(t){s(this.component,"_pattern",t)}validatePlaceholder(t){s(this.component,"_placeholder",t)}validateReadOnly(t){a(this.component,"_readOnly",t)}validateRequired(t){a(this.component,"_required",t)}validateValue(t){s(this.component,"_value",t,{hooks:{afterPatch:this.afterSyncCharCounter}}),this.setFormAssociatedValue(this.component.state._value)}componentWillLoad(){super.componentWillLoad(),this.validateAutoComplete(this.component._autoComplete),this.validateHasCounter(this.component._hasCounter),this.validateMaxLength(this.component._maxLength),this.validatePattern(this.component._pattern),this.validatePlaceholder(this.component._placeholder),this.validateReadOnly(this.component._readOnly),this.validateRequired(this.component._required),this.validateValue(this.component._value),this.validateVariant(this.component._variant)}}export{l as I};