@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: '3961c11ea66eacabf9384474b7c8e6d9c01a3e13', class: this.alignmentClass() }, h("div", { key: 'e48435017dccaa4c980c90d2941a591c398139ad', class: `s-placeholder-icon s-placeholder-icon-${this.iconSize}`, innerHTML: this.icon }), h("div", { key: '4843fd497ff960ea219f6f15c361d25593958610', class: "s-placeholder-title" }, h("slot", { key: '68329602b3b574c56841503032207f15a59f7df4', name: 'title' }, h("span", { key: 'bca17b5772cc6dd677df7a504a4638f784b463da' }, salla.lang.get('common.elements.no_options')))), h("div", { key: '9f07301ac5162d5fdc1a2ea04bd59e71fdaa4cde', class: "s-placeholder-description" }, h("slot", { key: '1a27b5b3d1700313673b62edf99240a558187046', name: 'description' }, h("span", { key: '173ae7e49edc1b1aa225274afff129daa86f718f' }, 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 };