@claromentis/design-system
Version:
Claromentis Design System Component Library
127 lines (126 loc) • 3.85 kB
JavaScript
import { h } from '@stencil/core';
export class ClaProgressCircle {
constructor() {
this.percentage = 0;
this.primarycolor = "#000";
this.size = "90px";
this.inverted = undefined;
this.customtext = undefined;
}
getClassMap() {
const inverted = this.inverted;
const percentage = this.percentage;
return {
'cla-progress-circle': true,
[`cla-progress-circle-inverted`]: inverted,
[`p${percentage}`]: percentage >= 0 && percentage <= 100
};
}
render() {
return (h("div", { style: { fontSize: `${this.size}` }, class: this.getClassMap() }, h("div", { style: { color: this.percentage && `${this.primarycolor}` }, class: this.customtext ? `center-text custom-center-text` : "center-text" }, this.customtext ? `${this.customtext}` : `${this.percentage}%`), h("div", { class: "slice" }, h("div", { style: { borderColor: `${this.primarycolor}` }, class: "left-side" }), h("div", { style: { borderColor: `${this.primarycolor}` }, class: "right-side" }))));
}
static get is() { return "cla-progress-circle"; }
static get encapsulation() { return "shadow"; }
static get originalStyleUrls() {
return {
"$": ["cla-progress-circle.scss"]
};
}
static get styleUrls() {
return {
"$": ["cla-progress-circle.css"]
};
}
static get properties() {
return {
"percentage": {
"type": "number",
"mutable": false,
"complexType": {
"original": "number",
"resolved": "number",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "The percentage of completion of the progress circle - this automatically created from the percentage number"
},
"attribute": "percentage",
"reflect": false,
"defaultValue": "0"
},
"primarycolor": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "The primary color which affects the percentage bar color and the percentage text color"
},
"attribute": "primarycolor",
"reflect": false,
"defaultValue": "\"#000\""
},
"size": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "The size of the progress circle - defaults to 90px but can set to any size in px, em, rems."
},
"attribute": "size",
"reflect": false,
"defaultValue": "\"90px\""
},
"inverted": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "false",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "Whether to use the inverted variant of the progress circle."
},
"attribute": "inverted",
"reflect": false
},
"customtext": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "Using the customtext attribute you can add text in place of the percentage number"
},
"attribute": "customtext",
"reflect": false
}
};
}
}