app/components/solidus_admin/ui/toast/component.js in solidus_admin-0.0.2 vs app/components/solidus_admin/ui/toast/component.js in solidus_admin-0.1.0

- old
+ new

@@ -1,17 +1,20 @@ import { Controller } from '@hotwired/stimulus' export default class extends Controller { static targets = ['closeButton'] - static classes = ['closing'] + static classes = ['animation'] static values = { transition: Number } - connect () { - // Give focus to the close button - this.closeButtonTarget.focus(); + connect() { + this.closeButtonTarget.focus() + + requestAnimationFrame(() => { + this.element.classList.remove(...this.animationClasses) + }) } - close () { - this.element.classList.add(...this.closingClasses); + close() { + this.element.classList.add(...this.animationClasses) setTimeout(() => this.element.remove(), this.transitionValue) } }