@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: 'bb33776d01406ff1e04bbdc741312f1a17ac3b7b' }, h("a", { key: '386b417c954bf4b2bac34e40d9bae19db7f61ec3', class: this.generateClass(), href: this.href || "#", target: this.target, "aria-label": "List Tile Link" }, h("div", { key: 'cbcd8c6f92a4cbe7afbd8797c36ae6f529abed1c', class: "s-list-tile-item-icon" }, h("slot", { key: 'bff76fdb467b2491f0c3b40bd7f475eda23fa9c8', name: 'icon' })), h("div", { key: 'c80e7c032abedea8d5929d8bb36a642336724fe1', class: "s-list-tile-item-content" }, h("div", { key: '2bea0273bb4c012e0f9f7ee948b14bc9ea8afc2a', class: "s-list-tile-item-title" }, h("slot", { key: '60c872b9ec9b369ba65452abad7860b3ba6ba640', name: 'title' })), h("div", { key: 'fbb1b6e49284c74f2933f056aa16fcbc25526703', class: "s-list-tile-item-subtitle" }, h("slot", { key: '5ad1bba1b71db13d4deb594ccb0f5898f24d2f23', name: "subtitle" }))), h("div", { key: '96358bf7ed34907a799efd8c6fb2caae6ca02f43', class: "s-list-tile-item-action" }, h("slot", { key: '8d496724103f0c3959845c8f5d4e662a3095c09e', 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\""
}
};
}
}