import { Component, h, Host, Prop } from '@stencil/core';
// type RequiredSignColor = 'default' | 'primary' | 'secondary' | 'danger' | 'warning'
/*
export interface FieldProps extends ThemableProps {
  id?: string
  title?: string
  error?: string
  description?: string
  htmlFor?: string
  inline?: boolean
  layout?: 'horizontal' | 'vertical' | 'compact'
  scale?: 'small' | 'medium' | 'large'
  labelWidth?: string
  required?: boolean
  requiredSignColor?: RequiredSignColor
}
*/
export class DvnFormField {
  constructor() {
    this.scale = 'medium';
    this.layout = 'vertical';
  }
  render() {
    const { description, error, layout, required, scale, fieldTitle } = this;
    return (h(Host, { class: {
        [layout]: true,
        [scale]: true,
        required,
      } },
      fieldTitle &&
        h("label", null,
          fieldTitle,
          " ",
          required && h("small", { class: "error-message" }, "*"),
          description && h("div", { class: "description" },
            h("dvn-markdown", { content: description })),
          (error && layout === 'horizontal') && h("div", { class: "error-message" }, error)),
      h("slot", null),
      (error && layout === 'vertical') && h("div", { class: "error-message" }, error)));
  }
  static get is() { return "dvn-form-field"; }
  static get originalStyleUrls() { return {
    "$": ["dvn-form-field.css"]
  }; }
  static get styleUrls() { return {
    "$": ["dvn-form-field.css"]
  }; }
  static get properties() { return {
    "scale": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "Scale",
        "resolved": "\"large\" | \"medium\" | \"small\" | \"x-small\"",
        "references": {
          "Scale": {
            "location": "import",
            "path": "../../theme"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "scale",
      "reflect": false,
      "defaultValue": "'medium'"
    },
    "description": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "description",
      "reflect": false
    },
    "error": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "error",
      "reflect": false
    },
    "fieldTitle": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "field-title",
      "reflect": false
    },
    "required": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "required",
      "reflect": false
    },
    "layout": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "'horizontal' | 'vertical'",
        "resolved": "\"horizontal\" | \"vertical\"",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "layout",
      "reflect": false,
      "defaultValue": "'vertical'"
    }
  }; }
}
