component Spinner {
  props {
    color: string = "primary"
    label: string = "Loading"
    size: string = "md"
    lines: number = 3
    class: string = ""
  }
  view {
    <div class="wire-spinner-component {class}" data-color="{color}" data-size="{size}" role="status" aria-label="{label}">
      <i class="wire-spinner-component__indicator" aria-hidden="true"></i>
    </div>
  }

  style {
    .wire-spinner-component {
      --wire-spinner-size: 1.5rem;
      --wire-spinner-color: var(--wire-color-primary);
      display: inline-grid;
      place-items: center;
    }

    .wire-spinner-component[data-size="xs"] { --wire-spinner-size: 0.875rem; }
    .wire-spinner-component[data-size="sm"] { --wire-spinner-size: 1.125rem; }
    .wire-spinner-component[data-size="lg"] { --wire-spinner-size: 2rem; }
    .wire-spinner-component[data-size="xl"] { --wire-spinner-size: 2.5rem; }
    .wire-spinner-component[data-color="secondary"] { --wire-spinner-color: var(--wire-color-secondary); }
    .wire-spinner-component[data-color="success"] { --wire-spinner-color: var(--wire-color-success); }
    .wire-spinner-component[data-color="warning"] { --wire-spinner-color: var(--wire-color-warning); }
    .wire-spinner-component[data-color="danger"] { --wire-spinner-color: var(--wire-color-danger); }
    .wire-spinner-component[data-color="info"] { --wire-spinner-color: var(--wire-color-info); }

    .wire-spinner-component__indicator {
      display: block;
      width: var(--wire-spinner-size);
      height: var(--wire-spinner-size);
      border: 2px solid var(--wire-color-border);
      border-top-color: var(--wire-spinner-color);
      border-radius: 50%;
      animation: wire-spinner-component-spin 700ms linear infinite;
    }

    @keyframes wire-spinner-component-spin { to { transform: rotate(360deg); } }

    @media (prefers-reduced-motion: reduce) {
      .wire-spinner-component__indicator { animation-duration: 1.8s; }
    }
  }
}
