import { Component, Event, h, Prop } from '@stencil/core';
export class DvnFieldInputText {
  render() {
    const { disabled, errors, field, value } = this;
    const hasError = errors && errors.length > 0;
    // const error = hasError ? errors![0] : undefined;
    const isLongText = field.linesMax > 1 && field.linesMax >= field.lines;
    return (h("dvn-input", { id: field.id, type: field.inputType || 'text', disabled: disabled || field.disabled, placeholder: field.placeholder, onBlur: () => this.blur.emit(), value: value, feedback: hasError ? 'error' : undefined, leaned: true, long: isLongText, autoComplete: field.autoComplete }));
  }
  static get is() { return "dvn-field-input-text"; }
  static get properties() { return {
    "disabled": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "disabled",
      "reflect": false
    },
    "field": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "TextField",
        "resolved": "TextField",
        "references": {
          "TextField": {
            "location": "import",
            "path": "../text"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      }
    },
    "errors": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "any[]",
        "resolved": "any[]",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      }
    },
    "value": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "value",
      "reflect": false
    }
  }; }
  static get events() { return [{
      "method": "blur",
      "name": "blur",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "complexType": {
        "original": "any",
        "resolved": "any",
        "references": {}
      }
    }, {
      "method": "change",
      "name": "change",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "complexType": {
        "original": "any",
        "resolved": "any",
        "references": {}
      }
    }]; }
}
/*export interface IProps extends BaseInputProps<TextInput, string> {
}

export class InputText extends React.Component<IProps> {

  constructor(props: IProps) {
    super(props);

    this.state = {
      value: props.value,
    };
  }

  public render() {
    const { disabled = false, field, errors, value = '' } = this.props;
    const hasError = errors && errors.length > 0;
    const error = hasError ? errors![0] : undefined;

    if (field.preview) {
      return (
        <div>
          {value}

          <div>
            {error}
          </div>
        </div>
      );
    }

    if (field.linesMax > 1 && field.linesMax >= field.lines) {
      return (
        <TextArea
          id={field.id}
          disabled={disabled}
          placeholder={field.placeholder}
          onBlur={() => this.props.onBlur()}
          onChange={(e: any) => this.props.onChange(e.target.value)}
          value={value}
          feedback={hasError ? 'error' : undefined}
          style={{
            minHeight: field.lines * 20
          }}
        />
      );
    }

    return (
      <Input
        id={field.id}
        type={field.inputType || 'text'}
        autoComplete="off"
        disabled={disabled}
        placeholder={field.placeholder}
        onBlur={() => this.props.onBlur()}
        onChange={(e: any) => this.props.onChange(e.target.value)}
        value={value}
        feedback={hasError ? 'error' : undefined}
      />
    );
  }
}*/
