Sha256: 7b6cd9ce4aa9307b15d2c4403a942c4b6de90ba2572e9d2efa47ec7a0a70f5ea
Contents?: true
Size: 689 Bytes
Versions: 13
Compression:
Stored size: 689 Bytes
Contents
import { Controller } from "@hotwired/stimulus" import { useClickOutside, useTransition } from "stimulus-use" export default class extends Controller { static targets = ["menu", "open", "close"] connect() { useClickOutside(this); useTransition(this, { element: this.menuTarget }) } toggle() { this.toggleTransition(); } clickOutside() { if (!this.menuTarget.classList.contains("hidden")) { this.toggleTransition(); } } enter() { this.openTarget.classList.toggle("hidden") this.closeTarget.classList.toggle("hidden") } leave() { this.openTarget.classList.toggle("hidden") this.closeTarget.classList.toggle("hidden") } }
Version data entries
13 entries across 13 versions & 1 rubygems