UNPKG

@rxdi/ui-kit

Version:

UI Components for building graphql-server website

119 lines (118 loc) 3.57 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.LoadingComponent = void 0; const lit_html_1 = require("@rxdi/lit-html"); const settings_1 = require("../settings"); /** * @customElement rx-loading */ let LoadingComponent = class LoadingComponent extends lit_html_1.LitElement { constructor() { super(...arguments); this.color = '#fff'; this.if = () => true; } }; __decorate([ (0, lit_html_1.property)({ type: String }), __metadata("design:type", String) ], LoadingComponent.prototype, "palette", void 0); __decorate([ (0, lit_html_1.property)({ type: String }), __metadata("design:type", Object) ], LoadingComponent.prototype, "color", void 0); __decorate([ (0, lit_html_1.property)({ attribute: false }), __metadata("design:type", Function) ], LoadingComponent.prototype, "if", void 0); LoadingComponent = __decorate([ (0, lit_html_1.Component)({ selector: 'rx-loading', style: (0, lit_html_1.css) ` .lds-ellipsis { display: inline-block; position: relative; width: 64px; height: 64px; } .lds-ellipsis div { position: absolute; top: 27px; width: 11px; height: 11px; border-radius: 50%; animation-timing-function: cubic-bezier(0, 1, 1, 0); } .lds-ellipsis div:nth-child(1) { left: 6px; animation: lds-ellipsis1 0.6s infinite; } .lds-ellipsis div:nth-child(2) { left: 6px; animation: lds-ellipsis2 0.6s infinite; } .lds-ellipsis div:nth-child(3) { left: 26px; animation: lds-ellipsis2 0.6s infinite; } .lds-ellipsis div:nth-child(4) { left: 45px; animation: lds-ellipsis3 0.6s infinite; } @keyframes lds-ellipsis1 { 0% { transform: scale(0); } 100% { transform: scale(1); } } @keyframes lds-ellipsis3 { 0% { transform: scale(1); } 100% { transform: scale(0); } } @keyframes lds-ellipsis2 { 0% { transform: translate(0, 0); } 100% { transform: translate(19px, 0); } } `, template() { return (0, lit_html_1.html) ` <style> .lds-ellipsis div { background: ${(0, lit_html_1.unsafeCSS)(this.palette ? `var(--${this.palette}-bg-color)` : this.color)}; } </style> ${this.if() ? (0, lit_html_1.html) ` <div class="lds-ellipsis"> <div></div> <div></div> <div></div> <div></div> </div> ` : ''} `; } }) ], LoadingComponent); exports.LoadingComponent = LoadingComponent; //# sourceMappingURL=loading.component.js.map