/** * Copyright Aquera Inc 2026 * * This source code is licensed under the BSD-3-Clause license found in the * LICENSE file in the root directory of this source tree. */ import { html, TemplateResult } from 'lit'; import { styles } from './nile-status-light.css'; import { classMap } from 'lit/directives/class-map.js'; import { customElement, property } from 'lit/decorators.js'; import NileElement, { setupA11yMetadata } from '../internal/nile-element'; import type { CSSResultGroup } from 'lit'; import { A11yProperty } from '../internal/accessibility/a11y.property.enum'; import { A11yRole } from '../internal/accessibility/a11y.role.enum'; import { Role } from '../internal/accessibility/role.enum'; /** * Nile status light component. * * @tag nile-status-light * * @summary Status lights describe the status of an object, using a colored dot * alongside a text label (e.g. "Active", "Error", "Pending"). * @status experimental * * @slot - The status light's text label. * * @attr {boolean} pulse - Optional pulse animation for active statuses. * * @csspart base - The component's base wrapper. * @csspart indicator - The colored status dot. * @csspart label - The status light's text label. * * @example * * Active * * @example * * Inactive */ @customElement('nile-status-light') export class NileStatusLight extends NileElement { static styles: CSSResultGroup = styles; connectedCallback(): void { super.connectedCallback(); setupA11yMetadata(this, { [Role.Role]: A11yRole.Text, [A11yProperty.AriaLabel]: this.textContent?.trim() || '', }); } /** The status light's color variant. */ @property({ reflect: true }) variant: | 'positive' | 'negative' | 'notice' | 'informative' | 'neutral' | 'inactive' = 'neutral'; /** The status light's size. */ @property({ reflect: true, attribute: true }) size: 'small' | 'medium' | 'large' | 'x-large' = 'medium'; /** Disables the status light, muting its colors. */ @property({ type: Boolean, reflect: true }) disabled = false; /** Draws attention to an active status with a pulsing animation around the dot. */ @property({ type: Boolean, reflect: true }) pulse = false; render(): TemplateResult { return html` `; } } export default NileStatusLight; declare global { interface HTMLElementTagNameMap { 'nile-status-light': NileStatusLight; } }