UNPKG

@limetech/lime-elements

Version:
126 lines (125 loc) 2.99 kB
import { h } from '@stencil/core'; /** * @exampleComponent limel-example-banner * @slot buttons - Buttons to show in the banner */ export class Banner { constructor() { this.message = undefined; this.icon = undefined; this.isOpen = false; } /** * Open the banner */ async open() { this.isOpen = true; } /** * Close the banner */ async close() { this.isOpen = false; } render() { return (h("div", { class: `lime-banner ${this.isOpen ? 'lime-banner--open' : ''}` }, h("div", { class: "lime-banner__surface" }, h("div", { class: "lime-banner__content" }, h("div", { class: "icon-message" }, this.renderIcon(), h("div", null, this.message)), h("div", { class: "lime-banner__actions" }, h("slot", { name: "buttons" })))))); } renderIcon() { if (!this.icon) { return; } return (h("div", { class: "lime-banner__icon" }, h("limel-icon", { name: this.icon, badge: true, size: "large" }))); } static get is() { return "limel-banner"; } static get encapsulation() { return "shadow"; } static get originalStyleUrls() { return { "$": ["banner.scss"] }; } static get styleUrls() { return { "$": ["banner.css"] }; } static get properties() { return { "message": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": false, "docs": { "tags": [], "text": "The text to show on the banner." }, "attribute": "message", "reflect": true }, "icon": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": false, "docs": { "tags": [], "text": "Set icon for the banner" }, "attribute": "icon", "reflect": true } }; } static get states() { return { "isOpen": {} }; } static get methods() { return { "open": { "complexType": { "signature": "() => Promise<void>", "parameters": [], "references": { "Promise": { "location": "global" } }, "return": "Promise<void>" }, "docs": { "text": "Open the banner", "tags": [] } }, "close": { "complexType": { "signature": "() => Promise<void>", "parameters": [], "references": { "Promise": { "location": "global" } }, "return": "Promise<void>" }, "docs": { "text": "Close the banner", "tags": [] } } }; } } //# sourceMappingURL=banner.js.map