Sha256: 69262ead28b5fb6a5f31dbd4513ad9bc70b9d21d61908c8400b06c0e6d0096a0

Contents?: true

Size: 888 Bytes

Versions: 774

Compression:

Stored size: 888 Bytes

Contents

import PbEnhancedElement from '../pb_enhanced_element'

export default class PbFixedConfirmationToast extends PbEnhancedElement {
  static get selector() {
    return '.remove_toast'
  }

  connect() {
    this.self = this.element
    this.autoCloseToast(this.self)

    this.self.addEventListener('click', () => {
      this.removeToast(this.self)
    })
  }

  removeToast(elem) {
    elem.parentNode.removeChild(elem)
  }

  autoCloseToast(element) {
    const classListValues = element.classList.value
    const hasAutoCloseClass = classListValues.includes('auto_close')

    if (hasAutoCloseClass) {
      const classList = classListValues.split(' ')
      const autoCloseValue = classList[classList.length - 1].split('_')[2]
      const autoCloseIntValue = parseInt(autoCloseValue)

      setTimeout(() => {
        this.removeToast(element)
      }, autoCloseIntValue)
    }
  }
}

Version data entries

774 entries across 774 versions & 1 rubygems

Version Path
playbook_ui-14.8.0.pre.alpha.PLAY1680newwidthprop4661 app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js
playbook_ui-14.8.0.pre.alpha.PLAY1658tanstackbump4657 app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js
playbook_ui-14.8.0.pre.alpha.PLAY1649rolloutheightglobalprops4635 app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js
playbook_ui-14.9.0.pre.rc.8 app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js
playbook_ui-14.8.0.pre.alpha.PLAY1598floatinguiupgrade4617 app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js
playbook_ui-14.9.0.pre.rc.7 app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js
playbook_ui-14.9.0.pre.rc.6 app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js
playbook_ui-14.9.0.pre.rc.5 app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js
playbook_ui-14.8.0.pre.alpha.pbntr661createstickyleftprop4612 app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js
playbook_ui-14.8.0.pre.alpha.play1648heightglobalprops4606 app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js
playbook_ui-14.9.0.pre.rc.4 app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js
playbook_ui-14.9.0.pre.rc.3 app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js
playbook_ui-14.9.0.pre.rc.2 app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js
playbook_ui-14.8.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4567 app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js
playbook_ui-14.8.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4565 app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js
playbook_ui-14.8.0.pre.alpha.PLAY1598floatinguiupgrade4563 app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js
playbook_ui-14.8.0.pre.alpha.play1648heightglobalprops4559 app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js
playbook_ui-14.9.0.pre.rc.1 app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js
playbook_ui-14.8.0.pre.alpha.PLAY16254545 app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js
playbook_ui-14.8.0.pre.alpha.PLAY1615movenegativetoleftofcurrencysign4543 app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js