mwcpl
Version:
Master's Web Component Pattern Library
74 lines (73 loc) • 2.19 kB
JavaScript
import { Component, Host, h, Prop } from '@stencil/core';
export class MwcplNotification {
constructor() {
/**
* The text of the notification.
*/
this.label = '';
/**
* Makes the notification visible.
*/
this.show = false;
}
render() {
return (h(Host, { onClick: (e) => this.handleClick(e) },
h("slot", { name: "icon" }),
h("span", null, this.label),
h("slot", { name: "action" })));
}
handleClick(event) {
if (event) {
const target = event.target;
if (target.getAttribute('closeNotification') == '') {
this.show = false;
}
}
}
static get is() { return "mwcpl-notification"; }
static get encapsulation() { return "shadow"; }
static get originalStyleUrls() { return {
"$": ["mwcpl-notification.scss"]
}; }
static get styleUrls() { return {
"$": ["mwcpl-notification.css"]
}; }
static get properties() { return {
"label": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "The text of the notification."
},
"attribute": "label",
"reflect": false,
"defaultValue": "''"
},
"show": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "Makes the notification visible."
},
"attribute": "show",
"reflect": true,
"defaultValue": "false"
}
}; }
}