import { Component, h, Host, Prop } from '@stencil/core';
const progressScales = {
  small: {
    size: 14,
    strokeWidth: 2,
    marginLeft: 6,
  },
  medium: {
    size: 16,
    strokeWidth: 2,
    marginLeft: 10,
  },
  large: {
    size: 18,
    strokeWidth: 2,
    marginLeft: 14,
  },
};
const getProgressScale = ({ scale = 'medium' }) => progressScales[scale];
export class DvnButton {
  constructor() {
    this.tint = 'neutral';
    this.scale = 'medium';
    this.view = 'solid';
    this.shape = 'rectangular';
    this.disabled = false;
    this.progressing = false;
    this.leaned = false;
    this.fill = false;
    this.tagMode = false;
    this.htmlType = 'button';
  }
  render() {
    return (h(Host, { class: {
        [this.tint]: true,
        [this.scale]: true,
        [this.shape]: true,
        [this.view]: true,
        leaned: this.leaned,
        fill: this.fill,
        progressing: this.progressing,
        disabled: this.disabled,
        'tag-mode': this.tagMode
      }, disabled: this.disabled },
      h("button", { type: this.htmlType, disabled: this.disabled, form: this.formId },
        this.abbrTitle
          ? h("abbr", { class: "label", title: this.abbrTitle },
            h("slot", null))
          : h("span", { class: "label" },
            h("slot", null)),
        this.progressing &&
          h("dvn-progress", { style: {
              margin: (this.shape !== 'circle' && this.shape !== 'square') ? `0 0 0 ${getProgressScale(this).marginLeft}px` : '0px',
            }, indefinite: true, leaned: true, tint: this.disabled ? 'neutral' : this.tint, size: getProgressScale(this).size, strokeWidth: getProgressScale(this).strokeWidth }))));
  }
  static get is() { return "dvn-button"; }
  static get originalStyleUrls() { return {
    "$": ["dvn-button.scss"]
  }; }
  static get styleUrls() { return {
    "$": ["dvn-button.css"]
  }; }
  static get properties() { return {
    "tint": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "Tint",
        "resolved": "\"danger\" | \"neutral\" | \"primary\" | \"secondary\" | \"warning\"",
        "references": {
          "Tint": {
            "location": "import",
            "path": "../../theme"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "tint",
      "reflect": false,
      "defaultValue": "'neutral'"
    },
    "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'"
    },
    "view": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "ButtonView",
        "resolved": "\"flat\" | \"ghost\" | \"outline\" | \"solid\"",
        "references": {
          "ButtonView": {
            "location": "import",
            "path": "./models"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "view",
      "reflect": false,
      "defaultValue": "'solid'"
    },
    "shape": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "ButtonShape",
        "resolved": "\"circle\" | \"rectangular\" | \"rounded\" | \"square\"",
        "references": {
          "ButtonShape": {
            "location": "import",
            "path": "./models"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "shape",
      "reflect": false,
      "defaultValue": "'rectangular'"
    },
    "disabled": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "disabled",
      "reflect": false,
      "defaultValue": "false"
    },
    "progressing": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "progressing",
      "reflect": false,
      "defaultValue": "false"
    },
    "leaned": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "leaned",
      "reflect": false,
      "defaultValue": "false"
    },
    "fill": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "fill",
      "reflect": false,
      "defaultValue": "false"
    },
    "tagMode": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "tag-mode",
      "reflect": false,
      "defaultValue": "false"
    },
    "abbrTitle": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "abbr-title",
      "reflect": false
    },
    "htmlType": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "'button' | 'submit'",
        "resolved": "\"button\" | \"submit\"",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "html-type",
      "reflect": false,
      "defaultValue": "'button'"
    },
    "formId": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "form-id",
      "reflect": false
    }
  }; }
}
