@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: 'e1528afcea1eda05a5ce206e95791e7611d24dd0' }, h("a", { key: '749a73c76d68ad36f1a6609ada69778662d56566', class: this.generateClass(), href: this.href || "#", target: this.target, "aria-label": "List Tile Link" }, h("div", { key: '7bfd448f86790b2afe0b7a5b8a5460c3b2be66ee', class: "s-list-tile-item-icon" }, h("slot", { key: '383e28a8832483e8ecc61e4f48a3ff1fe5db1038', name: 'icon' })), h("div", { key: 'c42bf126a9ff4014a4e2d85ff12b41d1a88a0e03', class: "s-list-tile-item-content" }, h("div", { key: '18a4a9ebd39e3a710f70dc33554d24e3c2850e53', class: "s-list-tile-item-title" }, h("slot", { key: '7211d627511bf2448cf161f40cc82b1822dd1e7a', name: 'title' })), h("div", { key: '044a7d76e05841f484387c7ed299107f33c9bc21', class: "s-list-tile-item-subtitle" }, h("slot", { key: 'df131034f1c5434722543e25552caed142794d55', name: "subtitle" }))), h("div", { key: '37abe0abab720da11cd55660578ec256c062e763', class: "s-list-tile-item-action" }, h("slot", { key: 'fcac02da17981ef4c6fa3cea50c551e3010352d9', 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\""
}
};
}
}