import { Component, h, Host, Prop } from '@stencil/core';
const tintsToIcons = {
  success: 'uil-check-circle',
  error: 'uil-exclamation-octagon',
};
const getIconSize = (scale = 'medium') => {
  switch (scale) {
    case 'large':
      return 18;
    case 'small':
      return 14;
    case 'medium':
    default:
      return 16;
  }
};
export class LinearProgress {
  constructor() {
    this.showPercent = false;
    this.scale = 'medium';
    this.tint = 'primary';
  }
  render() {
    const iconSize = getIconSize(this.scale);
    const selectedColor = this.status === 'error' ? 'danger' : this.status === 'success' ? 'secondary' : this.tint;
    const style = {};
    let iconName;
    if (this.strokeColor) {
      style['--stroke-color'] = this.strokeColor;
    }
    if (this.status) {
      iconName = tintsToIcons[this.status];
    }
    return (h(Host, { class: {
        [this.scale]: true,
        'd-flex': true,
        'align-items-center': true
      } },
      h("progress", { style: style, class: { [selectedColor]: !this.strokeColor, 'stroke-color': !!this.strokeColor }, max: "100", value: this.status === 'success' ? 100 : this.percent }),
      this.showPercent && !this.status &&
        h("span", null,
          this.percent,
          " %"),
      this.status &&
        h("span", { class: {
            'danger': this.status === 'error',
            'secondary': this.status !== 'error',
          } },
          h("dvn-icon", { iconName: iconName, class: "pr-2", size: iconSize }))));
  }
  static get is() { return "dvn-linear-progress"; }
  static get originalStyleUrls() { return {
    "$": ["dvn-linear-progress.scss"]
  }; }
  static get styleUrls() { return {
    "$": ["dvn-linear-progress.css"]
  }; }
  static get properties() { return {
    "percent": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "percent",
      "reflect": false
    },
    "showPercent": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "show-percent",
      "reflect": false,
      "defaultValue": "false"
    },
    "scale": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "Scale",
        "resolved": "\"large\" | \"medium\" | \"small\"",
        "references": {
          "Scale": {
            "location": "import",
            "path": "../../theme"
          }
        }
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "scale",
      "reflect": false,
      "defaultValue": "'medium'"
    },
    "tint": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "Tint",
        "resolved": "\"danger\" | \"neutral\" | \"primary\" | \"secondary\" | \"warning\"",
        "references": {
          "Tint": {
            "location": "import",
            "path": "../../theme"
          }
        }
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "tint",
      "reflect": false,
      "defaultValue": "'primary'"
    },
    "strokeColor": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "stroke-color",
      "reflect": false
    },
    "status": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "'success' | 'error' | undefined",
        "resolved": "\"error\" | \"success\"",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "status",
      "reflect": false
    }
  }; }
}
