@public-ui/components
Version:
Contains all web components that belong to KoliBri - The accessible HTML-Standard.
92 lines (87 loc) • 3.48 kB
JavaScript
/*!
* KoliBri - The accessible HTML-Standard
*/
import './common.js';
import { h as watchString, b as watchBoolean } from './prop.validators.js';
import { v as validateAutoComplete } from './auto-complete.js';
import { a as validateHasCounter, v as validateMaxLengthBehavior, b as validateMaxLength } from './max-length-behavior.js';
import { v as validatePlaceholder } from './placeholder.js';
import { v as validateReadOnly } from './read-only.js';
import { v as validateRequired } from './required.js';
import { v as validateVariantClassName } from './variant-class-name.js';
import { I as InputIconController } from './controller-icon.js';
const validatePattern = (component, value, options = {}) => {
watchString(component, '_pattern', value, options);
};
const validateVisibilityToggle = (component, value, hooks) => {
watchBoolean(component, '_visibilityToggle', value, hooks);
};
class InputPasswordController extends InputIconController {
constructor(component, name, host) {
super(component, name, host);
this.afterSyncCharCounter = () => {
if (typeof this.component._value === 'string') {
this.component.state._currentLength = this.component._value.length;
this.updateCurrentLengthDebounced(this.component._value.length);
}
};
this.component = component;
}
validateAutoComplete(value) {
validateAutoComplete(this.component, value);
}
validateHasCounter(value) {
validateHasCounter(this.component, value);
}
validateMaxLengthBehavior(value) {
validateMaxLengthBehavior(this.component, value);
}
validateMaxLength(value) {
validateMaxLength(this.component, value, {
hooks: { afterPatch: this.afterSyncCharCounter },
});
}
validatePattern(value) {
validatePattern(this.component, value);
}
validatePlaceholder(value) {
validatePlaceholder(this.component, value);
}
validateReadOnly(value) {
validateReadOnly(this.component, value);
}
validateRequired(value) {
validateRequired(this.component, value);
}
validateValue(value) {
watchString(this.component, '_value', value, {
hooks: {
afterPatch: this.afterSyncCharCounter,
},
});
this.setFormAssociatedValue(this.component.state._value);
}
validateVariant(value) {
validateVariantClassName(this.component, value);
}
validateVisibilityToggle(value) {
validateVisibilityToggle(this.component, value);
}
componentWillLoad() {
super.componentWillLoad();
this.validateAutoComplete(this.component._autoComplete);
this.validateHasCounter(this.component._hasCounter);
this.validateMaxLengthBehavior(this.component._maxLengthBehavior);
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);
this.validateVisibilityToggle(this.component._visibilityToggle);
}
}
export { InputPasswordController as I };
//# sourceMappingURL=controller7.js.map
//# sourceMappingURL=controller7.js.map