bulma-rails-helpers 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 778c3dafae213061ae5a31634952cb0c0afddec441ac6c47eb37584ae3ba782a
4
- data.tar.gz: 2774b17df0e7ae39652bb62f5a715d029d0bd4782ee9a1f1e6b132ceb34ccc1b
3
+ metadata.gz: 347a5e9175dcd570a12788b66d3879b62086def07f691534c523adf52e025512
4
+ data.tar.gz: 4725fa0aa7a19f42900e722052c87c86c4a9fa4b8e4d0ba1cb3b4f44c7204dc2
5
5
  SHA512:
6
- metadata.gz: af60202790e1e7c9daf8e0819419c1972fbc227a7ad2166a4619bb2e5bbbc517b511f78308050c50008fd7cff0085f964839693cf9e94bb4768437e7a9d77f1d
7
- data.tar.gz: 36c86bbbf37c810e9022252e8823493298ab4737eaa550e11334a9c25b915f052b0b04633f91d74d8f88645a7f1f6260405ebe6d04632b429e795cee2b584984
6
+ metadata.gz: 8569b3574a226c561db4f7c1c6d1170f6bd20703b4a1803f482049216c8764ec87957056fd0685f0f573d07a233f02227f66a9ea24638182c1f1a2f64f30333e
7
+ data.tar.gz: a6a11d469c862730ef1ae91b6bff9c58108bf3228b89c851c9ff7a93f5072cecf08f09da546863704e41969ac7c3ddc22906c97957e56b3a6bf3ab6e8470c144
@@ -0,0 +1,38 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ /*
4
+ To use this Stimulus controller, add the controller to your dropdown container
5
+ and the action to your dropdown button:
6
+
7
+ <div class="dropdown" data-controller="bulma--dropdown">
8
+ <button data-action="bulma--dropdown#toggle">
9
+ Dropdown
10
+ </button>
11
+ <div class="dropdown-menu">...</div>
12
+ </div>
13
+
14
+ This will toggle the dropdown menu when the button is clicked.
15
+ */
16
+
17
+ export default class extends Controller {
18
+ connect() {
19
+ this.closeHandler = this.close.bind(this)
20
+ document.addEventListener('click', this.closeHandler)
21
+ }
22
+
23
+ disconnect() {
24
+ if (this.closeHandler) {
25
+ document.removeEventListener('click', this.closeHandler);
26
+ this.closeHandler = null;
27
+ }
28
+ }
29
+
30
+ toggle(event) {
31
+ event.stopPropagation()
32
+ this.element.classList.toggle('is-active')
33
+ }
34
+
35
+ close(_event) {
36
+ this.element.classList.remove('is-active')
37
+ }
38
+ }
data/lib/bulma/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Bulma
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulma-rails-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Kummer
@@ -46,6 +46,7 @@ extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
48
  - app/helpers/bulma/form_helper.rb
49
+ - app/javascript/controllers/bulma/dropdown_controller.js
49
50
  - app/javascript/controllers/bulma/file_input_display_controller.js
50
51
  - app/javascript/controllers/bulma/navigation_bar_controller.js
51
52
  - config/importmap.rb