@salla.sa/twilight-components
Version:
Salla Web Component
87 lines (86 loc) • 3.77 kB
JavaScript
/*!
* Crafted with ❤ by Salla
*/
import { Host, h } from "@stencil/core";
/**
* @slot icon - An icon to display before the title.
* @slot title - The primary content of the list tile.
* @slot subtitle - Additional content displayed below the title.
* @slot action - An element to display after the title.
*/
export class SallaListTile {
constructor() {
/**
* Designates the component as anchor and applies the `href` attribute.
*/
this.href = undefined;
/**
* Designates the target attribute. This should only be applied when using the `href` prop.
*/
this.target = "_self";
}
generateClass() {
return {
"s-list-tile-item": true,
"s-list-tile-item-href": !!this.href
};
}
render() {
return (h(Host, { key: 'c66af50f4293094425640dd48246a973a240687b' }, h("a", { key: '5f2969fa28b312b2df0aa8f4ea93476f3d46f415', class: this.generateClass(), href: this.href || "#", target: this.target, "aria-label": "List Tile Link" }, h("div", { key: '4b92b66742957d2cb1d0961f78912ee28fd156d2', class: "s-list-tile-item-icon" }, h("slot", { key: '8593c413f0f7ed60d5f5b2e80a1e10880b6fd063', name: 'icon' })), h("div", { key: '469efd30ddfd208c1b73b6fc4485ae7fae11f914', class: "s-list-tile-item-content" }, h("div", { key: 'e5bebc43345b3921597d73020948ed5f913974e8', class: "s-list-tile-item-title" }, h("slot", { key: '306e82cccd99c6a8341c23fc5f8f35c5a656a088', name: 'title' })), h("div", { key: 'b148fbbc417ff3e174833a91c8b852525f6cacc1', class: "s-list-tile-item-subtitle" }, h("slot", { key: '44ef5d6b3aae8a7b511244be00c12700605c596a', name: "subtitle" }))), h("div", { key: '8cfd1fa5145a3b2adf7eb1da27f1cf96d7d96780', class: "s-list-tile-item-action" }, h("slot", { key: '47db71ae396cfc1cbdeb9fd7fd643afefd1af5db', name: 'action' })))));
}
static get is() { return "salla-list-tile"; }
static get originalStyleUrls() {
return {
"$": ["salla-list-tile.scss"]
};
}
static get styleUrls() {
return {
"$": ["salla-list-tile.css"]
};
}
static get properties() {
return {
"href": {
"type": "string",
"attribute": "href",
"mutable": false,
"complexType": {
"original": "string | undefined",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "Designates the component as anchor and applies the `href` attribute."
},
"getter": false,
"setter": false,
"reflect": false,
"defaultValue": "undefined"
},
"target": {
"type": "string",
"attribute": "target",
"mutable": false,
"complexType": {
"original": "\"_blank\" | \"_self\" | \"_parent\" | \"_top\" | \"framename\"",
"resolved": "\"_blank\" | \"_parent\" | \"_self\" | \"_top\" | \"framename\"",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "Designates the target attribute. This should only be applied when using the `href` prop."
},
"getter": false,
"setter": false,
"reflect": false,
"defaultValue": "\"_self\""
}
};
}
}