Sha256: e6ec8056d662f1dc5ab35e1703af68cfc56ab98e222754c9266ea0edcd901700
Contents?: true
Size: 750 Bytes
Versions: 3
Compression:
Stored size: 750 Bytes
Contents
import { Controller } from "@hotwired/stimulus" export default class extends Controller { static targets = [ "button", "tab" ] static values = { index: Number } indexValueChanged() { this.#showSelectedTab() } select({ target }) { this.indexValue = target.dataset.index } prev() { if (this.indexValue > 0) this.indexValue-- } next() { if (this.indexValue < this.#lastIndex) this.indexValue++ } get #lastIndex() { return this.tabTargets.length -1 } #showSelectedTab() { this.buttonTargets.forEach((element, index) => { element.ariaSelected = index === this.indexValue }) this.tabTargets.forEach((element, index) => { element.hidden = index !== this.indexValue }) } }
Version data entries
3 entries across 3 versions & 1 rubygems