Sha256: da21fb6385491a780c38fc3c3ff64d5c51a41fc54761535e64d9f782a55dab34
Contents?: true
Size: 994 Bytes
Versions: 16
Compression:
Stored size: 994 Bytes
Contents
class UnlinkButton extends HTMLButtonElement { constructor() { super() this.addEventListener("click", this) this.classList.add("icon_button") // Prevent accidental form submits if this component is wrapped inside a form this.setAttribute("type", "button") this.linked = this.linked this.innerHTML = '<i class="icon ri-link-unlink-m ri-fw"></i>' } handleEvent(event) { if (this.linked) { this.linked = false this.blur() this.dispatchEvent(new CustomEvent("alchemy:unlink", { bubbles: true })) } event.preventDefault() } set linked(isLinked) { if (isLinked) { this.classList.replace("disabled", "linked") this.removeAttribute("tabindex") } else { this.classList.replace("linked", "disabled") this.setAttribute("tabindex", "-1") } } get linked() { return this.classList.contains("linked") } } customElements.define("alchemy-unlink-button", UnlinkButton, { extends: "button" })
Version data entries
16 entries across 16 versions & 1 rubygems