/** * EDC Loading Spinner Component * * Reusable loading spinner with optional text label. * Supports different sizes and colors. * * @customElement edc-loading-spinner */ import { css, html, LitElement, nothing } from 'lit'; import { customElement, property } from 'lit/decorators.js'; export type SpinnerSize = 'small' | 'medium' | 'large'; @customElement('edc-loading-spinner') export class EdcLoadingSpinner extends LitElement { @property({ type: String }) size: SpinnerSize = 'medium'; @property({ type: String }) label?: string; @property({ type: String }) color: string = '#1976d2'; render() { return html`
${this.label ? html`
${this.label}
` : nothing}
`; } static styles = css` :host { display: block; } .loading-container { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 2rem; } .spinner { border: 2px solid #ddd; border-radius: 50%; animation: spin 1s linear infinite; } .spinner-small { width: 20px; height: 20px; border-width: 2px; } .spinner-medium { width: 40px; height: 40px; border-width: 3px; } .spinner-large { width: 60px; height: 60px; border-width: 4px; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .loading-label { color: #666; font-size: 0.9rem; } `; } declare global { interface HTMLElementTagNameMap { 'edc-loading-spinner': EdcLoadingSpinner; } }