UNPKG

@kelvininc/ui-components

Version:
42 lines (37 loc) 2.52 kB
import { p as proxyCustomElement, H, h, e as Host } from './p-D6GMjtmE.js'; const loaderCss = "@property --rotation{syntax:\"<angle>\";initial-value:0deg;inherits:false}@keyframes rotate-border{to{--rotation:360deg}}:host{--loader-overlay-color:var(--kv-neutral-4, #bebebe);--loader-overlay-opacity:0.4;--loader-background-color:var(--kv-neutral-2, #e5e5e5);--loader-spinner-color:var(--kv-secondary-5, #8358fe);--loader-padding:15px;--loader-border-size:6px;--loader-z-index:1}.loader-container{width:100%;height:100%;position:absolute;top:0;left:0;z-index:var(--loader-z-index)}.loader-container .overlay{width:100%;height:100%;opacity:var(--loader-overlay-opacity);background-color:var(--loader-overlay-color)}.loader-container .loader{height:0;width:0;padding:var(--loader-padding);border:var(--loader-border-size) solid var(--loader-background-color);border-right-color:var(--loader-spinner-color);border-radius:50%;animation:loadrotate 1s infinite linear;position:absolute;top:0;left:0;bottom:0;right:0;margin:auto}@keyframes loadrotate{100%{transform:rotate(360deg)}}"; const KvLoader$1 = /*@__PURE__*/ proxyCustomElement(class KvLoader extends H { constructor() { super(); this.__registerHost(); this.__attachShadow(); /** (optional) If `true` the loader is enabled */ this.isLoading = false; /** (optional) If `true` the loader is overlay */ this.hasOverlay = false; } render() { return (h(Host, { key: '4f18fb1a2b9ebffd50061acc651b80f9dceb91ca' }, this.isLoading && (h("div", { key: '73a15860c750af1854ca0a94abaee615f06eb164', class: "loader-container" }, this.hasOverlay && h("div", { key: '97ab947bbe4c61b2982d2f81ebdce6860637d874', class: "overlay" }), h("div", { key: '3981c1cd8e180f086c52ffa594dd8ef9a2a411a6', class: "loader" }))))); } static get style() { return loaderCss; } }, [1, "kv-loader", { "isLoading": [516, "is-loading"], "hasOverlay": [516, "has-overlay"] }]); function defineCustomElement$1() { if (typeof customElements === "undefined") { return; } const components = ["kv-loader"]; components.forEach(tagName => { switch (tagName) { case "kv-loader": if (!customElements.get(tagName)) { customElements.define(tagName, KvLoader$1); } break; } }); } defineCustomElement$1(); const KvLoader = KvLoader$1; const defineCustomElement = defineCustomElement$1; export { KvLoader, defineCustomElement };