@kelvininc/ui-components
Version:
Kelvin UI Components
162 lines (161 loc) • 6.53 kB
JavaScript
import { Host, h } from "@stencil/core";
import { ALERT_ICON_NAMES } from "./alert.config";
import { EComponentSize } from "../../types";
/**
* @part container - The alert container.
*/
export class KvAlert {
constructor() {
/** @inheritdoc */
this.size = EComponentSize.Large;
/** @inheritdoc */
this.showIcon = true;
}
render() {
return (h(Host, { key: '9beb6ad2e18eb3461e82a69172a32161c8e59ce3' }, h("div", { key: 'da22f882860cc7b7d48cd52b4ac2e594f7cd7228', class: "alert-container" }, h("div", { key: '32cff6ba6efe2dd4f5d6904ad744498dfec3f853', part: "container", class: {
'alert': true,
[`alert--type-${this.type}`]: true,
'alert--size-small': this.size === EComponentSize.Small
} }, h("div", { key: 'dfd7833877925992bde1851262a6dffa7c8476c6', class: "information" }, this.showIcon && h("kv-icon", { key: '8cf4eaed3b04962519bcfe9e8663efde7ad67402', name: ALERT_ICON_NAMES[this.type], class: "icon" }), h("div", { key: '23aaea7b6a924cb81635a9c914b4c169bce877a5', class: "text-container" }, h("div", { key: '7c7afb49cb49cb44f0ee00149d2c2089da423f4e', class: "title" }, this.label), h("slot", { key: '72d42bec31a02f6c24a096ef68d4001d5780d5cd', name: "description" }, this.description && h("div", { key: '34980a019ffbb65a8ac07ce02b331c72c0353050', class: "description" }, this.description)))), h("slot", { key: '31d7343a44dd75dfed32f9b57f846e5f16109b99', name: "actions" })))));
}
static get is() { return "kv-alert"; }
static get encapsulation() { return "shadow"; }
static get originalStyleUrls() {
return {
"$": ["alert.scss"]
};
}
static get styleUrls() {
return {
"$": ["alert.css"]
};
}
static get properties() {
return {
"type": {
"type": "string",
"attribute": "type",
"mutable": false,
"complexType": {
"original": "EAlertType",
"resolved": "EAlertType.Error | EAlertType.Info | EAlertType.Success | EAlertType.Warning",
"references": {
"EAlertType": {
"location": "import",
"path": "./alert.types",
"id": "src/components/alert/alert.types.ts::EAlertType"
}
}
},
"required": true,
"optional": false,
"docs": {
"tags": [{
"name": "inheritdoc",
"text": undefined
}],
"text": "(required) Defines the type of alert to show, possible values are defined in `EAlertType`"
},
"getter": false,
"setter": false,
"reflect": true
},
"size": {
"type": "string",
"attribute": "size",
"mutable": false,
"complexType": {
"original": "EComponentSize",
"resolved": "EComponentSize.Large | EComponentSize.Small",
"references": {
"EComponentSize": {
"location": "import",
"path": "../../types",
"id": "src/types.ts::EComponentSize"
}
}
},
"required": false,
"optional": true,
"docs": {
"tags": [{
"name": "inheritdoc",
"text": undefined
}],
"text": "(optional) Defines the size of the component, defaults to EComponentType.Large"
},
"getter": false,
"setter": false,
"reflect": true,
"defaultValue": "EComponentSize.Large"
},
"showIcon": {
"type": "boolean",
"attribute": "show-icon",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [{
"name": "inheritdoc",
"text": undefined
}],
"text": "(optional) Defines if the icon should be shown, defaults to `true`"
},
"getter": false,
"setter": false,
"reflect": true,
"defaultValue": "true"
},
"label": {
"type": "string",
"attribute": "label",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": true,
"optional": false,
"docs": {
"tags": [{
"name": "inheritdoc",
"text": undefined
}],
"text": "(required) Defines the label (title) text to show"
},
"getter": false,
"setter": false,
"reflect": true
},
"description": {
"type": "string",
"attribute": "description",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [{
"name": "inheritdoc",
"text": undefined
}],
"text": "(optional) Defines the description text to show"
},
"getter": false,
"setter": false,
"reflect": true
}
};
}
}