import { CSSResultGroup, css, nothing } from 'lit'; import { LitElement, html, TemplateResult } from 'lit'; import { customElement, property } from 'lit/decorators.js'; import styles from './nile-loader.css'; import { classMap } from 'lit/directives/class-map.js'; import { watch } from '../internal/watch'; @customElement('nile-loader') export class NileLoader extends LitElement { @property({ type: String, attribute:'height' }) propHeight = ''; @property({ type: String, attribute:'width' }) propWidth = ''; @property({ type: String }) label = ''; @property({ type: String }) size : 'sm' | 'md' | 'lg' | 'xl'= 'lg'; @property({ type: String }) margin = ''; @property({ type: String }) variant = 'v1'; @property({ type: String }) color = 'var(--nile-colors-primary-600,var(--ng-colors-fg-brand-primary-600))'; private height: string; private width: string; connectedCallback(): void { super.connectedCallback() this.setSvgDimensions() if(this.variant=="v1" && this.color=="var(--nile-colors-primary-600,var(--ng-colors-fg-brand-primary-600))"){ this.color="var(--nile-colors-blue-500,var(--ng-colors-fg-brand-primary-600))" } } static override styles: CSSResultGroup = styles; /** * Sets circular loader's dimension. * If either height or width is absent the dimensions defaults to dimension based on size variant */ setSvgDimensions(){ if (!parseInt(this.propHeight) || !parseInt(this.propWidth)){ switch (this.size) { case 'sm': this.height='32'; this.width='32'; break; case 'md': this.height='48'; this.width='48'; break; case 'lg': this.height='56'; this.width='56'; break; default: this.height='64'; this.width='64'; break; } } else{ this.height=this.propHeight; this.width=this.propWidth; } } override render(){ return html`