import { h } from './index-ecdfb761.js';
import { r as registerField } from './FieldGenerator-3ae403b2.js';
import { B as BaseField } from './BaseField-0b01dc2c.js';

class TextField extends BaseField {
  constructor(id, title, placeholder, description, inputType, lines = 1, linesMax = 1) {
    super(id, 'text');
    this.format = 'raw';
    this.id = id;
    this.title = title;
    this.placeholder = placeholder;
    this.description = description;
    this.inputType = inputType;
    this.lines = lines;
    this.linesMax = linesMax;
  }
  showPreview() {
    this.preview = true;
    return this;
  }
  getDisplayValue(value) {
    return value;
  }
  setInputType(inputType) {
    this.inputType = inputType;
    return this;
  }
  setFormat(format) {
    this.format = format;
    return this;
  }
  setLines(lines) {
    this.lines = lines;
    return this;
  }
  setLinesMax(linesMax) {
    this.linesMax = linesMax;
    return this;
  }
  setAutoComplete(autoComplete) {
    this.autoComplete = autoComplete;
    return this;
  }
}
TextField.type = 'text';

// component generator
const render = (field, value, errors, disabled, onFieldChange, onFieldBlur) => h("dvn-field-input-text", { disabled: disabled, field: field, errors: errors, onChange: (e) => {
    e.stopImmediatePropagation();
    onFieldChange(field, e.detail);
  }, onBlur: () => onFieldBlur(field), value: value });
// register 'text' field for json form generations
registerField('text', render);

export { TextField as T };
