import { Controller } from "@hotwired/stimulus" export default class extends Controller { static targets = ["button"] static values = { loadingText: String } showLoading() { // Don't prevent form submission, just show loading state if (this.hasButtonTarget) { this.buttonTarget.disabled = true this.buttonTarget.setAttribute("aria-disabled", "true") this.buttonTarget.setAttribute("aria-busy", "true") this.buttonTarget.innerHTML = ` ${this.loadingTextValue || 'Loading...'} ` } } }