@salla.sa/twilight-components
Version:
Salla Web Component
70 lines (65 loc) • 3.53 kB
JavaScript
/*!
* Crafted with ❤ by Salla
*/
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
var Inbox = `<!-- Generated by IcoMoon.io -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
<title>inbox</title>
<path d="M31.984 19.797l-2.667-17.333c-0.1-0.651-0.659-1.131-1.317-1.131h-24c-0.659 0-1.217 0.48-1.317 1.131l-2.667 17.333c-0.011 0.067-0.016 0.135-0.016 0.203v6.667c0 2.205 1.795 4 4 4h24c2.205 0 4-1.795 4-4v-6.667c0-0.068-0.005-0.136-0.016-0.203zM5.144 4h21.712l2.256 14.667h-9.112c-0.736 0-1.333 0.596-1.333 1.333 0 1.471-1.196 2.667-2.667 2.667s-2.667-1.196-2.667-2.667c0-0.737-0.597-1.333-1.333-1.333h-9.112zM29.333 26.667c0 0.736-0.599 1.333-1.333 1.333h-24c-0.735 0-1.333-0.597-1.333-1.333v-5.333h8.168c0.593 2.299 2.684 4 5.165 4s4.571-1.701 5.165-4h8.168z"></path>
</svg>
`;
const sallaPlaceholderCss = "";
const SallaPlaceholder = /*@__PURE__*/ proxyCustomElement(class SallaPlaceholder extends HTMLElement {
constructor() {
super();
this.__registerHost();
this.translationLoaded = false;
/**
* Custom icon to display, defaults to [`Inbox`], can be any valid svg icon or inline element with font icon
*/
this.icon = Inbox;
/**
* Defines the alignment of contents. Defaults to [`left`]
*/
this.alignment = 'left';
/**
* The size of the icon. Defaults to [`md`] = 45px for font icon & width/height: 3.5rem for svg icon
*/
this.iconSize = 'md';
salla.lang.onLoaded(() => {
this.translationLoaded = true;
});
}
alignmentClass() {
return {
's-placeholder-wrapper': true,
's-placeholder-align-left': this.alignment == 'left',
's-placeholder-align-center': this.alignment == 'center',
's-placeholder-align-right': this.alignment == 'right',
};
}
render() {
return (h(Host, { key: '80c0ead7511fe00ce4fa0f92dc5ad9b3448811fa', class: this.alignmentClass() }, h("div", { key: '26e81619824a58476c66374fc79377596454969c', class: `s-placeholder-icon s-placeholder-icon-${this.iconSize}`, innerHTML: this.icon }), h("div", { key: '256946363be9fd8aea06f35b4ff837009a3d0b32', class: "s-placeholder-title" }, h("slot", { key: 'd519fbb70c3b3d309caa86c8740ee732fcbeeb70', name: 'title' }, h("span", { key: '6c9a6d8d7c8581944554884541c80884435fb217' }, salla.lang.get('common.elements.no_options')))), h("div", { key: '1cd09e170e1d7f44ec251522ab3bcf1d71eaff02', class: "s-placeholder-description" }, h("slot", { key: '5e38a5794f5b655131cba0a4c590ca7509ffae51', name: 'description' }, h("span", { key: 'b7c9abd6f44092a804177067e7456b7d6468d4df' }, salla.lang.get('common.errors.empty_results'))))));
}
static get style() { return sallaPlaceholderCss; }
}, [4, "salla-placeholder", {
"icon": [1],
"alignment": [1],
"iconSize": [1, "icon-size"],
"translationLoaded": [32]
}]);
function defineCustomElement() {
if (typeof customElements === "undefined") {
return;
}
const components = ["salla-placeholder"];
components.forEach(tagName => { switch (tagName) {
case "salla-placeholder":
if (!customElements.get(tagName)) {
customElements.define(tagName, SallaPlaceholder);
}
break;
} });
}
defineCustomElement();
export { SallaPlaceholder as S, defineCustomElement as d };