Sha256: b6123016d43965ecbaa9e8a39d7a49a1c9a84c86dd60cf298bbfb75b68aa5a2a

Contents?: true

Size: 518 Bytes

Versions: 27

Compression:

Stored size: 518 Bytes

Contents

import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
  
  connect() {
    this.update()
  }
  
  update() {
    if (this.hasValue) {
      this.element.classList.remove('text-gray-400')
      this.element.classList.add('text-gray-700')
    } else {
      this.element.classList.add('text-gray-400')
      this.element.classList.remove('text-gray-700')  
    }
  }
  
  get hasValue() {
    return this.value.length > 0
  }
  
  get value() {
    return this.element.value
  }
  
}

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
spina-2.18.0 app/assets/javascripts/spina/controllers/select_placeholder_controller.js
spina-2.17.0 app/assets/javascripts/spina/controllers/select_placeholder_controller.js
spina-2.16.0 app/assets/javascripts/spina/controllers/select_placeholder_controller.js
spina-2.15.1 app/assets/javascripts/spina/controllers/select_placeholder_controller.js
spina-2.15.0 app/assets/javascripts/spina/controllers/select_placeholder_controller.js
spina-2.14.0 app/assets/javascripts/spina/controllers/select_placeholder_controller.js
spina-2.13.1 app/assets/javascripts/spina/controllers/select_placeholder_controller.js
spina-2.13.0 app/assets/javascripts/spina/controllers/select_placeholder_controller.js
spina-2.12.0 app/assets/javascripts/spina/controllers/select_placeholder_controller.js
spina-2.11.0 app/assets/javascripts/spina/controllers/select_placeholder_controller.js
spina-2.10.0 app/assets/javascripts/spina/controllers/select_placeholder_controller.js
spina-2.9.1 app/assets/javascripts/spina/controllers/select_placeholder_controller.js
spina-2.9.0 app/assets/javascripts/spina/controllers/select_placeholder_controller.js
spina-2.8.1 app/assets/javascripts/spina/controllers/select_placeholder_controller.js
spina-2.8.0 app/assets/javascripts/spina/controllers/select_placeholder_controller.js
spina-2.7.0 app/assets/javascripts/spina/controllers/select_placeholder_controller.js
spina-2.6.2 app/assets/javascripts/spina/controllers/select_placeholder_controller.js
spina-2.6.1 app/assets/javascripts/spina/controllers/select_placeholder_controller.js
spina-2.6.0 app/assets/javascripts/spina/controllers/select_placeholder_controller.js
spina-2.5.0 app/assets/javascripts/spina/controllers/select_placeholder_controller.js