@public-ui/components
Version:
Contains all web components that belong to KoliBri - The accessible HTML-Standard.
4 lines • 2.28 kB
JavaScript
/*!
* KoliBri - The accessible HTML-Standard
*/
"use strict";const prop_validators=require("./prop.validators-888c8338.js"),controllerIcon=require("./controller-icon-b978babc.js"),hasCounter=require("./has-counter-878e61ea.js"),PasswordVariantPropTypeOptions=["default","visibility-toggle"],validatePasswordVariant=(t,a)=>{prop_validators.watchValidator(t,"_variant",(t=>"string"==typeof t&&PasswordVariantPropTypeOptions.includes(t)),new Set(PasswordVariantPropTypeOptions),a)};class InputPasswordController extends controllerIcon.InputIconController{constructor(t,a,e){super(t,a,e),this.afterSyncCharCounter=()=>{"string"==typeof this.component._value&&this.component._value.length>0&&(this.component.state._currentLength=this.component._value.length)},this.component=t}validateAutoComplete(t){prop_validators.watchValidator(this.component,"_autoComplete",(t=>"string"==typeof t&&("on"===t||"off"===t)),new Set(["on | off"]),t)}validateHasCounter(t){hasCounter.validateHasCounter(this.component,t,{hooks:{afterPatch:this.afterSyncCharCounter}})}validateVariant(t){validatePasswordVariant(this.component,t)}validateMaxLength(t){prop_validators.watchNumber(this.component,"_maxLength",t,{hooks:{afterPatch:this.afterSyncCharCounter},min:0})}validatePattern(t){prop_validators.watchString(this.component,"_pattern",t)}validatePlaceholder(t){prop_validators.watchString(this.component,"_placeholder",t)}validateReadOnly(t){prop_validators.watchBoolean(this.component,"_readOnly",t)}validateRequired(t){prop_validators.watchBoolean(this.component,"_required",t)}validateValue(t){prop_validators.watchString(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)}}exports.InputPasswordController=InputPasswordController;